public class ColorPalettePreference extends AbstractColorPickerPreference
AbstractColorPickerPreference.ColorFormat, AbstractColorPickerPreference.PreviewShape, AbstractColorPickerPreference.SavedState| Constructor and Description |
|---|
ColorPalettePreference(android.content.Context context)
Creates a new preference, which allows to choose a color from a pre-defined color palette.
|
ColorPalettePreference(android.content.Context context,
android.util.AttributeSet attributeSet)
Creates a new preference, which allows to choose a color from a pre-defined color palette.
|
ColorPalettePreference(android.content.Context context,
android.util.AttributeSet attributeSet,
int defaultStyle)
Creates a new preference, which allows to choose a color from a pre-defined color palette.
|
ColorPalettePreference(android.content.Context context,
android.util.AttributeSet attributeSet,
int defaultStyle,
int defaultStyleResource)
Creates a new preference, which allows to choose a color from a pre-defined color palette.
|
| Modifier and Type | Method and Description |
|---|---|
int[] |
getColorPalette()
Returns the colors, the preference allows to choose.
|
android.graphics.drawable.Drawable |
getDialogPreviewBackground()
Returns the background, which is used to preview colors in the preference's dialog.
|
int |
getDialogPreviewBorderColor()
Returns the border color, which is used to preview colors in the preference's dialog.
|
int |
getDialogPreviewBorderWidth()
Returns the border width, which is used to preview colors in the preference's dialog.
|
AbstractColorPickerPreference.PreviewShape |
getDialogPreviewShape()
Returns the shape, which is used to preview colors in the preference's dialog.
|
int |
getDialogPreviewSize()
Returns the size, which is used to preview colors in the preference's dialog.
|
int |
getNumberOfColumns()
Returns the number of columns, which are used to preview colors in the preference's dialog.
|
protected boolean |
needInputMethod()
The method, which is invoked on subclasses to determine, whether the soft input mode should
be requested when the preference's dialog becomes shown, or not.
|
protected void |
onDialogClosed(boolean positiveResult)
The method, which is invoked on subclasses when the preference's dialog has been closed.
|
protected void |
onPrepareDialog(MaterialDialog.Builder dialogBuilder)
The method, which is invoked on subclasses when the preference's dialog is about to be
created.
|
void |
setColorPalette(int resourceId)
Sets the colors, the preference should allow to choose.
|
void |
setColorPalette(int[] colorPalette)
Sets the colors, the preference should allow to choose.
|
void |
setDialogPreviewBackground(android.graphics.drawable.Drawable background)
Sets the background, which should be used to preview colors in the preference's dialog.
|
void |
setDialogPreviewBackground(int resourceId)
Sets the background, which should be used to preview colors in the preference's dialog.
|
void |
setDialogPreviewBackgroundColor(int color)
Sets the background color, which should be used to preview colors in the preference's
dialog.
|
void |
setDialogPreviewBorderColor(int borderColor)
Sets the border color, which should be used to preview colors in the preference's dialog.
|
void |
setDialogPreviewBorderWidth(int borderWidth)
Sets the border width, which should be used to preview colors in the preference's dialog.
|
void |
setDialogPreviewShape(AbstractColorPickerPreference.PreviewShape previewShape)
Sets the shape, which should be used to preview colors in the preference's dialog.
|
void |
setDialogPreviewSize(int previewSize)
Sets the size, which should be used to preview colors in the preference's dialog.
|
void |
setNumberOfColumns(int numberOfColumns)
Sets the number of columns, which should be used to preview colors in the preference's
dialog.
|
getColor, getColorFormat, getPreviewBackground, getPreviewBorderColor, getPreviewBorderWidth, getPreviewShape, getPreviewSize, getSummary, isPreviewShown, onCreateView, onGetDefaultValue, onRestoreInstanceState, onSaveInstanceState, onSetInitialValue, setColor, setColorFormat, setPreviewBackground, setPreviewBackground, setPreviewBackgroundColor, setPreviewBorderColor, setPreviewBorderWidth, setPreviewShape, setPreviewSize, showPreviewgetDialog, getDialogBackground, getDialogButtonBarDividerColor, getDialogButtonTextColor, getDialogContentDividerColor, getDialogHeaderBackground, getDialogHeaderIcon, getDialogIcon, getDialogMessage, getDialogMessageColor, getDialogTitle, getDialogTitleColor, getNegativeButtonText, getPositiveButtonText, isDialogButtonBarDividerShown, isDialogContentDividerShown, isDialogHeaderShown, isDialogShown, isValueShownAsSummary, onClick, onClick, onDismiss, setDialogBackground, setDialogBackground, setDialogBackgroundColor, setDialogButtonBarDividerColor, setDialogButtonTextColor, setDialogContentDividerColor, setDialogHeaderBackground, setDialogHeaderBackground, setDialogHeaderBackgroundColor, setDialogHeaderIcon, setDialogHeaderIcon, setDialogIcon, setDialogIcon, setDialogMessage, setDialogMessage, setDialogMessageColor, setDialogTitle, setDialogTitle, setDialogTitleColor, setNegativeButtonText, setNegativeButtonText, setPositiveButtonText, setPositiveButtonText, showDialogButtonBarDivider, showDialogContentDivider, showDialogHeader, showValueAsSummarycallChangeListener, compareTo, findPreferenceInHierarchy, getContext, getDependency, getEditor, getExtras, getFragment, getIcon, getIntent, getKey, getLayoutResource, getOnPreferenceChangeListener, getOnPreferenceClickListener, getOrder, getPersistedBoolean, getPersistedFloat, getPersistedInt, getPersistedLong, getPersistedString, getPreferenceManager, getSharedPreferences, getShouldDisableView, getTitle, getTitleRes, getView, getWidgetLayoutResource, hasKey, isEnabled, isPersistent, isSelectable, notifyChanged, notifyDependencyChange, notifyHierarchyChanged, onAttachedToActivity, onAttachedToHierarchy, onBindView, onDependencyChanged, onParentChanged, onPrepareForRemoval, peekExtras, persistBoolean, persistFloat, persistInt, persistLong, persistString, restoreHierarchyState, saveHierarchyState, setDefaultValue, setDependency, setEnabled, setFragment, setIcon, setIcon, setIntent, setKey, setLayoutResource, setOnPreferenceChangeListener, setOnPreferenceClickListener, setOrder, setPersistent, setSelectable, setShouldDisableView, setSummary, setSummary, setTitle, setTitle, setWidgetLayoutResource, shouldCommit, shouldDisableDependents, shouldPersist, toStringpublic ColorPalettePreference(android.content.Context context)
context - The context, which should be used by the preference, as an instance of the class
Context. The context may not be nullpublic ColorPalettePreference(android.content.Context context,
android.util.AttributeSet attributeSet)
context - The context, which should be used by the preference, as an instance of the class
Context. The context may not be nullattributeSet - The attributes of the XML tag that is inflating the preference, as an instance of the
type AttributeSet or null, if no attributes are availablepublic ColorPalettePreference(android.content.Context context,
android.util.AttributeSet attributeSet,
int defaultStyle)
context - The context, which should be used by the preference, as an instance of the class
Context. The context may not be nullattributeSet - The attributes of the XML tag that is inflating the preference, as an instance of the
type AttributeSet or null, if no attributes are availabledefaultStyle - The default style to apply to this preference. If 0, no style will be applied (beyond
what is included in the theme). This may either be an attribute resource, whose value
will be retrieved from the current theme, or an explicit style resourcepublic ColorPalettePreference(android.content.Context context,
android.util.AttributeSet attributeSet,
int defaultStyle,
int defaultStyleResource)
context - The context, which should be used by the preference, as an instance of the class
Context. The context may not be nullattributeSet - The attributes of the XML tag that is inflating the preference, as an instance of the
type AttributeSet or null, if no attributes are availabledefaultStyle - The default style to apply to this preference. If 0, no style will be applied (beyond
what is included in the theme). This may either be an attribute resource, whose value
will be retrieved from the current theme, or an explicit style resourcedefaultStyleResource - A resource identifier of a style resource that supplies default values for the
preference, used only if the default style is 0 or can not be found in the theme. Can
be 0 to not look for defaultspublic final int[] getColorPalette()
Integer arraypublic final void setColorPalette(int[] colorPalette)
colorPalette - The colors, which should be set, as an Integer arraypublic final void setColorPalette(int resourceId)
resourceId - The resource id of the color palette, which should be set, as an Integer
value. The resource id must correspond to a valid integer array resourcepublic final int getDialogPreviewSize()
Integer value in pixelspublic final void setDialogPreviewSize(int previewSize)
previewSize - The size, which should be set, as an Integer value in pixels. The size must
be at least 1public final AbstractColorPickerPreference.PreviewShape getDialogPreviewShape()
PreviewShape. The shape may either be CIRCLE or
SQUAREpublic final void setDialogPreviewShape(AbstractColorPickerPreference.PreviewShape previewShape)
previewShape - The shape, which should be set, as a value of the enum PreviewShape. The
shape may not be nullpublic final int getDialogPreviewBorderWidth()
Integer value in pixelspublic final void setDialogPreviewBorderWidth(int borderWidth)
borderWidth - The border width, which should be set, as an Integer value in pixels. The
border width must be at least 0public final int getDialogPreviewBorderColor()
Integer valuepublic final void setDialogPreviewBorderColor(int borderColor)
borderColor - The border color, which should be set, as an Integer valuepublic final android.graphics.drawable.Drawable getDialogPreviewBackground()
Drawablepublic final void setDialogPreviewBackground(android.graphics.drawable.Drawable background)
background - The background, which should be set, as an instance of the class Drawable or
null, if no background should be shownpublic final void setDialogPreviewBackground(int resourceId)
resourceId - The resource id of the background, which should be set, as an Integer value.
The resource id must correspond to a valid drawable resourcepublic final void setDialogPreviewBackgroundColor(int color)
color - The background color, which should be set, as an Integer valuepublic final int getNumberOfColumns()
Integer valuepublic final void setNumberOfColumns(int numberOfColumns)
numberOfColumns - The number of columns, which should be set, as an Integer value. The number
of columns must be at least 1protected final boolean needInputMethod()
AbstractDialogPreferenceneedInputMethod in class AbstractDialogPreferenceprotected final void onPrepareDialog(MaterialDialog.Builder dialogBuilder)
AbstractDialogPreferenceonPrepareDialog in class AbstractDialogPreferencedialogBuilder - The builder, which is used to create the preference's dialog, as an instance of the
class MaterialDialog.Builderprotected final void onDialogClosed(boolean positiveResult)
AbstractDialogPreferenceonDialogClosed in class AbstractDialogPreferencepositiveResult - True, if the dialog has been close affirmatively, false otherwise