public static class MaterialDialog.Builder
extends java.lang.Object
| Constructor and Description |
|---|
Builder(android.content.Context context)
Creates a new builder, which allows to create dialogs, which are designed according to
Android 5's Material Design guidelines even on pre-Lollipop devices.
|
Builder(android.content.Context context,
int themeResourceId)
Creates a new builder, which allows to create dialogs, which are designed according to
Android 5's Material Design guidelines even on pre-Lollipop devices.
|
| Modifier and Type | Method and Description |
|---|---|
MaterialDialog.Builder |
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, which is created by the builder, is clicked.
|
MaterialDialog.Builder |
addValidator(MaterialDialog.Validator validator)
Adds a new validator, which should be executed when the positive button of the dialog,
which is created by the builder, is clicked.
|
MaterialDialog |
create()
Creates a dialog with the arguments, which have been suppplied to the builder.
|
android.content.Context |
getContext()
Returns the context, which is used by the builder.
|
MaterialDialog.Builder |
setAdapter(android.widget.ListAdapter adapter,
android.content.DialogInterface.OnClickListener listener)
Sets the adapter, which provides the items, which should be shown by the dialog, which is
created by the builder.
|
MaterialDialog.Builder |
setBackground(android.graphics.drawable.Drawable background)
Sets the background of the dialog, which is created by the builder.
|
MaterialDialog.Builder |
setBackground(int resourceId)
Sets the background of the dialog, which is created by the builder.
|
MaterialDialog.Builder |
setBackgroundColor(int color)
Sets the background color of the dialog, which is created by the builder.
|
MaterialDialog.Builder |
setButtonTextColor(int color)
Sets the color of the button texts of the dialog, which is created by the builder.
|
MaterialDialog.Builder |
setCancelable(boolean cancelable)
Sets, whether the dialog, which is created by the builder, should be cancelable, or not.
|
MaterialDialog.Builder |
setCustomTitle(android.view.View view)
Sets the custom view, which should be used to show the title of the dialog, which is
created by the builder.
|
MaterialDialog.Builder |
setIcon(android.graphics.drawable.Drawable icon)
Sets the icon of the dialog, which is created by the builder.
|
MaterialDialog.Builder |
setIcon(int resourceId)
Sets the icon of the dialog, which is created by the builder.
|
MaterialDialog.Builder |
setIconAttribute(int attributeId)
Set the icon of the dialog, which is created by the builder.
|
MaterialDialog.Builder |
setItemColor(int color)
Sets the color of the list items of the dialog, which is created by the builder.
|
MaterialDialog.Builder |
setItemControlColor(int color)
Sets the control color of the list items of the dialog, which is created by the builder.
|
MaterialDialog.Builder |
setItems(java.lang.CharSequence[] items,
android.content.DialogInterface.OnClickListener listener)
Sets the items, which should be shown by the dialog, which is created by the builder.
|
MaterialDialog.Builder |
setItems(int resourceId,
android.content.DialogInterface.OnClickListener listener)
Sets the items, which should be shown by the dialog, which is created by the builder.
|
MaterialDialog.Builder |
setMessage(java.lang.CharSequence message)
Sets the message of the dialog, which is created by the builder.
|
MaterialDialog.Builder |
setMessage(int resourceId)
Sets the message of the dialog, which is created by the builder.
|
MaterialDialog.Builder |
setMessageColor(int color)
Sets the color of the message of the dialog, which is created by the builder.
|
MaterialDialog.Builder |
setMultiChoiceItems(java.lang.CharSequence[] items,
boolean[] checkedItems,
android.content.DialogInterface.OnMultiChoiceClickListener listener)
Sets the selectable items, which should be shown by the dialog, which is created by the
builder.
|
MaterialDialog.Builder |
setMultiChoiceItems(int resourceId,
boolean[] checkedItems,
android.content.DialogInterface.OnMultiChoiceClickListener listener)
Sets the selectable items, which should be shown by the dialog, which is created by the
builder.
|
MaterialDialog.Builder |
setNegativeButton(java.lang.CharSequence text,
android.content.DialogInterface.OnClickListener listener)
Sets the text of the negative button of the dialog, which is created by the builder.
|
MaterialDialog.Builder |
setNegativeButton(int resourceId,
android.content.DialogInterface.OnClickListener listener)
Sets the text of the negative button of the dialog, which is created by the builder.
|
MaterialDialog.Builder |
setNeutralButton(java.lang.CharSequence text,
android.content.DialogInterface.OnClickListener listener)
Sets the text of the neutral button of the dialog, which is created by the builder.
|
MaterialDialog.Builder |
setNeutralButton(int resourceId,
android.content.DialogInterface.OnClickListener listener)
Sets the text of the neutral button of the dialog, which is created by the builder.
|
MaterialDialog.Builder |
setOnCancelListener(android.content.DialogInterface.OnCancelListener listener)
Sets the listener, which should be notified, when the dialog, which is created by the
builder, is canceled.
|
MaterialDialog.Builder |
setOnDismissListener(android.content.DialogInterface.OnDismissListener listener)
Sets the listener, which should be notified, when the dialog, which is created by the
builder, is dismissed for any reason.
|
MaterialDialog.Builder |
setOnItemSelectedListener(android.widget.AdapterView.OnItemSelectedListener listener)
Sets the listener, which should be notified, when an item, which is shown by the dialog,
which is created by the builder, is selected.
|
MaterialDialog.Builder |
setOnKeyListener(android.content.DialogInterface.OnKeyListener listener)
Sets the listener, which should be notified, if a key is dispatched to the dialog, which
is created by the builder.
|
MaterialDialog.Builder |
setPositiveButton(java.lang.CharSequence text,
android.content.DialogInterface.OnClickListener listener)
Sets the text of the positive button of the dialog, which is created by the builder.
|
MaterialDialog.Builder |
setPositiveButton(int resourceId,
android.content.DialogInterface.OnClickListener listener)
Sets the text of the positive button of the dialog, which is created by the builder.
|
MaterialDialog.Builder |
setSingleChoiceItems(java.lang.CharSequence[] items,
int checkedItem,
android.content.DialogInterface.OnClickListener listener)
Sets the selectable items, which should be shown by the dialog, which is created by the
builder.
|
MaterialDialog.Builder |
setSingleChoiceItems(int resourceId,
int checkedItem,
android.content.DialogInterface.OnClickListener listener)
Sets the selectable items, which should be shown by the dialog, which is created by the
builder.
|
MaterialDialog.Builder |
setSingleChoiceItems(android.widget.ListAdapter adapter,
int checkedItem,
android.content.DialogInterface.OnClickListener listener)
Sets the adapter, which provides the selectable items, which should be shown by the
dialog, which is created by the builder.
|
MaterialDialog.Builder |
setTitle(java.lang.CharSequence title)
Sets the title of the dialog, which is created by the builder.
|
MaterialDialog.Builder |
setTitle(int resourceId)
Sets the title of the dialog, which is created by the builder.
|
MaterialDialog.Builder |
setTitleColor(int color)
Sets the color of the title of the dialog, which is created by the builder.
|
MaterialDialog.Builder |
setView(int resourceId)
Sets the custom view, which should be shown by the dialog, which is created by the
builder.
|
MaterialDialog.Builder |
setView(android.view.View view)
Sets the custom view, which should be shown by the dialog, which is created by the
builder.
|
MaterialDialog |
show()
Creates a dialog with the arguments, which have been supplied to the builder and
immediately displays it.
|
MaterialDialog.Builder |
stackButtons(boolean stackButtons)
Sets, whether the buttons of the dialog, which is created by the builder, should be
aligned vertically, or not.
|
public Builder(android.content.Context context)
context - The context, which should be used by the builder, as an instance of the class
Context. The context may not be nullpublic Builder(android.content.Context context,
int themeResourceId)
context - The context, which should be used by the builder, 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.content.Context getContext()
Contextpublic final MaterialDialog.Builder setCancelable(boolean cancelable)
cancelable - True, if the dialog, which is created by the builder, should be cancelable, false
otherwiseMaterialDialog.Builderpublic MaterialDialog.Builder setOnCancelListener(android.content.DialogInterface.OnCancelListener listener)
setOnDismissListener.listener - The listener, which should be set, as an instance of the type OnCancelListener, or null, if no listener should be setMaterialDialog.BuildersetCancelable(boolean),
setOnDismissListener(android.content.DialogInterface.OnDismissListener)public final MaterialDialog.Builder setOnDismissListener(android.content.DialogInterface.OnDismissListener listener)
listener - The listener, which should be set, as an instance of the type OnDismissListener, or null, if no listener should be setMaterialDialog.Builderpublic final MaterialDialog.Builder setOnKeyListener(android.content.DialogInterface.OnKeyListener listener)
listener - The listener, which should be set, as an instance of the type OnKeyListener, or null, if no listener should be setMaterialDialog.Builderpublic final MaterialDialog.Builder setTitleColor(int color)
color - The color, which should be set, as an Integer value or -1, if no custom
color should be setMaterialDialog.Builderpublic final MaterialDialog.Builder setMessageColor(int color)
color - The color, which should be set, as an Integer value or -1, if no custom
color should be setMaterialDialog.Builderpublic final MaterialDialog.Builder setItemColor(int color)
color - The color, which should be set, as an Integer value or -1, if no custom
color should be setMaterialDialog.Builderpublic final MaterialDialog.Builder setItemControlColor(int color)
color - The color, which should be set, as an Integer value or -1, if no custom
color should be setMaterialDialog.Builderpublic final MaterialDialog.Builder 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 setMaterialDialog.Builderpublic final MaterialDialog.Builder 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 resourceMaterialDialog.Builderpublic final MaterialDialog.Builder setBackgroundColor(int color)
color - The background color, which should be set, as an Integer value or -1, if
no custom background color should be setMaterialDialog.Builderpublic final MaterialDialog.Builder setButtonTextColor(int color)
color - The color, which should be set, as an Integer value or -1, if no custom
button color should be setMaterialDialog.Builderpublic final MaterialDialog.Builder stackButtons(boolean stackButtons)
stackButtons - True, if the buttons of the dialog, which is created by the builder, should be
aligned vertically, false otherwiseMaterialDialog.Builderpublic final MaterialDialog.Builder addValidator(MaterialDialog.Validator validator)
validator - The validator, which should be added, as an instance of the type MaterialDialog.Validator. The validator may not be nullMaterialDialog.Builderpublic final MaterialDialog.Builder 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 addedMaterialDialog.Builderpublic final MaterialDialog.Builder setTitle(java.lang.CharSequence title)
title - The title, which should be set, as an instance of the type CharSequence
or null, if no title should be shownMaterialDialog.Builderpublic final MaterialDialog.Builder setTitle(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 resourceMaterialDialog.Builderpublic final MaterialDialog.Builder 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 shownMaterialDialog.Builderpublic final MaterialDialog.Builder 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 resourceMaterialDialog.Builderpublic final MaterialDialog.Builder 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 shownMaterialDialog.Builderpublic final MaterialDialog.Builder 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 resourceMaterialDialog.Builderpublic final MaterialDialog.Builder 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 resourceMaterialDialog.Builderpublic final MaterialDialog.Builder 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
notifiedMaterialDialog.Builderpublic final MaterialDialog.Builder 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
notifiedMaterialDialog.Builderpublic final MaterialDialog.Builder 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
notifiedMaterialDialog.Builderpublic final MaterialDialog.Builder 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
notifiedMaterialDialog.Builderpublic final MaterialDialog.Builder 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
notifiedMaterialDialog.Builderpublic final MaterialDialog.Builder 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
notifiedMaterialDialog.Builderpublic final MaterialDialog.Builder setItems(java.lang.CharSequence[] items, android.content.DialogInterface.OnClickListener listener)
items - The items, which should be set, as an array of the type CharSequence. The
items may not be nulllistener - The listener, which should be notified, when an item is clicked, as an instance
of the type OnClickListener or null, if no listener should be notifiedMaterialDialog.Builderpublic final MaterialDialog.Builder setItems(int resourceId, android.content.DialogInterface.OnClickListener listener)
resourceId - The resource id of the items, which should be set, as an Integer value.
The resource id must correspond to a valid array resourcelistener - The listener, which should be notified, when an item is clicked, as an instance
of the type OnClickListener or null, if no listener should be notifiedMaterialDialog.Builderpublic final MaterialDialog.Builder setAdapter(android.widget.ListAdapter adapter, android.content.DialogInterface.OnClickListener listener)
adapter - The adapter, which should be set, as an instance of the type ListAdapter
or null, if no items should be shown by the dialoglistener - The listener, which should be notified, when an item is clicked, as an instance
of the type OnClickListener or null, if no listener should be notifiedMaterialDialog.Builderpublic final MaterialDialog.Builder setSingleChoiceItems(java.lang.CharSequence[] items, int checkedItem, android.content.DialogInterface.OnClickListener listener)
items - The items, which should be set, as an array of the type CharSequence. The
items may not be nullcheckedItem - The index of the item, which should be selected by default, as an Integer
value or -1, if no item should be selected by defaultlistener - The listener, which should be notified, when an item is clicked, as an instance
of the type OnClickListener or null, if no listener should be notifiedMaterialDialog.Builderpublic final MaterialDialog.Builder setSingleChoiceItems(int resourceId, int checkedItem, android.content.DialogInterface.OnClickListener listener)
resourceId - The resource id of the items, which should be set, as an Integer value.
The resource id must correspond to a valid array resourcecheckedItem - The index of the item, which should be selected by default, as an Integer
value or -1, if no item should be selected by defaultlistener - The listener, which should be notified, when an item is clicked, as an instance
of the type OnClickListener or null, if no listener should be notifiedMaterialDialog.Builderpublic final MaterialDialog.Builder setSingleChoiceItems(android.widget.ListAdapter adapter, int checkedItem, android.content.DialogInterface.OnClickListener listener)
adapter - The adapter, which should be set, as an instance of the type ListAdapter.
The adapter may not be nulllistener - The listener, which should be notified, when an item is clicked, as an instance
of the type OnClickListener or null, if no listener should be notifiedMaterialDialog.Builderpublic final MaterialDialog.Builder setMultiChoiceItems(java.lang.CharSequence[] items, boolean[] checkedItems, android.content.DialogInterface.OnMultiChoiceClickListener listener)
items - The items, which should be set, as an array of the type CharSequence. The
items may not be nullcheckedItems - An array, which contains, whether the items, which correspond to the
corresponding indices, should be selected by default, or not, as a Boolean array or null, if no items should be selected by defaultlistener - The listener, which should be notified, when an item is clicked, as an instance
of the type OnClickListener or null, if no listener should be notifiedMaterialDialog.Builderpublic final MaterialDialog.Builder setMultiChoiceItems(int resourceId, boolean[] checkedItems, android.content.DialogInterface.OnMultiChoiceClickListener listener)
resourceId - The resource id of the items, which should be set, as an Integer value.
The resource id must correspond to a valid array resourcecheckedItems - An array, which contains, whether the items, which correspond to the
corresponding indices, should be selected by default, or not, as a Boolean array or null, if no items should be selected by defaultlistener - The listener, which should be notified, when an item is clicked, as an instance
of the type OnClickListener or null, if no listener should be notifiedMaterialDialog.Builderpublic final MaterialDialog.Builder setOnItemSelectedListener(android.widget.AdapterView.OnItemSelectedListener listener)
listener - The listener, which should be set, as an instance of the type AdapterView.OnItemSelectedListener or null, if no listener should be notifiedMaterialDialog.Builderpublic final MaterialDialog.Builder 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 shownMaterialDialog.Builderpublic final MaterialDialog.Builder 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 resourceMaterialDialog.Builderpublic final MaterialDialog.Builder 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 titleMaterialDialog.Builderpublic final MaterialDialog create()
MaterialDialogpublic final MaterialDialog show()
MaterialDialog