public class MaterialDialog
extends android.app.Dialog
implements android.content.DialogInterface
Dialog.create() or Dialog.show() of the builder MaterialDialog.Builder can be used.| Modifier and Type | Class and Description |
|---|---|
static class |
MaterialDialog.Builder
A builder, which allows to create and show dialogs, which are designed according to Android
5's Material Design guidelines even on pre-Lollipop devices.
|
static interface |
MaterialDialog.Validator
Defines the interface, a class, which should be able to validate the content of a dialog,
must implement.
|
android.content.DialogInterface.OnCancelListener, android.content.DialogInterface.OnClickListener, android.content.DialogInterface.OnDismissListener, android.content.DialogInterface.OnKeyListener, android.content.DialogInterface.OnMultiChoiceClickListener, android.content.DialogInterface.OnShowListener| Modifier | Constructor and Description |
|---|---|
|
MaterialDialog(android.content.Context context)
Creates a dialog, which is designed according to Android 5's Material Design guidelines even
on pre-Lollipop devices.
|
protected |
MaterialDialog(android.content.Context context,
int themeResourceId)
Creates a dialog, which is designed according to Android 5's Material Design guidelines even
on pre-Lollipop devices.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addAllValidators(java.util.Collection<MaterialDialog.Validator> validators)
Adds all validators, which are contained by a specific collection and should be executed when
the positive button of the dialog is clicked.
|
void |
addValidator(MaterialDialog.Validator validator)
Adds a new validator, which should be executed when the positive button of the dialog is
clicked.
|
android.graphics.drawable.Drawable |
getBackground()
Returns the background of the dialog.
|
android.widget.Button |
getButton(int whichButton)
Returns one of the buttons, which is shown by the dialog.
|
int |
getButtonTextColor()
Returns the color of the button texts of the dialog.
|
android.graphics.drawable.Drawable |
getIcon()
Returns the icon of the dialog.
|
int |
getItemColor()
Returns the color of the list items of the dialog.
|
int |
getItemControlColor()
Returns the control color of the list items of the dialog.
|
android.widget.ListAdapter |
getListAdapter()
Returns the adapter of the list view, which is contained by the dialog.
|
android.widget.ListView |
getListView()
Returns the list view, which is contained by the dialog.
|
java.lang.CharSequence |
getMessage()
Returns the message of the dialog.
|
int |
getMessageColor()
Returns the color of the message of the dialog.
|
java.lang.CharSequence |
getTitle()
Returns the title of the dialog.
|
int |
getTitleColor()
Returns the color of the title of the dialog.
|
java.util.Set<MaterialDialog.Validator> |
getValidators()
Returns a set, which contains the validators, which are executed when the positive button of
the dialog is clicked.
|
void |
onCreate(android.os.Bundle savedInstanceState) |
void |
removeAllValidators(java.util.Collection<MaterialDialog.Validator> validators)
Removes all validators, which are contained by a specific collection and should not be
executed, when the positive button of the dialog is clicked, anymore.
|
void |
removeValidator(MaterialDialog.Validator validator)
Removes a specific validator, which should not be executed, when the positive button of the
dialog is clicked, anymore.
|
void |
setBackground(android.graphics.drawable.Drawable background)
Sets the background of the dialog.
|
void |
setBackground(int resourceId)
Sets the background of the dialog.
|
void |
setBackgroundColor(int color)
Sets the background color of the dialog.
|
void |
setButtonTextColor(int color)
Sets the color of the button texts of the dialog.
|
void |
setCustomTitle(android.view.View view)
Sets the custom view, which should be used to show the title of the dialog.
|
void |
setIcon(android.graphics.drawable.Drawable icon)
Sets the icon of the dialog.
|
void |
setIcon(int resourceId)
Sets the icon of the dialog.
|
void |
setIconAttribute(int attributeId)
Set the icon of the dialog.
|
void |
setItemColor(int color)
Sets the color of the list items of the dialog.
|
void |
setItemControlColor(int color)
Sets the control color of the list items of the dialog, which is created by the builder.
|
void |
setMessage(java.lang.CharSequence message)
Sets the message of the dialog.
|
void |
setMessage(int resourceId)
Sets the message of the dialog.
|
void |
setMessageColor(int color)
Sets the color of the message of the dialog.
|
void |
setNegativeButton(java.lang.CharSequence text,
android.content.DialogInterface.OnClickListener listener)
Sets the text of the negative button of the dialog.
|
void |
setNegativeButton(int resourceId,
android.content.DialogInterface.OnClickListener listener)
Sets the text of the negative button of the dialog.
|
void |
setNeutralButton(java.lang.CharSequence text,
android.content.DialogInterface.OnClickListener listener)
Sets the text of the neutral button of the dialog.
|
void |
setNeutralButton(int resourceId,
android.content.DialogInterface.OnClickListener listener)
Sets the text of the neutral button of the dialog.
|
void |
setPositiveButton(java.lang.CharSequence text,
android.content.DialogInterface.OnClickListener listener)
Sets the text of the positive button of the dialog.
|
void |
setPositiveButton(int resourceId,
android.content.DialogInterface.OnClickListener listener)
Sets the text of the positive button of the dialog.
|
void |
setTitle(java.lang.CharSequence title) |
void |
setTitleColor(int color)
Sets the color of the title of the dialog.
|
void |
setView(int resourceId)
Sets the custom view, which should be shown by the dialog.
|
void |
setView(android.view.View view)
Sets the custom view, which should be shown by the dialog.
|
addContentView, cancel, closeOptionsMenu, create, dismiss, dispatchGenericMotionEvent, dispatchKeyEvent, dispatchKeyShortcutEvent, dispatchPopulateAccessibilityEvent, dispatchTouchEvent, dispatchTrackballEvent, findViewById, getActionBar, getContext, getCurrentFocus, getLayoutInflater, getOwnerActivity, getSearchEvent, getVolumeControlStream, getWindow, hide, invalidateOptionsMenu, isShowing, onActionModeFinished, onActionModeStarted, onAttachedToWindow, onBackPressed, onContentChanged, onContextItemSelected, onContextMenuClosed, onCreateContextMenu, onCreateOptionsMenu, onCreatePanelMenu, onCreatePanelView, onDetachedFromWindow, onGenericMotionEvent, onKeyDown, onKeyLongPress, onKeyMultiple, onKeyShortcut, onKeyUp, onMenuItemSelected, onMenuOpened, onOptionsItemSelected, onOptionsMenuClosed, onPanelClosed, onPrepareOptionsMenu, onPreparePanel, onRestoreInstanceState, onSaveInstanceState, onSearchRequested, onSearchRequested, onStart, onStop, onTouchEvent, onTrackballEvent, onWindowAttributesChanged, onWindowFocusChanged, onWindowStartingActionMode, onWindowStartingActionMode, openContextMenu, openOptionsMenu, registerForContextMenu, requestWindowFeature, setCancelable, setCanceledOnTouchOutside, setCancelMessage, setContentView, setContentView, setContentView, setDismissMessage, setFeatureDrawable, setFeatureDrawableAlpha, setFeatureDrawableResource, setFeatureDrawableUri, setOnCancelListener, setOnDismissListener, setOnKeyListener, setOnShowListener, setOwnerActivity, setTitle, setVolumeControlStream, show, takeKeyEvents, unregisterForContextMenupublic MaterialDialog(android.content.Context context)
context - The context, which should be used by the dialog, as an instance of the class Context. The context may not be nullprotected MaterialDialog(android.content.Context context,
int themeResourceId)
context - The context, which should be used by the dialog, as an instance of the class Context. The context may not be nullthemeResourceId - The resource id of the theme, which should be used by the dialog, as an Integer value. The resource id must correspond to a valid themepublic final android.widget.Button getButton(int whichButton)
whichButton - The identifier of the button, which should be returned, as an Integer value.
The identifier must either be DialogInterface.BUTTON_POSITIVE, DialogInterface.BUTTON_NEGATIVE or DialogInterface.BUTTON_NEUTRALButton or null, if the button is not shown or if the dialog has not been shown yetpublic final void setPositiveButton(java.lang.CharSequence text,
android.content.DialogInterface.OnClickListener listener)
text - The text, which should be set, as an instance of the type CharSequence or
null, if no positive button should be shownlistener - The listener, which should be notified, when the positive button is clicked, as an
instance of the type OnClickListener or null, if no listener should be
notifiedpublic final void setPositiveButton(int resourceId,
android.content.DialogInterface.OnClickListener listener)
resourceId - The resource id of the text, which should be set, as an Integer value. The
resource id must correspond to a valid string resourcelistener - The listener, which should be notified, when the positive button is clicked, as an
instance of the type OnClickListener or null, if no listener should be
notifiedpublic final void setNegativeButton(java.lang.CharSequence text,
android.content.DialogInterface.OnClickListener listener)
text - The text, which should be set, as an instance of the type CharSequence or
null, if no negative button should be shownlistener - The listener, which should be notified, when the negative button is clicked, as an
instance of the type OnClickListener or null, if no listener should be
notifiedpublic final void setNegativeButton(int resourceId,
android.content.DialogInterface.OnClickListener listener)
resourceId - The resource id of the text, which should be set, as an Integer value. The
resource id must correspond to a valid string resourcelistener - The listener, which should be notified, when the negative button is clicked, as an
instance of the type OnClickListener or null, if no listener should be
notifiedpublic final void setNeutralButton(java.lang.CharSequence text,
android.content.DialogInterface.OnClickListener listener)
text - The text, which should be set, as an instance of the type CharSequence or
null, if no neutral button should be shownlistener - The listener, which should be notified, when the neutral button is clicked, as an
instance of the type OnClickListener or null, if no listener should be
notifiedpublic final void setNeutralButton(int resourceId,
android.content.DialogInterface.OnClickListener listener)
resourceId - The resource id of the text, which should be set, as an Integer value. The
resource id must correspond to a valid string resourcelistener - The listener, which should be notified, when the neutral button is clicked, as an
instance of the type OnClickListener or null, if no listener should be
notifiedpublic final java.util.Set<MaterialDialog.Validator> getValidators()
Set or an empty set, if no
validators are executedpublic final void addValidator(MaterialDialog.Validator validator)
validator - The validator, which should be added, as an instance of the type MaterialDialog.Validator.
The validator may not be nullpublic final void addAllValidators(java.util.Collection<MaterialDialog.Validator> validators)
validators - A collection, which contains all validators, which should be added, as an instance of
the type Collection or an empty collection, if no validators should be addedpublic final void removeValidator(MaterialDialog.Validator validator)
validator - The validator, which should be removed, as an instance of the type MaterialDialog.Validator.
The validator may not be nullpublic final void removeAllValidators(java.util.Collection<MaterialDialog.Validator> validators)
validators - A collection, which contains the validators, which should be removed, as an instance
of the type Collection or an empty collection, if no validators should be
removedpublic final android.widget.ListView getListView()
ListView or null, if the dialog does not show any list items or has not been shown yetpublic final android.widget.ListAdapter getListAdapter()
ListAdapter or null, if the dialog does not show any list items or has not been
shown yetpublic final android.graphics.drawable.Drawable getIcon()
Drawable or null, if no
icon is shown or if the dialog has not been shown yetpublic final void setIcon(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 shownpublic final void setIcon(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 void setIconAttribute(int attributeId)
attributeId - The id of the theme attribute, which supplies the icon, which should be set, as an
Integer value. The id must point to a valid drawable resourcepublic final int getTitleColor()
Integer value or -1, if no title
is shown or if the dialog has not been shown yetpublic final void setTitleColor(int color)
color - The color, which should be set, as an Integer valuepublic final int getMessageColor()
Integer value or -1, if no
message is shown or if the dialog has not been shown yetpublic final void setMessageColor(int color)
color - The color, which should be set, as an Integer valuepublic final int getItemColor()
Integer value or -1, if no
list items are shown or if the dialog has not been shown yetpublic final void setItemColor(int color)
color - The color, which should be set, as an Integer valuepublic final int getItemControlColor()
Integer valuepublic final void setItemControlColor(int color)
color - The control color, which should be set, as an Integer value or -1, if no list
items are shown or if the dialog has not been shown yetpublic final android.graphics.drawable.Drawable getBackground()
Drawable or null, if
no custom background is set or if the dialog has not been shown yetpublic final void setBackground(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 setBackground(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 setBackgroundColor(int color)
color - The background color, which should be set, as an Integer value or -1, if no
custom background color should be setpublic final int getButtonTextColor()
Integer value or -1, if no
button is shown or if the dialog has not been shown yetpublic final void setButtonTextColor(int color)
color - The color, which should be set, as an Integer valuepublic final void setCustomTitle(android.view.View view)
view - The view, which should be set, as an instance of the class View or null, if
no custom view should be used to show the titlepublic final void setView(android.view.View view)
view - The view, which should be set, as an instance of the class View or null, if
no custom view should be shownpublic final void setView(int resourceId)
resourceId - The resource id of the view, which should be set, as an Integer value. The
resource id must correspond to a valid layout resourcepublic final java.lang.CharSequence getMessage()
CharSequence or null, if
no message is shown or if the dialog has not been shown yetpublic final void setMessage(java.lang.CharSequence message)
message - The message, which should be set, as an instance of the type CharSequence or
null, if no message should be shownpublic final void setMessage(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 java.lang.CharSequence getTitle()
CharSequence or null, if
no title is shown or if the dialog has not been shown yetpublic final void setTitle(java.lang.CharSequence title)
setTitle in class android.app.Dialogpublic final void onCreate(android.os.Bundle savedInstanceState)
onCreate in class android.app.Dialog