public abstract class AbstractDialogPreference
extends android.preference.Preference
implements android.content.DialogInterface.OnClickListener, android.content.DialogInterface.OnDismissListener
| Modifier and Type | Class and Description |
|---|---|
static class |
AbstractDialogPreference.SavedState
A data structure, which allows to save the internal state of an
AbstractDialogPreference. |
| Constructor and Description |
|---|
AbstractDialogPreference(android.content.Context context)
Creates a new preference, which will show a dialog when clicked by the user.
|
AbstractDialogPreference(android.content.Context context,
android.util.AttributeSet attributeSet)
Creates a new preference, which will show a dialog when clicked by the user.
|
AbstractDialogPreference(android.content.Context context,
android.util.AttributeSet attributeSet,
int defaultStyle)
Creates a new preference, which will show a dialog when clicked by the user.
|
AbstractDialogPreference(android.content.Context context,
android.util.AttributeSet attributeSet,
int defaultStyle,
int defaultStyleResource)
Creates a new preference, which will show a dialog when clicked by the user.
|
| Modifier and Type | Method and Description |
|---|---|
android.app.Dialog |
getDialog()
Returns the dialog, which is shown by the preference.
|
android.graphics.drawable.Drawable |
getDialogBackground()
Returns the background of the preference's dialog.
|
int |
getDialogButtonBarDividerColor()
Returns the color of the divider, which is located above the buttons of the preference's
dialog.
|
int |
getDialogButtonTextColor()
Returns the color of the button text of the preference's dialog.
|
int |
getDialogContentDividerColor()
Returns the color of the divider, which is located above the custom view of the preference's
dialog.
|
android.graphics.drawable.Drawable |
getDialogHeaderBackground()
Returns the background of the header of the preference's dialog.
|
android.graphics.drawable.Drawable |
getDialogHeaderIcon()
Returns the icon of the header of the preference's dialog.
|
android.graphics.drawable.Drawable |
getDialogIcon()
Returns the icon of the preference's dialog.
|
java.lang.CharSequence |
getDialogMessage()
Returns the message of the preference's dialog.
|
int |
getDialogMessageColor()
Returns the color of the message of the preference's dialog.
|
java.lang.CharSequence |
getDialogTitle()
Returns the title of the preference's dialog.
|
int |
getDialogTitleColor()
Returns the color of the title of the preference's dialog.
|
java.lang.CharSequence |
getNegativeButtonText()
Returns the text of the negative button of the preference's dialog.
|
java.lang.CharSequence |
getPositiveButtonText()
Returns the text of the positive button of the preference's dialog.
|
boolean |
isDialogButtonBarDividerShown()
Returns, whether the divider, which is located above the buttons of the preference's dialog,
is shown, or not.
|
boolean |
isDialogContentDividerShown()
Returns, whether the divider, which is located above the custom view of the preference's
dialog, is shown, or not.
|
boolean |
isDialogHeaderShown()
Returns, whether the header of the preference's dialog is shown, or not.
|
boolean |
isDialogShown()
Returns, whether the preference's dialog is currently shown, or not.
|
boolean |
isValueShownAsSummary()
Returns, whether the currently persisted value is shown instead of the summary, or not.
|
protected abstract 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 |
onClick() |
void |
onClick(android.content.DialogInterface dialog,
int which) |
protected abstract void |
onDialogClosed(boolean positiveResult)
The method, which is invoked on subclasses when the preference's dialog has been closed.
|
void |
onDismiss(android.content.DialogInterface dialog) |
protected abstract void |
onPrepareDialog(MaterialDialog.Builder dialogBuilder)
The method, which is invoked on subclasses when the preference's dialog is about to be
created.
|
protected void |
onRestoreInstanceState(android.os.Parcelable state) |
protected android.os.Parcelable |
onSaveInstanceState() |
void |
setDialogBackground(android.graphics.drawable.Drawable background)
Sets the background of the preference's dialog.
|
void |
setDialogBackground(int resourceId)
Sets the background of the preference's dialog.
|
void |
setDialogBackgroundColor(int color)
Sets the background color of the preference's dialog.
|
void |
setDialogButtonBarDividerColor(int color)
Sets the color of the divider, which is located above the buttons of the preference's
dialog.
|
void |
setDialogButtonTextColor(int color)
Sets the color of the button text of the preference's dialog.
|
void |
setDialogContentDividerColor(int color)
Sets the color of the divider, which is located above the custom view of the preference's
dialog.
|
void |
setDialogHeaderBackground(android.graphics.drawable.Drawable background)
Sets the background of the header of the preference's dialog.
|
void |
setDialogHeaderBackground(int resourceId)
Sets the background of the header of the preference's dialog.
|
void |
setDialogHeaderBackgroundColor(int color)
Sets the background color of the header of the preference's dialog.
|
void |
setDialogHeaderIcon(android.graphics.drawable.Drawable icon)
Sets the icon of the header of the preference's dialog.
|
void |
setDialogHeaderIcon(int resourceId)
Sets the icon of the header of the preference's dialog.
|
void |
setDialogIcon(android.graphics.drawable.Drawable dialogIcon)
Sets the icon of the preference's dialog.
|
void |
setDialogIcon(int resourceId)
Sets the icon of the preference's dialog.
|
void |
setDialogMessage(java.lang.CharSequence dialogMessage)
Sets the message of the preference's dialog.
|
void |
setDialogMessage(int resourceId)
Sets the message of the preference's dialog.
|
void |
setDialogMessageColor(int color)
Sets the color of the message of the preference's dialog.
|
void |
setDialogTitle(java.lang.CharSequence dialogTitle)
Sets the title of the preference's dialog.
|
void |
setDialogTitle(int resourceId)
Sets the title of the preference's dialog.
|
void |
setDialogTitleColor(int color)
Sets the color of the title of the preference's dialog.
|
void |
setNegativeButtonText(java.lang.CharSequence negativeButtonText)
Sets the text of the negative button of the preference's dialog.
|
void |
setNegativeButtonText(int resourceId)
Sets the text of the negative button of the preference's dialog.
|
void |
setPositiveButtonText(java.lang.CharSequence positiveButtonText)
Sets the text of the positive button of the preference's dialog.
|
void |
setPositiveButtonText(int resourceId)
Sets the text of the positive button of the preference's dialog.
|
void |
showDialogButtonBarDivider(boolean show)
Sets, whether the divider, which is located above the buttons of the preference's dialog,
should be shown, or not.
|
void |
showDialogContentDivider(boolean show)
Sets, whether the divider, which is located above the custom view of the preference's dialog,
should be shown, or not.
|
void |
showDialogHeader(boolean show)
Sets, whether the header of the preference's dialog should be shown, or not.
|
void |
showValueAsSummary(boolean showValueAsSummary)
Sets, whether the currently persisted value should be shown instead of the summary, or not.
|
callChangeListener, compareTo, findPreferenceInHierarchy, getContext, getDependency, getEditor, getExtras, getFragment, getIcon, getIntent, getKey, getLayoutResource, getOnPreferenceChangeListener, getOnPreferenceClickListener, getOrder, getPersistedBoolean, getPersistedFloat, getPersistedInt, getPersistedLong, getPersistedString, getPreferenceManager, getSharedPreferences, getShouldDisableView, getSummary, getTitle, getTitleRes, getView, getWidgetLayoutResource, hasKey, isEnabled, isPersistent, isSelectable, notifyChanged, notifyDependencyChange, notifyHierarchyChanged, onAttachedToActivity, onAttachedToHierarchy, onBindView, onCreateView, onDependencyChanged, onGetDefaultValue, onParentChanged, onPrepareForRemoval, onSetInitialValue, 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 AbstractDialogPreference(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 AbstractDialogPreference(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 AbstractDialogPreference(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 AbstractDialogPreference(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 defaultsprotected abstract boolean needInputMethod()
protected abstract void onPrepareDialog(MaterialDialog.Builder dialogBuilder)
dialogBuilder - The builder, which is used to create the preference's dialog, as an instance of the
class MaterialDialog.Builderprotected abstract void onDialogClosed(boolean positiveResult)
positiveResult - True, if the dialog has been close affirmatively, false otherwisepublic final android.app.Dialog getDialog()
Dialog or null, if the dialog is currently not shownpublic final boolean isDialogShown()
public final java.lang.CharSequence getDialogTitle()
CharSequence
or null, if the preference's title is used insteadpublic final void setDialogTitle(java.lang.CharSequence dialogTitle)
dialogTitle - The title, which should be set, as an instance of the class CharSequence or
null, if the preference's title should be used insteadpublic final void setDialogTitle(int resourceId)
resourceId - The resource id of the title, which should be set, as an Integer value. The
resource id must correspond to a valid string resourcepublic final java.lang.CharSequence getDialogMessage()
CharSequence or null, if no message is shown in the dialogpublic final void setDialogMessage(java.lang.CharSequence dialogMessage)
dialogMessage - The message, which should be set, as an instance of the class CharSequence or
null, if no message should be shown in the dialogpublic final void setDialogMessage(int resourceId)
resourceId - The resource id of the message, which should be set, as an Integer value. The
resource id must correspond to a valid string resourcepublic final android.graphics.drawable.Drawable getDialogIcon()
Drawable or
null, if no icon is shown in the dialogpublic final void setDialogIcon(android.graphics.drawable.Drawable dialogIcon)
dialogIcon - The dialog, which should be set, as an instance of the class Drawable or
null, if no icon should be shown in the dialogpublic final void setDialogIcon(int resourceId)
resourceId - The resource id of the icon, which should be set, as an Integer value. The
resource id must correspond to a valid drawable resourcepublic final java.lang.CharSequence getPositiveButtonText()
CharSequence or
null, if no positive button is shown in the dialogpublic final void setPositiveButtonText(java.lang.CharSequence positiveButtonText)
positiveButtonText - The text, which should be set, as an instance of the class CharSequence or
null, if no positive button should be shown in the dialogpublic final void setPositiveButtonText(int resourceId)
resourceId - The resource id of the text, which should be set, as an Integer value. The
resource id must correspond to a valid string resourcepublic final java.lang.CharSequence getNegativeButtonText()
CharSequence or
null, if no negative button is shown in the dialogpublic final void setNegativeButtonText(java.lang.CharSequence negativeButtonText)
negativeButtonText - The text, which should be set, as an instance of the class CharSequence or
null, if no negative button should be shown in the dialogpublic final void setNegativeButtonText(int resourceId)
resourceId - The resource id of the text, which should be set, as an Integer value. The
resource id must correspond to a valid string resourcepublic final int getDialogTitleColor()
Integer value or -1, if no custom title color is
setpublic final void setDialogTitleColor(int color)
color - The color, which should be set, as an Integer value or -1, if no custom title
should be setpublic final int getDialogMessageColor()
Integer value or -1, if no custom message
color is setpublic final void setDialogMessageColor(int color)
color - The color, which should be set, as an Integer value or -1, if no custom
message color should be setpublic final int getDialogButtonTextColor()
Integer value or -1, if no custom text
color is setpublic final void setDialogButtonTextColor(int color)
color - The color, which should be set, as an Integer value or -1, if no custom text
color should be setpublic final android.graphics.drawable.Drawable getDialogBackground()
Drawable or null, if no custom background is setpublic final void setDialogBackground(android.graphics.drawable.Drawable background)
background - The background, which should be set, as an instance of the class Drawable or
null, if no custom background should be setpublic final void setDialogBackground(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 setDialogBackgroundColor(int color)
color - The color, which should be set, as an Integer value or -1, if no custom
background color should be setpublic final boolean isValueShownAsSummary()
public final void showValueAsSummary(boolean showValueAsSummary)
showValueAsSummary - True, if the currently persisted value should be shown instead of the summary, false
otherwisepublic final boolean isDialogHeaderShown()
public final void showDialogHeader(boolean show)
show - True, if the header of the preference's dialog should be shown, false otherwisepublic final android.graphics.drawable.Drawable getDialogHeaderBackground()
Drawablepublic final void setDialogHeaderBackground(android.graphics.drawable.Drawable background)
background - The background, which should be set, as an instance of the class Drawable or
null, if no custom background should be setpublic final void setDialogHeaderBackground(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 setDialogHeaderBackgroundColor(int color)
color - The color, which should be set, as an Integer value or -1, if no custom color
should be setpublic final android.graphics.drawable.Drawable getDialogHeaderIcon()
Drawablepublic final void setDialogHeaderIcon(android.graphics.drawable.Drawable icon)
icon - The icon, which should be set, as an instance of the class Drawable or null,
if no icon should be setpublic final void setDialogHeaderIcon(int resourceId)
resourceId - The resource id of the icon, which should be set, as an Integer value. The
resource id must correspond to a valid drawable resourcepublic final boolean isDialogButtonBarDividerShown()
public final void showDialogButtonBarDivider(boolean show)
show - True, if the divider, which is located above the buttons of the preference's dialog
should be shown, false otherwisepublic final int getDialogButtonBarDividerColor()
Integer value or -1, if no custom color is setpublic final void setDialogButtonBarDividerColor(int color)
color - The color, which should be set, as an Integer value or -1, if no custom color
should be setpublic final boolean isDialogContentDividerShown()
public final void showDialogContentDivider(boolean show)
show - True, if the divider, which is located above the custom view of the preference's
dialog, should be shown, false otherwisepublic final int getDialogContentDividerColor()
Integer value or -1, if no custom color is setpublic final void setDialogContentDividerColor(int color)
color - The color, which should be set, as an Integer value or -1, if no custom color
should be setpublic final void onClick(android.content.DialogInterface dialog,
int which)
onClick in interface android.content.DialogInterface.OnClickListenerpublic final void onDismiss(android.content.DialogInterface dialog)
onDismiss in interface android.content.DialogInterface.OnDismissListenerprotected final void onClick()
onClick in class android.preference.Preferenceprotected android.os.Parcelable onSaveInstanceState()
onSaveInstanceState in class android.preference.Preferenceprotected void onRestoreInstanceState(android.os.Parcelable state)
onRestoreInstanceState in class android.preference.Preference