belongs to Maven artifact com.android.support:preference-v7:28.0.0-alpha1
TwoStatePreference
public
abstract
class
TwoStatePreference
extends Preference
java.lang.Object | ||
↳ | android.support.v7.preference.Preference | |
↳ | android.support.v7.preference.TwoStatePreference |
![]() |
Common base class for preferences that have two selectable states, persist a boolean value in SharedPreferences, and may have dependent preferences that are enabled/disabled based on the current state.
Summary
Inherited XML attributes | |
---|---|
![]()
android.support.v7.preference.Preference
|
Inherited constants |
---|
![]()
android.support.v7.preference.Preference
|
Fields | |
---|---|
protected
boolean |
mChecked
|
Public constructors | |
---|---|
TwoStatePreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)
|
|
TwoStatePreference(Context context, AttributeSet attrs, int defStyleAttr)
|
|
TwoStatePreference(Context context, AttributeSet attrs)
|
|
TwoStatePreference(Context context)
|
Public methods | |
---|---|
boolean
|
getDisableDependentsState()
Returns whether dependents are disabled when this preference is on ( |
CharSequence
|
getSummaryOff()
Returns the summary to be shown when unchecked. |
CharSequence
|
getSummaryOn()
Returns the summary to be shown when checked. |
boolean
|
isChecked()
Returns the checked state. |
void
|
setChecked(boolean checked)
Sets the checked state and saves it to the |
void
|
setDisableDependentsState(boolean disableDependentsState)
Sets whether dependents are disabled when this preference is on ( |
void
|
setSummaryOff(CharSequence summary)
Sets the summary to be shown when unchecked. |
void
|
setSummaryOff(int summaryResId)
|
void
|
setSummaryOn(int summaryResId)
|
void
|
setSummaryOn(CharSequence summary)
Sets the summary to be shown when checked. |
boolean
|
shouldDisableDependents()
Checks whether this preference's dependents should currently be disabled. |
Protected methods | |
---|---|
void
|
onClick()
Processes a click on the preference. |
Object
|
onGetDefaultValue(TypedArray a, int index)
Called when a Preference is being inflated and the default value attribute needs to be read. |
void
|
onRestoreInstanceState(Parcelable state)
Hook allowing a Preference to re-apply a representation of its internal
state that had previously been generated by |
Parcelable
|
onSaveInstanceState()
Hook allowing a Preference to generate a representation of its internal state that can later be used to create a new instance with that same state. |
void
|
onSetInitialValue(boolean restoreValue, Object defaultValue)
Implement this to set the initial value of the Preference. |
void
|
syncSummaryView(PreferenceViewHolder holder)
Sync a summary holder contained within holder's subhierarchy with the correct summary text. |
Inherited methods | |
---|---|
![]()
android.support.v7.preference.Preference
|