Add ListPreferenceEx
This commit is contained in:
parent
6c0299446c
commit
8b85396e5d
1 changed files with 30 additions and 0 deletions
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* Copyright (c) 2022 Gaurav Ujjwal.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*
|
||||
* See COPYING.txt for more details.
|
||||
*/
|
||||
|
||||
package com.gaurav.avnc.ui.prefs
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import androidx.preference.ListPreference
|
||||
|
||||
/**
|
||||
* List preference with some extra features.
|
||||
*/
|
||||
class ListPreferenceEx(context: Context, attrs: AttributeSet) : ListPreference(context, attrs) {
|
||||
|
||||
/**
|
||||
* Summary used when preference is disabled.
|
||||
*/
|
||||
var disabledStateSummary: CharSequence? = null
|
||||
|
||||
override fun getSummary(): CharSequence? {
|
||||
if (!isEnabled && disabledStateSummary != null)
|
||||
return disabledStateSummary
|
||||
return super.getSummary()
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue