You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p>The builder <ahref="javadoc/de/mrapp/android/dialog/MaterialDialog.Builder.html" target="_blank" class="code">MaterialDialog.Builder</a>, which is provided by this library, has been designed in order to be similar to the Android SDK's built-in class <ahref="http://developer.android.com/reference/android/app/AlertDialog.Builder.html" target="_blank" class="code">AlertDialog.Builder</a> and therefore provides the same functionality. The builder creates a dialog, which is instatiated from the class <ahref="javadoc/de/mrapp/android/dialog/MaterialDialog.html" target="_blank" class="code">MaterialDialog</a> and whose appearance is designed according to the Android 5 "Material Desing" guidelines, which can be found <ahref="http://www.google.com/design/spec/material-design/introduction.html" target="_blank" class="code">here</a>. Such a dialog can contain a title, an icon, a message and up to three buttons. All of these properties are optional. Furthermore, the dialog can be used to display a list view, which contains a specific set of list items, using a specific choice mode. It is also possible to set custom views for the dialog's title or content in order to realise a "Material Design"-styled custom dialog. How to create dialogs using these different properties will be discussed in the following sections.</p>
47
+
<p>The builder <ahref="javadoc/de/mrapp/android/dialog/MaterialDialog.Builder.html" target="_blank" class="code">MaterialDialog.Builder</a>, which is provided by this library, has been designed in order to be similar to the Android SDK's built-in class <ahref="http://developer.android.com/reference/android/app/AlertDialog.Builder.html" target="_blank" class="code">AlertDialog.Builder</a> and therefore provides the same functionality. The builder creates a dialog, which is instatiated from the class <ahref="javadoc/de/mrapp/android/dialog/MaterialDialog.html" target="_blank" class="code">MaterialDialog</a> and whose appearance is designed according to the Android 5 "Material Design" guidelines, which can be found <ahref="http://www.google.com/design/spec/material-design/introduction.html" target="_blank" class="code">here</a>. Such a dialog can contain a title, an icon, a message and up to three buttons. All of these properties are optional. Furthermore, the dialog can be used to display a list view, which contains a specific set of list items, using a specific choice mode. It is also possible to set custom views for the dialog's title or content in order to realize a "Material Design"-styled custom dialog. How to create dialogs using these different properties will be discussed in the following sections.</p>
48
48
49
49
<h4><aname="specifying-title-icon-and-message">2 Specifying a title, icon and message</a></h4>
50
50
@@ -66,7 +66,7 @@ <h4><a name="specifying-title-icon-and-message">2 Specifying a title, icon and m
<p>The <tt>setIcon</tt>-methods show above allow to specify the icon by either passing an instance of the class <ahref="http://developer.android.com/reference/android/graphics/drawable/Drawable.html" target="_blank" class="code">Drawable</a> or the resource ID of a drawable resource as a parameter. The <tt>setIconAttribute</tt>-method allows to pass the attribute of theme, which is currently applied on the builder's context, which specifies the drawable. An example of such an attribute is <tt>android.R.attr.alertDialogIcon</tt>.</p>
69
+
<p>The <tt>setIcon</tt>-methods shown above allow to specify the icon by either passing an instance of the class <ahref="http://developer.android.com/reference/android/graphics/drawable/Drawable.html" target="_blank" class="code">Drawable</a> or the resource ID of a drawable resource as a parameter. The <tt>setIconAttribute</tt>-method allows to pass the attribute of theme, which is currently applied on the builder's context to specify the drawable. An example of such an attribute is <tt>android.R.attr.alertDialogIcon</tt>.</p>
70
70
71
71
<h4><aname="specifying-the-buttons">3 Specifying the dialog's buttons</a></h4>
72
72
@@ -81,7 +81,7 @@ <h4><a name="specifying-the-buttons">3 Specifying the dialog's buttons</a></h4>
81
81
82
82
<p>The second parameter of all methods shown above allows to pass a listener, which therefore must implement the interface <ahref="http://developer.android.com/reference/android/content/DialogInterface.OnClickListener.html" target="_blank" class="code">DialogInterface.OnClickListener</a>, to the button. The listener is invoked when the user closes the dialog by clicking the appropriate button. Passing a <tt>null</tt> reference instead of a listener implementation, does not cause the app to crash and the dialog will be closed anyways, when the button is clicked.</p>
83
83
84
-
<p>By default the dialog's buttons are align horizontally, but as the "Material Design" guidelines introduced an alternative way of aligning a dialog's buttons, the builder's method <tt>stackButtons(boolean):Builder</tt> can be used to align the buttons vertically. The following screenshots shows a dialog, whose buttons are stacked:<p>
84
+
<p>By default the dialog's buttons are aligned horizontally, but as the "Material Design" guidelines introduced an alternative way of aligning a dialog's buttons, the builder's method <tt>stackButtons(boolean):Builder</tt> can be used to align the buttons vertically. The following screenshots shows a dialog, whose buttons are stacked:<p>
@@ -136,7 +136,7 @@ <h4><a name="modifying-the-appearance">4 Modifying the dialog's appearance</a></
136
136
137
137
<p>If a dialog, which is created by the class <ahref="javadoc/de/mrapp/android/dialog/MaterialDialog.Builder.html" target="_blank" class="code">MaterialDialog.Builder</a>, should use an individual theme instead of the App's default theme, the theme's resource ID can be passed to the builder's constructor.</p>
138
138
139
-
<p>Besides using the setter methods mentioned above, theme attributes can be used to change the appearance of dialogs. The following table shows all available attributes. They must either be defined in the app's global theme or in the theme, whose ID is pased to the builder's constructor, if any.</p>
139
+
<p>Besides using the setter methods mentioned above, theme attributes can be used to change the appearance of dialogs. The following table shows all available attributes. They must either be defined in the app's global theme or in the theme, whose ID is passed to the builder's constructor, if any.</p>
140
140
141
141
<table>
142
142
<tr>
@@ -232,7 +232,7 @@ <h4><a name="creating-and-showing-the-dialog">7 Creating and showing the dialog<
232
232
233
233
<h4><aname="validating-the-dialog-content">8 Validating the dialog's content</a></h4>
234
234
235
-
<p>It is also possible to validate a dialog's content when its positive button is clicked by the user. Therfore the interface <ahref="javadoc/de/mrapp/android/dialog/MaterialDialog.Validator.html" target="_blank" class="code">MaterialDialog.Validator</a> has to be implemented. It defines the method <tt>validate():boolean</tt>, which has to be overridden in order to return, whether the dialog's content is valid, or not. Multiple instances of this interface can be added to an instance of the class <ahref="javadoc/de/mrapp/android/dialog/MaterialDialog.Builder.html" target="_blank" class="code">MaterialDialog.Builder</a> by using its method <tt>addValidator(Validator):Builder</tt> or <tt>addAllValidators(Collection):Builder</tt>. Previously added instances can be removed by using the method <tt>removeValidator(Validator):Builder</tt> or <tt>removeAllValidators(Collection):Builder</tt> afterwards. When the dialog's positive button is clicked by the user, all added validators will be executed. If one of them returns <tt>false</tt> from its <tt>validate</tt>-method, the dialog will not be dismissed. When the negative or neutral button is clicked instead, no validation will be performed.</p>
235
+
<p>It is also possible to validate a dialog's content when its positive button is clicked by the user. Therfore the interface <ahref="javadoc/de/mrapp/android/dialog/MaterialDialog.Validator.html" target="_blank" class="code">MaterialDialog.Validator</a> has to be implemented. It defines the method <tt>validate(MaterialDialog):boolean</tt>, which has to be overridden in order to return, whether the dialog's content is valid, or not. Multiple instances of this interface can be added to an instance of the class <ahref="javadoc/de/mrapp/android/dialog/MaterialDialog.Builder.html" target="_blank" class="code">MaterialDialog.Builder</a> by using its method <tt>addValidator(Validator):Builder</tt> or <tt>addAllValidators(Collection):Builder</tt>. Previously added instances can be removed by using the method <tt>removeValidator(Validator):Builder</tt> or <tt>removeAllValidators(Collection):Builder</tt> afterwards. When the dialog's positive button is clicked by the user, all added validators will be executed. If one of them returns <tt>false</tt> from its <tt>validate</tt>-method, the dialog will not be dismissed. When the negative or neutral button is clicked instead, no validation will be performed.</p>
236
236
237
237
<h4>External references:</h4>
238
238
<divclass="reference"><aname="reference1" class="reference">[1]</a><ahref="http://developer.android.com/reference/android/app/AlertDialog.Builder.html" target="_blank">http://developer.android.com/reference/android/app/AlertDialog.Builder.html</a> – Class AlterDialog.Builder</div>
0 commit comments