|
@@ -857,6 +857,10 @@ public class MaterialDialog extends DialogBase implements
|
|
|
protected int mProgress = -2;
|
|
|
protected int mProgressMax = 0;
|
|
|
|
|
|
+ protected boolean titleColorSet = false;
|
|
|
+ protected boolean contentColorSet = false;
|
|
|
+ protected boolean itemColorSet = false;
|
|
|
+
|
|
|
@DrawableRes
|
|
|
protected int listSelector;
|
|
|
@DrawableRes
|
|
@@ -889,11 +893,6 @@ public class MaterialDialog extends DialogBase implements
|
|
|
// Load theme values from the ThemeSingleton if needed
|
|
|
checkSingleton();
|
|
|
|
|
|
- // Retrieve default title/content colors
|
|
|
- this.titleColor = DialogUtils.resolveColor(context, android.R.attr.textColorPrimary);
|
|
|
- this.contentColor = DialogUtils.resolveColor(context, android.R.attr.textColorSecondary);
|
|
|
- this.itemColor = this.contentColor;
|
|
|
-
|
|
|
// Retrieve gravity settings from global theme attributes if needed
|
|
|
this.titleGravity = DialogUtils.resolveGravityEnum(context, R.attr.md_title_gravity, this.titleGravity);
|
|
|
this.contentGravity = DialogUtils.resolveGravityEnum(context, R.attr.md_content_gravity, this.contentGravity);
|
|
@@ -960,6 +959,7 @@ public class MaterialDialog extends DialogBase implements
|
|
|
|
|
|
public Builder titleColor(int color) {
|
|
|
this.titleColor = color;
|
|
|
+ this.titleColorSet = true;
|
|
|
return this;
|
|
|
}
|
|
|
|
|
@@ -1031,33 +1031,34 @@ public class MaterialDialog extends DialogBase implements
|
|
|
return this;
|
|
|
}
|
|
|
|
|
|
- public Builder contentColor(int color) {
|
|
|
- this.contentColor = color;
|
|
|
+ public Builder content(@StringRes int contentRes) {
|
|
|
+ content(this.context.getString(contentRes));
|
|
|
return this;
|
|
|
}
|
|
|
|
|
|
- public Builder contentColorRes(@ColorRes int colorRes) {
|
|
|
- contentColor(this.context.getResources().getColor(colorRes));
|
|
|
+ public Builder content(@NonNull CharSequence content) {
|
|
|
+ this.content = content;
|
|
|
return this;
|
|
|
}
|
|
|
|
|
|
- public Builder contentColorAttr(@AttrRes int colorAttr) {
|
|
|
- contentColor(DialogUtils.resolveColor(this.context, colorAttr));
|
|
|
+ public Builder content(@StringRes int contentRes, Object... formatArgs) {
|
|
|
+ content(this.context.getString(contentRes, formatArgs));
|
|
|
return this;
|
|
|
}
|
|
|
|
|
|
- public Builder content(@StringRes int contentRes) {
|
|
|
- content(this.context.getString(contentRes));
|
|
|
+ public Builder contentColor(int color) {
|
|
|
+ this.contentColor = color;
|
|
|
+ this.contentColorSet = true;
|
|
|
return this;
|
|
|
}
|
|
|
|
|
|
- public Builder content(CharSequence content) {
|
|
|
- this.content = content;
|
|
|
+ public Builder contentColorRes(@ColorRes int colorRes) {
|
|
|
+ contentColor(this.context.getResources().getColor(colorRes));
|
|
|
return this;
|
|
|
}
|
|
|
|
|
|
- public Builder content(@StringRes int contentRes, Object... formatArgs) {
|
|
|
- content(this.context.getString(contentRes, formatArgs));
|
|
|
+ public Builder contentColorAttr(@AttrRes int colorAttr) {
|
|
|
+ contentColor(DialogUtils.resolveColor(this.context, colorAttr));
|
|
|
return this;
|
|
|
}
|
|
|
|
|
@@ -1088,6 +1089,20 @@ public class MaterialDialog extends DialogBase implements
|
|
|
return this;
|
|
|
}
|
|
|
|
|
|
+ public Builder itemColor(int color) {
|
|
|
+ this.itemColor = color;
|
|
|
+ this.itemColorSet = true;
|
|
|
+ return this;
|
|
|
+ }
|
|
|
+
|
|
|
+ public Builder itemColorRes(@ColorRes int colorRes) {
|
|
|
+ return itemColor(this.context.getResources().getColor(colorRes));
|
|
|
+ }
|
|
|
+
|
|
|
+ public Builder itemColorAttr(@AttrRes int colorAttr) {
|
|
|
+ return itemColor(DialogUtils.resolveColor(this.context, colorAttr));
|
|
|
+ }
|
|
|
+
|
|
|
public Builder itemsGravity(@NonNull GravityEnum gravity) {
|
|
|
this.itemsGravity = gravity;
|
|
|
return this;
|
|
@@ -1164,6 +1179,19 @@ public class MaterialDialog extends DialogBase implements
|
|
|
return this;
|
|
|
}
|
|
|
|
|
|
+ public Builder positiveColor(int color) {
|
|
|
+ this.positiveColor = color;
|
|
|
+ return this;
|
|
|
+ }
|
|
|
+
|
|
|
+ public Builder positiveColorRes(@ColorRes int colorRes) {
|
|
|
+ return positiveColor(this.context.getResources().getColor(colorRes));
|
|
|
+ }
|
|
|
+
|
|
|
+ public Builder positiveColorAttr(@AttrRes int colorAttr) {
|
|
|
+ return positiveColor(DialogUtils.resolveColor(this.context, colorAttr));
|
|
|
+ }
|
|
|
+
|
|
|
public Builder neutralText(@StringRes int neutralRes) {
|
|
|
return neutralText(this.context.getString(neutralRes));
|
|
|
}
|
|
@@ -1173,6 +1201,19 @@ public class MaterialDialog extends DialogBase implements
|
|
|
return this;
|
|
|
}
|
|
|
|
|
|
+ public Builder negativeColor(int color) {
|
|
|
+ this.negativeColor = color;
|
|
|
+ return this;
|
|
|
+ }
|
|
|
+
|
|
|
+ public Builder negativeColorRes(@ColorRes int colorRes) {
|
|
|
+ return negativeColor(this.context.getResources().getColor(colorRes));
|
|
|
+ }
|
|
|
+
|
|
|
+ public Builder negativeColorAttr(@AttrRes int colorAttr) {
|
|
|
+ return negativeColor(DialogUtils.resolveColor(this.context, colorAttr));
|
|
|
+ }
|
|
|
+
|
|
|
public Builder negativeText(@StringRes int negativeRes) {
|
|
|
return negativeText(this.context.getString(negativeRes));
|
|
|
}
|
|
@@ -1182,6 +1223,19 @@ public class MaterialDialog extends DialogBase implements
|
|
|
return this;
|
|
|
}
|
|
|
|
|
|
+ public Builder neutralColor(int color) {
|
|
|
+ this.neutralColor = color;
|
|
|
+ return this;
|
|
|
+ }
|
|
|
+
|
|
|
+ public Builder neutralColorRes(@ColorRes int colorRes) {
|
|
|
+ return neutralColor(this.context.getResources().getColor(colorRes));
|
|
|
+ }
|
|
|
+
|
|
|
+ public Builder neutralColorAttr(@AttrRes int colorAttr) {
|
|
|
+ return neutralColor(DialogUtils.resolveColor(this.context, colorAttr));
|
|
|
+ }
|
|
|
+
|
|
|
public Builder listSelector(@DrawableRes int selectorRes) {
|
|
|
this.listSelector = selectorRes;
|
|
|
return this;
|
|
@@ -1281,45 +1335,6 @@ public class MaterialDialog extends DialogBase implements
|
|
|
return progressColorRes(DialogUtils.resolveColor(this.context, colorAttr));
|
|
|
}
|
|
|
|
|
|
- public Builder positiveColor(int color) {
|
|
|
- this.positiveColor = color;
|
|
|
- return this;
|
|
|
- }
|
|
|
-
|
|
|
- public Builder positiveColorRes(@ColorRes int colorRes) {
|
|
|
- return positiveColor(this.context.getResources().getColor(colorRes));
|
|
|
- }
|
|
|
-
|
|
|
- public Builder positiveColorAttr(@AttrRes int colorAttr) {
|
|
|
- return positiveColor(DialogUtils.resolveColor(this.context, colorAttr));
|
|
|
- }
|
|
|
-
|
|
|
- public Builder negativeColor(int color) {
|
|
|
- this.negativeColor = color;
|
|
|
- return this;
|
|
|
- }
|
|
|
-
|
|
|
- public Builder negativeColorRes(@ColorRes int colorRes) {
|
|
|
- return negativeColor(this.context.getResources().getColor(colorRes));
|
|
|
- }
|
|
|
-
|
|
|
- public Builder negativeColorAttr(@AttrRes int colorAttr) {
|
|
|
- return negativeColor(DialogUtils.resolveColor(this.context, colorAttr));
|
|
|
- }
|
|
|
-
|
|
|
- public Builder neutralColor(int color) {
|
|
|
- this.neutralColor = color;
|
|
|
- return this;
|
|
|
- }
|
|
|
-
|
|
|
- public Builder neutralColorRes(@ColorRes int colorRes) {
|
|
|
- return neutralColor(this.context.getResources().getColor(colorRes));
|
|
|
- }
|
|
|
-
|
|
|
- public Builder neutralColorAttr(@AttrRes int colorAttr) {
|
|
|
- return neutralColor(DialogUtils.resolveColor(this.context, colorAttr));
|
|
|
- }
|
|
|
-
|
|
|
public Builder dividerColor(int color) {
|
|
|
this.dividerColor = color;
|
|
|
return this;
|
|
@@ -1346,19 +1361,6 @@ public class MaterialDialog extends DialogBase implements
|
|
|
return backgroundColor(DialogUtils.resolveColor(this.context, colorAttr));
|
|
|
}
|
|
|
|
|
|
- public Builder itemColor(int color) {
|
|
|
- this.itemColor = color;
|
|
|
- return this;
|
|
|
- }
|
|
|
-
|
|
|
- public Builder itemColorRes(@ColorRes int colorRes) {
|
|
|
- return itemColor(this.context.getResources().getColor(colorRes));
|
|
|
- }
|
|
|
-
|
|
|
- public Builder itemColorAttr(@AttrRes int colorAttr) {
|
|
|
- return itemColor(DialogUtils.resolveColor(this.context, colorAttr));
|
|
|
- }
|
|
|
-
|
|
|
public Builder callback(@NonNull ButtonCallback callback) {
|
|
|
this.callback = callback;
|
|
|
return this;
|