|
@@ -67,6 +67,7 @@ public class MaterialDialog extends DialogBase implements View.OnClickListener {
|
|
protected Button neutralButton;
|
|
protected Button neutralButton;
|
|
protected Button negativeButton;
|
|
protected Button negativeButton;
|
|
protected boolean isStacked;
|
|
protected boolean isStacked;
|
|
|
|
+ protected boolean alwaysCallMultiChoiceCallback;
|
|
protected final int defaultItemColor;
|
|
protected final int defaultItemColor;
|
|
protected ListType listType;
|
|
protected ListType listType;
|
|
protected List<Integer> selectedIndicesList;
|
|
protected List<Integer> selectedIndicesList;
|
|
@@ -197,6 +198,7 @@ public class MaterialDialog extends DialogBase implements View.OnClickListener {
|
|
} else {
|
|
} else {
|
|
selectedIndicesList = new ArrayList<>();
|
|
selectedIndicesList = new ArrayList<>();
|
|
}
|
|
}
|
|
|
|
+ alwaysCallMultiChoiceCallback = builder.alwaysCallMultiChoiceCallback;
|
|
} else {
|
|
} else {
|
|
listType = ListType.REGULAR;
|
|
listType = ListType.REGULAR;
|
|
}
|
|
}
|
|
@@ -727,6 +729,9 @@ public class MaterialDialog extends DialogBase implements View.OnClickListener {
|
|
} else if (mBuilder.listCallbackMulti != null) {
|
|
} else if (mBuilder.listCallbackMulti != null) {
|
|
CheckBox cb = (CheckBox) ((LinearLayout) v).getChildAt(0);
|
|
CheckBox cb = (CheckBox) ((LinearLayout) v).getChildAt(0);
|
|
cb.setChecked(!cb.isChecked());
|
|
cb.setChecked(!cb.isChecked());
|
|
|
|
+ if (alwaysCallMultiChoiceCallback) {
|
|
|
|
+ sendMultichoiceCallback();
|
|
|
|
+ }
|
|
} else if (mBuilder.autoDismiss) dismiss();
|
|
} else if (mBuilder.autoDismiss) dismiss();
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
@@ -757,6 +762,7 @@ public class MaterialDialog extends DialogBase implements View.OnClickListener {
|
|
protected ListCallback listCallback;
|
|
protected ListCallback listCallback;
|
|
protected ListCallback listCallbackSingle;
|
|
protected ListCallback listCallbackSingle;
|
|
protected ListCallbackMulti listCallbackMulti;
|
|
protected ListCallbackMulti listCallbackMulti;
|
|
|
|
+ protected boolean alwaysCallMultiChoiceCallback = false;
|
|
protected Theme theme = Theme.LIGHT;
|
|
protected Theme theme = Theme.LIGHT;
|
|
protected boolean cancelable = true;
|
|
protected boolean cancelable = true;
|
|
protected float contentLineSpacingMultiplier = 1.3f;
|
|
protected float contentLineSpacingMultiplier = 1.3f;
|
|
@@ -943,6 +949,16 @@ public class MaterialDialog extends DialogBase implements View.OnClickListener {
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * By default, the multi choice callback is only called when the user clicks the positive button
|
|
|
|
+ * or if there are no buttons. Call this to force it to always call on item clicks even if the
|
|
|
|
+ * positive button exists.
|
|
|
|
+ */
|
|
|
|
+ public Builder alwaysCallMultiChoiceCallback() {
|
|
|
|
+ this.alwaysCallMultiChoiceCallback = true;
|
|
|
|
+ return this;
|
|
|
|
+ }
|
|
|
|
+
|
|
public Builder positiveText(@StringRes int postiveRes) {
|
|
public Builder positiveText(@StringRes int postiveRes) {
|
|
positiveText(this.context.getString(postiveRes));
|
|
positiveText(this.context.getString(postiveRes));
|
|
return this;
|
|
return this;
|