public class ColorPreference extends android.preference.Preference implements ColorPickerDialogListener
| Modifier and Type | Class and Description |
|---|---|
static interface |
ColorPreference.OnShowDialogListener |
| Constructor and Description |
|---|
ColorPreference(android.content.Context context,
android.util.AttributeSet attrs) |
ColorPreference(android.content.Context context,
android.util.AttributeSet attrs,
int defStyle) |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getFragmentTag()
The tag used for the
ColorPickerDialog. |
int[] |
getPresets()
Get the colors that will be shown in the
ColorPickerDialog. |
protected void |
onAttachedToActivity() |
protected void |
onBindView(android.view.View view) |
protected void |
onClick() |
void |
onColorSelected(int dialogId,
int color)
Callback that is invoked when a color is selected from the color picker dialog.
|
void |
onDialogDismissed(int dialogId)
Callback that is invoked when the color picker dialog was dismissed.
|
protected java.lang.Object |
onGetDefaultValue(android.content.res.TypedArray a,
int index) |
protected void |
onSetInitialValue(boolean restorePersistedValue,
java.lang.Object defaultValue) |
void |
saveValue(int color)
Set the new color
|
void |
setOnShowDialogListener(ColorPreference.OnShowDialogListener listener)
The listener used for showing the
ColorPickerDialog. |
void |
setPresets(int[] presets)
Set the colors shown in the
ColorPickerDialog. |
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, getSummary, getTitle, getTitleRes, getView, getWidgetLayoutResource, hasKey, isEnabled, isIconSpaceReserved, isPersistent, isRecycleEnabled, isSelectable, isSingleLineTitle, notifyChanged, notifyDependencyChange, notifyHierarchyChanged, onAttachedToHierarchy, onCreateView, onDependencyChanged, onParentChanged, onPrepareForRemoval, onRestoreInstanceState, onSaveInstanceState, 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, toStringpublic ColorPreference(android.content.Context context,
android.util.AttributeSet attrs)
public ColorPreference(android.content.Context context,
android.util.AttributeSet attrs,
int defStyle)
protected void onClick()
onClick in class android.preference.Preferenceprotected void onAttachedToActivity()
onAttachedToActivity in class android.preference.Preferenceprotected void onBindView(android.view.View view)
onBindView in class android.preference.Preferenceprotected void onSetInitialValue(boolean restorePersistedValue,
java.lang.Object defaultValue)
onSetInitialValue in class android.preference.Preferenceprotected java.lang.Object onGetDefaultValue(android.content.res.TypedArray a,
int index)
onGetDefaultValue in class android.preference.Preferencepublic void onColorSelected(int dialogId,
int color)
ColorPickerDialogListeneronColorSelected in interface ColorPickerDialogListenerdialogId - The dialog id used to create the dialog instance.color - The selected colorpublic void onDialogDismissed(int dialogId)
ColorPickerDialogListeneronDialogDismissed in interface ColorPickerDialogListenerdialogId - The dialog id used to create the dialog instance.public void saveValue(int color)
color - The newly selected colorpublic int[] getPresets()
ColorPickerDialog.public void setPresets(int[] presets)
ColorPickerDialog.presets - An array of color intspublic void setOnShowDialogListener(ColorPreference.OnShowDialogListener listener)
ColorPickerDialog.
Call saveValue(int) after the user chooses a color.
If this is set then it is up to you to show the dialog.listener - The listener to show the dialogpublic java.lang.String getFragmentTag()
ColorPickerDialog.