Exemplo n.º 1
0
 /**
  * Set a list of items to be displayed in the dialog as the content, you will be notified of the
  * selected item via the supplied listener.
  *
  * @param items the text of the items to be displayed in the list.
  * @param checkedItems specifies which items are checked. It should be null in which case no
  *     items are checked. If non null it must be exactly the same length as the array of items.
  * @param listener notified when an item on the list is clicked. The dialog will not be
  *     dismissed when an item is clicked. It will only be dismissed if clicked on a button, if
  *     no buttons are supplied it's up to the user to dismiss the dialog. * @return
  * @return This
  */
 public Builder setMultiChoiceItems(
     @NonNull String[] items,
     @Nullable final boolean[] checkedItems,
     final DialogInterface.OnMultiChoiceClickListener listener) {
   builder.items(items);
   setUpMultiChoiceCallback(checkedItems, listener);
   return this;
 }
Exemplo n.º 2
0
 /**
  * Set a list of items to be displayed in the dialog as the content, you will be notified of the
  * selected item via the supplied listener.
  *
  * @param itemsId A resource ID for the items (e.g. R.array.my_items)
  * @param checkedItems specifies which items are checked. It should be null in which case no
  *     items are checked. If non null it must be exactly the same length as the array of items.
  * @param listener notified when an item on the list is clicked. The dialog will not be
  *     dismissed when an item is clicked. It will only be dismissed if clicked on a button, if
  *     no buttons are supplied it's up to the user to dismiss the dialog. * @return
  * @return This
  */
 public Builder setMultiChoiceItems(
     @ArrayRes int itemsId,
     @Nullable final boolean[] checkedItems,
     final DialogInterface.OnMultiChoiceClickListener listener) {
   builder.items(itemsId);
   setUpMultiChoiceCallback(checkedItems, listener);
   return this;
 }
Exemplo n.º 3
0
 /**
  * Set a list of items to be displayed in the dialog as the content, you will be notified of the
  * selected item via the supplied listener.
  *
  * @param itemsId the resource id of an array i.e. R.array.foo
  * @param checkedItem specifies which item is checked. If -1 no items are checked.
  * @param listener notified when an item on the list is clicked. The dialog will not be
  *     dismissed when an item is clicked. It will only be dismissed if clicked on a button, if
  *     no buttons are supplied it's up to the user to dismiss the dialog.
  * @return This
  */
 public Builder setSingleChoiceItems(
     @ArrayRes int itemsId, int checkedItem, final DialogInterface.OnClickListener listener) {
   builder.items(itemsId);
   builder.itemsCallbackSingleChoice(
       checkedItem,
       new MaterialDialog.ListCallbackSingleChoice() {
         @Override
         public boolean onSelection(
             MaterialDialog dialog, View itemView, int which, CharSequence text) {
           listener.onClick(dialog, which);
           return true;
         }
       });
   return this;
 }
Exemplo n.º 4
0
 public Builder setItems(CharSequence[] items, DialogInterface.OnClickListener listener) {
   builder.items(items);
   onClickListener = listener;
   return this;
 }
Exemplo n.º 5
0
 public Builder setItems(@ArrayRes int itemsId, DialogInterface.OnClickListener listener) {
   builder.items(itemsId);
   onClickListener = listener;
   return this;
 }