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
,java.lang.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 Modifier and Type Class Description static interface
ListDialogPreference.OnValueChangedListener
-
Constructor Summary
Constructors Constructor Description ListDialogPreference(android.content.Context context, android.util.AttributeSet attrs)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected int
getIndexForValue(int value)
java.lang.CharSequence
getSummary()
protected java.lang.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 java.lang.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
onSaveInstanceState()
protected void
onSetInitialValue(boolean restoreValue, java.lang.Object defaultValue)
void
setListItemLayoutResource(int layoutResId)
Sets the layout to use for grid items.void
setOnValueChangedListener(ListDialogPreference.OnValueChangedListener listener)
Sets a listened to invoke when the value of this preference changes.void
setTitles(java.lang.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
-
-
-
-
Method Detail
-
setOnValueChangedListener
public void setOnValueChangedListener(ListDialogPreference.OnValueChangedListener listener)
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
public void setTitles(java.lang.CharSequence[] titles)
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:
setListItemLayoutResource(int)
,getValueAt(int)
,getTitleAt(int)
-
getTitleAt
protected java.lang.CharSequence getTitleAt(int index)
- 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
public java.lang.CharSequence 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
protected java.lang.Object onGetDefaultValue(android.content.res.TypedArray a, int index)
- Overrides:
onGetDefaultValue
in classandroid.preference.Preference
-
onSetInitialValue
protected void onSetInitialValue(boolean restoreValue, java.lang.Object defaultValue)
- 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
-
-