Class ListDialogPreference
java.lang.Object
android.preference.Preference
android.preference.DialogPreference
com.brightcove.player.captioning.preferences.ListDialogPreference
- All Implemented Interfaces:
android.content.DialogInterface.OnClickListener,android.content.DialogInterface.OnDismissListener,android.preference.PreferenceManager.OnActivityDestroyListener,Comparable<android.preference.Preference>
- Direct Known Subclasses:
ColorPreference,EdgeTypePreference,PresetPreference
public abstract class ListDialogPreference
extends android.preference.DialogPreference
Abstract dialog preference that displays a set of values and optional titles.
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class android.preference.Preference
android.preference.Preference.BaseSavedState, android.preference.Preference.OnPreferenceChangeListener, android.preference.Preference.OnPreferenceClickListener -
Field Summary
Fields inherited from class android.preference.Preference
DEFAULT_ORDER -
Constructor Summary
ConstructorsConstructorDescriptionListDialogPreference(android.content.Context context, android.util.AttributeSet attrs) -
Method Summary
Modifier and TypeMethodDescriptionprotected intgetIndexForValue(int value) protected CharSequencegetTitleAt(int index) intgetValue()protected intgetValueAt(int index) protected abstract voidonBindListItem(android.view.View view, int index) Populates a list item view with data for the specified index.protected ObjectonGetDefaultValue(android.content.res.TypedArray a, int index) protected voidonPrepareDialogBuilder(android.app.AlertDialog.Builder builder) protected voidonRestoreInstanceState(android.os.Parcelable state) protected android.os.Parcelableprotected voidonSetInitialValue(boolean restoreValue, Object defaultValue) voidsetListItemLayoutResource(int layoutResId) Sets the layout to use for grid items.voidSets a listened to invoke when the value of this preference changes.voidsetTitles(CharSequence[] titles) Sets the list of item titles.voidsetValue(int value) Sets the current value.voidsetValues(int[] values) Sets the list of item values.Methods inherited from class android.preference.DialogPreference
getDialog, getDialogIcon, getDialogLayoutResource, getDialogMessage, getDialogTitle, getNegativeButtonText, getPositiveButtonText, onActivityDestroy, onBindDialogView, onClick, onClick, onCreateDialogView, onDialogClosed, onDismiss, setDialogIcon, setDialogIcon, setDialogLayoutResource, setDialogMessage, setDialogMessage, setDialogTitle, setDialogTitle, setNegativeButtonText, setNegativeButtonText, setPositiveButtonText, setPositiveButtonText, showDialogMethods inherited from class android.preference.Preference
callChangeListener, compareTo, findPreferenceInHierarchy, getContext, getDependency, getEditor, getExtras, getFragment, getIcon, getIntent, getKey, getLayoutResource, getOnPreferenceChangeListener, getOnPreferenceClickListener, getOrder, getParent, getPersistedBoolean, getPersistedFloat, getPersistedInt, getPersistedLong, getPersistedString, getPersistedStringSet, getPreferenceDataStore, getPreferenceManager, getSharedPreferences, getShouldDisableView, getTitle, getTitleRes, getView, getWidgetLayoutResource, hasKey, isEnabled, isIconSpaceReserved, isPersistent, isRecycleEnabled, isSelectable, isSingleLineTitle, notifyChanged, notifyDependencyChange, notifyHierarchyChanged, onAttachedToActivity, onAttachedToHierarchy, onBindView, onCreateView, onDependencyChanged, onParentChanged, onPrepareForRemoval, peekExtras, persistBoolean, persistFloat, persistInt, persistLong, persistString, persistStringSet, restoreHierarchyState, saveHierarchyState, setDefaultValue, setDependency, setEnabled, setFragment, setIcon, setIcon, setIconSpaceReserved, setIntent, setKey, setLayoutResource, setOnPreferenceChangeListener, setOnPreferenceClickListener, setOrder, setPersistent, setPreferenceDataStore, setRecycleEnabled, setSelectable, setShouldDisableView, setSingleLineTitle, setSummary, setSummary, setTitle, setTitle, setWidgetLayoutResource, shouldCommit, shouldDisableDependents, shouldPersist, toString
-
Constructor Details
-
ListDialogPreference
public ListDialogPreference(android.content.Context context, android.util.AttributeSet attrs)
-
-
Method Details
-
setOnValueChangedListener
Sets a listened to invoke when the value of this preference changes.- Parameters:
listener- the listener to invoke
-
setListItemLayoutResource
public void setListItemLayoutResource(int layoutResId) Sets the layout to use for grid items.- Parameters:
layoutResId- the layout to use for displaying grid items
-
setValues
public void setValues(int[] values) Sets the list of item values. Values must be distinct.- Parameters:
values- the list of item values
-
setTitles
Sets the list of item titles. May be null if no titles are specified, or may be shorter than the list of values to leave some titles unspecified.- Parameters:
titles- the list of item titles
-
onBindListItem
protected abstract void onBindListItem(android.view.View view, int index) Populates a list item view with data for the specified index.- Parameters:
view- the view to populateindex- the index for which to populate the view- See Also:
-
getTitleAt
- Returns:
- the title at the specified index, or null if none specified
-
getValueAt
protected int getValueAt(int index) - Returns:
- the value at the specified index
-
getSummary
- Overrides:
getSummaryin classandroid.preference.Preference
-
onPrepareDialogBuilder
protected void onPrepareDialogBuilder(android.app.AlertDialog.Builder builder) - Overrides:
onPrepareDialogBuilderin classandroid.preference.DialogPreference
-
getIndexForValue
protected int getIndexForValue(int value) - Returns:
- the index of the specified value within the list of entry values,
or
AdapterView.INVALID_POSITIONif not found
-
setValue
public void setValue(int value) Sets the current value. If the value exists within the set of entry values, updates the selection index.- Parameters:
value- the value to set
-
getValue
public int getValue()- Returns:
- the current value
-
onGetDefaultValue
- Overrides:
onGetDefaultValuein classandroid.preference.Preference
-
onSetInitialValue
- Overrides:
onSetInitialValuein classandroid.preference.Preference
-
onSaveInstanceState
protected android.os.Parcelable onSaveInstanceState()- Overrides:
onSaveInstanceStatein classandroid.preference.DialogPreference
-
onRestoreInstanceState
protected void onRestoreInstanceState(android.os.Parcelable state) - Overrides:
onRestoreInstanceStatein classandroid.preference.DialogPreference
-