public abstract class AbstractTwoStatePreference extends Preference implements android.widget.Checkable
| Modifier and Type | Class and Description |
|---|---|
static class |
AbstractTwoStatePreference.SavedState
A data structure, which allows to save the internal state of an
AbstractTwoStatePreference. |
| Constructor and Description |
|---|
AbstractTwoStatePreference(android.content.Context context)
Creates a new preference, which has two selectable states.
|
AbstractTwoStatePreference(android.content.Context context,
android.util.AttributeSet attributeSet)
Creates a new preference, which has two selectable states.
|
AbstractTwoStatePreference(android.content.Context context,
android.util.AttributeSet attributeSet,
int defaultStyle)
Creates a new preference, which has two selectable states.
|
AbstractTwoStatePreference(android.content.Context context,
android.util.AttributeSet attributeSet,
int defaultStyle,
int defaultStyleResource)
Creates a new preference, which has two selectable states.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
getDisableDependentsState()
Returns, whether dependent preferences are disabled when this preference is checked, or when
this preference is not checked.
|
java.lang.CharSequence |
getSummary() |
java.lang.CharSequence |
getSummaryOff()
Returns the summary, which is shown when the preference is not checked.
|
java.lang.CharSequence |
getSummaryOn()
Returns the summary, which is shown when the preference is checked.
|
boolean |
isChecked() |
void |
onBindViewHolder(PreferenceViewHolder holder) |
protected void |
onCheckedChanged(boolean checked)
The method, which is invoked, when the preference has been checked or unchecked.
|
protected void |
onClick() |
protected java.lang.Object |
onGetDefaultValue(android.content.res.TypedArray typedArray,
int index) |
protected void |
onRestoreInstanceState(android.os.Parcelable state) |
protected android.os.Parcelable |
onSaveInstanceState() |
protected void |
onSetInitialValue(java.lang.Object defaultValue) |
void |
performClick()
Performs a click on the preference.
|
void |
setChecked(boolean checked) |
void |
setDisableDependentsState(boolean disableDependentsState)
Sets, whether dependent preferences should be disabled when this preference is checked, or
when this preference is not checked.
|
void |
setSummaryOff(java.lang.CharSequence summaryOff)
Sets the summary, which should be shown when the preference is not checked.
|
void |
setSummaryOff(int resourceId)
Sets the summary, which should be shown when the preference is not checked.
|
void |
setSummaryOn(java.lang.CharSequence summaryOn)
Sets the summary, which should be shown when the preference is checked.
|
void |
setSummaryOn(int resourceId)
Sets the summary, which should be shown when the preference is checked.
|
boolean |
shouldDisableDependents() |
void |
toggle() |
getIconTintList, getIconTintMode, setIcon, setIconTint, setIconTintList, setIconTintModepublic AbstractTwoStatePreference(android.content.Context context)
context - The context, which should be used by the preference, as an instance of the class
Context. The context may not be nullpublic AbstractTwoStatePreference(android.content.Context context,
android.util.AttributeSet attributeSet)
context - The context, which should be used by the preference, as an instance of the class
Context. The context may not be nullattributeSet - The attributes of the XML tag that is inflating the preference, as an instance of the
type AttributeSet or null, if no attributes are availablepublic AbstractTwoStatePreference(android.content.Context context,
android.util.AttributeSet attributeSet,
int defaultStyle)
context - The context, which should be used by the preference, as an instance of the class
Context. The context may not be nullattributeSet - The attributes of the XML tag that is inflating the preference, as an instance of the
type AttributeSet or null, if no attributes are availabledefaultStyle - The default style to apply to this preference. If 0, no style will be applied (beyond
what is included in the theme). This may either be an attribute resource, whose value
will be retrieved from the current theme, or an explicit style resourcepublic AbstractTwoStatePreference(android.content.Context context,
android.util.AttributeSet attributeSet,
int defaultStyle,
int defaultStyleResource)
context - The context, which should be used by the preference, as an instance of the class
Context. The context may not be nullattributeSet - The attributes of the XML tag that is inflating the preference, as an instance of the
type AttributeSet or null, if no attributes are availabledefaultStyle - The default style to apply to this preference. If 0, no style will be applied (beyond
what is included in the theme). This may either be an attribute resource, whose value
will be retrieved from the current theme, or an explicit style resourcedefaultStyleResource - A resource identifier of a style resource that supplies default values for the
preference, used only if the default style is 0 or can not be found in the theme. Can
be 0 to not look for defaultsprotected void onCheckedChanged(boolean checked)
checked - True, if the preference has been checked, false otherwisepublic final java.lang.CharSequence getSummaryOn()
CharSequence or null, if no dedicated summary is shown when the preference is
checkedpublic final void setSummaryOn(java.lang.CharSequence summaryOn)
summaryOn - The summary, which should be set, as an instance of the type CharSequence or
null, if no dedicated summary should be shown when the preference is checkedpublic final void setSummaryOn(int resourceId)
resourceId - The resource id of the summary, which should be set, as an Integer value. The
resource id must correspond to a valid string resourcepublic final java.lang.CharSequence getSummaryOff()
CharSequence or null, if no dedicated summary is shown when the preference is
not checkedpublic final void setSummaryOff(int resourceId)
resourceId - The resource id of the summary, which should be set, as an Integer value. The
resource id must correspond to a valid string resourcepublic final void setSummaryOff(java.lang.CharSequence summaryOff)
summaryOff - The summary, which should be set, as an instance of the type CharSequence or
null, if no dedicated summary should be shown when the preference is not checkedpublic final boolean getDisableDependentsState()
public final void setDisableDependentsState(boolean disableDependentsState)
disableDependentsState - True, if dependent preferences should be disabled when this preference is checked,
false, if they should be disabled when this preference is not checkedpublic final boolean isChecked()
isChecked in interface android.widget.Checkablepublic final void setChecked(boolean checked)
setChecked in interface android.widget.Checkablepublic final void toggle()
toggle in interface android.widget.Checkablepublic final void performClick()
PreferenceperformClick in class Preferencepublic final boolean shouldDisableDependents()
public final java.lang.CharSequence getSummary()
protected final java.lang.Object onGetDefaultValue(android.content.res.TypedArray typedArray,
int index)
protected final void onSetInitialValue(java.lang.Object defaultValue)
protected void onClick()
public void onBindViewHolder(PreferenceViewHolder holder)
protected android.os.Parcelable onSaveInstanceState()
protected void onRestoreInstanceState(android.os.Parcelable state)