public class ColorPreferenceCompat extends Preference implements ColorPickerDialogListener
| Modifier and Type | Class and Description |
|---|---|
static interface |
ColorPreferenceCompat.OnShowDialogListener |
| Constructor and Description |
|---|
ColorPreferenceCompat(android.content.Context context,
android.util.AttributeSet attrs) |
ColorPreferenceCompat(android.content.Context context,
android.util.AttributeSet attrs,
int defStyle) |
| Modifier and Type | Method and Description |
|---|---|
FragmentActivity |
getActivity() |
java.lang.String |
getFragmentTag()
The tag used for the
ColorPickerDialog. |
int[] |
getPresets()
Get the colors that will be shown in the
ColorPickerDialog. |
void |
onAttached() |
void |
onBindViewHolder(PreferenceViewHolder holder) |
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(java.lang.Object defaultValue) |
void |
saveValue(int color)
Set the new color
|
void |
setOnShowDialogListener(ColorPreferenceCompat.OnShowDialogListener listener)
The listener used for showing the
ColorPickerDialog. |
void |
setPresets(int[] presets)
Set the colors shown in the
ColorPickerDialog. |
public ColorPreferenceCompat(android.content.Context context,
android.util.AttributeSet attrs)
public ColorPreferenceCompat(android.content.Context context,
android.util.AttributeSet attrs,
int defStyle)
protected void onClick()
public FragmentActivity getActivity()
public void onAttached()
public void onBindViewHolder(PreferenceViewHolder holder)
protected void onSetInitialValue(java.lang.Object defaultValue)
protected java.lang.Object onGetDefaultValue(android.content.res.TypedArray a,
int index)
public 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(ColorPreferenceCompat.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.