public class MultiChoiceListPreference extends AbstractListPreference
Set in the shared preferences. They will only be persisted, if confirmed
by the user.| Modifier and Type | Class and Description |
|---|---|
static class |
MultiChoiceListPreference.SavedState
A data structure, which allows to save the internal state of a
MultiChoiceListPreference. |
| Constructor and Description |
|---|
MultiChoiceListPreference(android.content.Context context)
Creates a new preference, which allows to select multiple values from a list.
|
MultiChoiceListPreference(android.content.Context context,
android.util.AttributeSet attributeSet)
Creates a new preference, which allows to select multiple values from a list.
|
MultiChoiceListPreference(android.content.Context context,
android.util.AttributeSet attributeSet,
int defaultStyle)
Creates a new preference, which allows to select multiple values from a list.
|
MultiChoiceListPreference(android.content.Context context,
android.util.AttributeSet attributeSet,
int defaultStyle,
int defaultStyleResource)
Creates a new preference, which allows to select multiple values from a list.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addAllValues(java.util.Collection<java.lang.String> values)
Adds all values, which are contained by a specific collection, to the preference.
|
void |
addValue(java.lang.String value)
Adds a new value to the preference.
|
java.lang.CharSequence[] |
getSelectedEntries()
Returns the entries, the currently persisted values of the preference belong to.
|
java.lang.CharSequence |
getSummary() |
java.util.Set<java.lang.String> |
getValues()
Returns the currently persisted values of the preference.
|
protected void |
onDialogClosed(boolean positiveResult)
The method, which is invoked on subclasses when the preference's dialog has been closed.
|
protected java.lang.Object |
onGetDefaultValue(android.content.res.TypedArray typedArray,
int index) |
protected void |
onPrepareDialog(MaterialDialog.Builder dialogBuilder)
The method, which is invoked on subclasses when the preference's dialog is about to be
created.
|
protected void |
onRestoreInstanceState(android.os.Parcelable state) |
protected android.os.Parcelable |
onSaveInstanceState() |
protected void |
onSetInitialValue(boolean restoreValue,
java.lang.Object defaultValue) |
void |
removeAllValues(java.util.Collection<java.lang.String> values)
Removes all values, which are contained by a specific collection, from the preference.
|
void |
removeValue(java.lang.String value)
Removes a specific value from the preference.
|
void |
setValues(java.util.Set<java.lang.String> values)
Sets the current values of the preference.
|
getDialogItemColor, getEntries, getEntryValues, indexOf, needInputMethod, setDialogItemColor, setEntries, setEntries, setEntryValues, setEntryValuesgetDialog, getDialogBackground, getDialogButtonBarDividerColor, getDialogButtonTextColor, getDialogContentDividerColor, getDialogHeaderBackground, getDialogHeaderIcon, getDialogIcon, getDialogMessage, getDialogMessageColor, getDialogTitle, getDialogTitleColor, getNegativeButtonText, getPositiveButtonText, isDialogButtonBarDividerShown, isDialogContentDividerShown, isDialogHeaderShown, isDialogShown, isValueShownAsSummary, onClick, onClick, onDismiss, setDialogBackground, setDialogBackground, setDialogBackgroundColor, setDialogButtonBarDividerColor, setDialogButtonTextColor, setDialogContentDividerColor, setDialogHeaderBackground, setDialogHeaderBackground, setDialogHeaderBackgroundColor, setDialogHeaderIcon, setDialogHeaderIcon, setDialogIcon, setDialogIcon, setDialogMessage, setDialogMessage, setDialogMessageColor, setDialogTitle, setDialogTitle, setDialogTitleColor, setNegativeButtonText, setNegativeButtonText, setPositiveButtonText, setPositiveButtonText, showDialogButtonBarDivider, showDialogContentDivider, showDialogHeader, showValueAsSummarycallChangeListener, 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, shouldDisableDependents, shouldPersist, toStringpublic MultiChoiceListPreference(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 MultiChoiceListPreference(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 MultiChoiceListPreference(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 MultiChoiceListPreference(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 java.util.Set<java.lang.String> getValues()
Setpublic final void setValues(java.util.Set<java.lang.String> values)
values - A set, which contains the values, which should be set, as an instance of the type
Setpublic final void addValue(java.lang.String value)
value - The value, which should be added, as a String. The value may not be nullpublic final void removeValue(java.lang.String value)
value - The value, which should be removed, as a String. The value may not be nullpublic final void addAllValues(java.util.Collection<java.lang.String> values)
values - A collection, which contains the values, which should be added, as an instance of the
type Collection or an empty collection, if no values should be addedpublic final void removeAllValues(java.util.Collection<java.lang.String> values)
values - A collection, which contains the values, which should be removed, as an instance of
the type Collection or an empty collection, if no values should be removedpublic final java.lang.CharSequence[] getSelectedEntries()
CharSequencepublic 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 onPrepareDialog(MaterialDialog.Builder dialogBuilder)
AbstractDialogPreferenceonPrepareDialog in class AbstractDialogPreferencedialogBuilder - The builder, which is used to create the preference's dialog, as an instance of the
class MaterialDialog.Builderprotected final void onDialogClosed(boolean positiveResult)
AbstractDialogPreferenceonDialogClosed in class AbstractDialogPreferencepositiveResult - True, if the dialog has been close affirmatively, false otherwiseprotected final android.os.Parcelable onSaveInstanceState()
onSaveInstanceState in class AbstractDialogPreferenceprotected final void onRestoreInstanceState(android.os.Parcelable state)
onRestoreInstanceState in class AbstractDialogPreference