|
@@ -273,6 +273,23 @@ public class MaterialDialog extends DialogBase implements View.OnClickListener {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ int maxIconSize = builder.maxIconSize;
|
|
|
|
+ if (maxIconSize == -1) {
|
|
|
|
+ maxIconSize = DialogUtils.resolveDimension(mBuilder.context, R.attr.md_icon_max_size);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ boolean limitIconToDefaultSize = DialogUtils.resolveBoolean(mBuilder.context, R.attr.md_icon_limit_icon_to_default_size);
|
|
|
|
+ if (builder.limitIconToDefaultSize || limitIconToDefaultSize) {
|
|
|
|
+ maxIconSize = mBuilder.context.getResources().getDimensionPixelSize(R.dimen.md_icon_max_size);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (maxIconSize > -1) {
|
|
|
|
+ icon.setAdjustViewBounds(true);
|
|
|
|
+ icon.setMaxHeight(maxIconSize);
|
|
|
|
+ icon.setMaxWidth(maxIconSize);
|
|
|
|
+ icon.requestLayout();
|
|
|
|
+ }
|
|
|
|
+
|
|
if (builder.title == null) {
|
|
if (builder.title == null) {
|
|
titleFrame.setVisibility(View.GONE);
|
|
titleFrame.setVisibility(View.GONE);
|
|
} else {
|
|
} else {
|
|
@@ -917,6 +934,8 @@ public class MaterialDialog extends DialogBase implements View.OnClickListener {
|
|
protected Typeface mediumFont;
|
|
protected Typeface mediumFont;
|
|
protected boolean useCustomFonts;
|
|
protected boolean useCustomFonts;
|
|
protected Drawable icon;
|
|
protected Drawable icon;
|
|
|
|
+ protected boolean limitIconToDefaultSize;
|
|
|
|
+ protected int maxIconSize = -1;
|
|
protected ListAdapter adapter;
|
|
protected ListAdapter adapter;
|
|
protected OnDismissListener dismissListener;
|
|
protected OnDismissListener dismissListener;
|
|
protected OnCancelListener cancelListener;
|
|
protected OnCancelListener cancelListener;
|
|
@@ -1460,6 +1479,16 @@ public class MaterialDialog extends DialogBase implements View.OnClickListener {
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public Builder limitIconToDefaultSize() {
|
|
|
|
+ this.limitIconToDefaultSize = true;
|
|
|
|
+ return this;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public Builder maxIconSize(int maxIconSize) {
|
|
|
|
+ this.maxIconSize = maxIconSize;
|
|
|
|
+ return this;
|
|
|
|
+ }
|
|
|
|
+
|
|
public Builder showListener(@NonNull OnShowListener listener) {
|
|
public Builder showListener(@NonNull OnShowListener listener) {
|
|
this.showListener = listener;
|
|
this.showListener = listener;
|
|
return this;
|
|
return this;
|