public class

ColorPickerPreference

extends DialogPreference
implements ColorPickerInterfaces.Listeners.OnColorSelectedListener
java.lang.Object
   ↳ android.preference.Preference
     ↳ android.preference.DialogPreference
       ↳ com.droidux.pack.commons.widget.color.ColorPickerPreference

Class Overview

A Preference that allows user to select color.

It is a subclass of DialogPreference and shows the ColorPickerPanel in a dialog.

This preference will store a color integer into the SharedPreferences.

Summary

XML Attributes
Attribute Name Related Method Description
dux_showAlphaPanel Controls whether the alpha slider/panel should be shown/hidden. 
[Expand]
Inherited Constants
From class android.preference.Preference
Public Constructors
ColorPickerPreference(Context context)
ColorPickerPreference(Context context, AttributeSet attrs)
ColorPickerPreference(Context context, AttributeSet attrs, int defStyle)
Public Methods
int getColor()
Gets the currently persisted value or the default value if it's not persisted.
void onClick(DialogInterface dialog, int which)
This method will be invoked when a button in the dialog is clicked.
void onColorSelected(View view, int color)
Called when new color has been selected.
void setOnColorSelectedListener(ColorPickerInterfaces.Listeners.OnColorSelectedListener listener)
Registers a listener to be notified when a new color is selected.
void showAlphaPanel(boolean show)
Whether to show/hide the alpha slider/panel that is used to adjust the alpha value of the selected color.
[Expand]
Inherited Methods
From class android.preference.DialogPreference
From class android.preference.Preference
From class java.lang.Object
From interface android.content.DialogInterface.OnClickListener
From interface android.content.DialogInterface.OnDismissListener
From interface android.preference.PreferenceManager.OnActivityDestroyListener
From interface com.droidux.pack.commons.interfaces.ColorPickerInterfaces.Listeners.OnColorSelectedListener
From interface java.lang.Comparable

XML Attributes

dux_showAlphaPanel

Since: API Level

Controls whether the alpha slider/panel should be shown/hidden. Default is true.

Must be a boolean value, either "true" or "false".

This may also be a reference to a resource (in the form "@[package:]type:name") or theme attribute (in the form "?[package:][type:]name") containing a value of this type.

Related Methods

Public Constructors

public ColorPickerPreference (Context context)

Since: API Level 2.5

public ColorPickerPreference (Context context, AttributeSet attrs)

Since: API Level 2.5

public ColorPickerPreference (Context context, AttributeSet attrs, int defStyle)

Since: API Level 2.5

Public Methods

public int getColor ()

Since: API Level 2.5

Gets the currently persisted value or the default value if it's not persisted.

Returns
  • The currently persisted color.

public void onClick (DialogInterface dialog, int which)

Since: API Level

This method will be invoked when a button in the dialog is clicked.

Parameters
dialog The dialog that received the click.
which The button that was clicked (e.g. BUTTON1) or the position of the item clicked.

public void onColorSelected (View view, int color)

Since: API Level 2.5

Called when new color has been selected.

Parameters
view The ColorPickerPanel that shows the color selection.
color The selected color.

public void setOnColorSelectedListener (ColorPickerInterfaces.Listeners.OnColorSelectedListener listener)

Since: API Level 2.5

Registers a listener to be notified when a new color is selected.

Parameters
listener The listener to be notified.

public void showAlphaPanel (boolean show)

Since: API Level 2.5

Whether to show/hide the alpha slider/panel that is used to adjust the alpha value of the selected color.

Parameters
show If true, the alpha slider will be shown, otherwise it will be hidden.