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 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
ConstructorDescriptionListDialogPreference
(android.content.Context context, android.util.AttributeSet attrs) -
Method Summary
Modifier and TypeMethodDescriptionprotected int
getIndexForValue
(int value) protected CharSequence
getTitleAt
(int index) int
getValue()
protected int
getValueAt
(int index) protected abstract void
onBindListItem
(android.view.View view, int index) Populates a list item view with data for the specified index.protected Object
onGetDefaultValue
(android.content.res.TypedArray a, int index) protected void
onPrepareDialogBuilder
(android.app.AlertDialog.Builder builder) protected void
onRestoreInstanceState
(android.os.Parcelable state) protected android.os.Parcelable
protected void
onSetInitialValue
(boolean restoreValue, Object defaultValue) void
setListItemLayoutResource
(int layoutResId) Sets the layout to use for grid items.void
Sets a listened to invoke when the value of this preference changes.void
setTitles
(CharSequence[] titles) Sets the list of item titles.void
setValue
(int value) Sets the current value.void
setValues
(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, showDialog
Methods 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
-
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:
getSummary
in classandroid.preference.Preference
-
onPrepareDialogBuilder
protected void onPrepareDialogBuilder(android.app.AlertDialog.Builder builder) - Overrides:
onPrepareDialogBuilder
in 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_POSITION
if 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:
onGetDefaultValue
in classandroid.preference.Preference
-
onSetInitialValue
- Overrides:
onSetInitialValue
in classandroid.preference.Preference
-
onSaveInstanceState
protected android.os.Parcelable onSaveInstanceState()- Overrides:
onSaveInstanceState
in classandroid.preference.DialogPreference
-
onRestoreInstanceState
protected void onRestoreInstanceState(android.os.Parcelable state) - Overrides:
onRestoreInstanceState
in classandroid.preference.DialogPreference