public abstract class AbstractTwoStatePreference
extends android.preference.Preference
| 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()
Returns, whether the preference is currently checked, or not.
|
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(boolean restoreValue,
java.lang.Object defaultValue) |
void |
setChecked(boolean checked)
Sets, whether the preference should currently be checked, or not.
|
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() |
callChangeListener, compareTo, findPreferenceInHierarchy, getContext, getDependency, getEditor, getExtras, getFragment, getIcon, getIntent, getKey, getLayoutResource, getOnPreferenceChangeListener, getOnPreferenceClickListener, getOrder, getPersistedBoolean, getPersistedFloat, getPersistedInt, getPersistedLong, getPersistedString, getPreferenceManager, getSharedPreferences, getShouldDisableView, getTitle, getTitleRes, getView, getWidgetLayoutResource, hasKey, isEnabled, isPersistent, isSelectable, notifyChanged, notifyDependencyChange, notifyHierarchyChanged, onAttachedToActivity, onAttachedToHierarchy, onBindView, onCreateView, onDependencyChanged, onParentChanged, onPrepareForRemoval, peekExtras, persistBoolean, persistFloat, persistInt, persistLong, persistString, restoreHierarchyState, saveHierarchyState, setDefaultValue, setDependency, setEnabled, setFragment, setIcon, setIcon, setIntent, setKey, setLayoutResource, setOnPreferenceChangeListener, setOnPreferenceClickListener, setOrder, setPersistent, setSelectable, setShouldDisableView, setSummary, setSummary, setTitle, setTitle, setWidgetLayoutResource, shouldCommit, shouldPersist, toStringpublic 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 defaultspublic final boolean isChecked()
public final void setChecked(boolean checked)
checked - True, if the preference should be 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 shouldDisableDependents()
shouldDisableDependents in class android.preference.Preferencepublic final java.lang.CharSequence getSummary()
getSummary in class android.preference.Preferenceprotected final java.lang.Object onGetDefaultValue(android.content.res.TypedArray typedArray,
int index)
onGetDefaultValue in class android.preference.Preferenceprotected final void onSetInitialValue(boolean restoreValue,
java.lang.Object defaultValue)
onSetInitialValue in class android.preference.Preferenceprotected final void onClick()
onClick in class android.preference.Preferenceprotected final android.os.Parcelable onSaveInstanceState()
onSaveInstanceState in class android.preference.Preferenceprotected final void onRestoreInstanceState(android.os.Parcelable state)
onRestoreInstanceState in class android.preference.Preference