Kaynağa Gözat

0.0.50.beta1
- 新增 DialogX.defaultMessageDialogBackgroundRadius 用于全局指定消息对话框默认圆角;
- 新增 DialogX.defaultBottomDialogBackgroundRadius 用于全局指定底部对话框默认圆角;
- 新增 DialogX.defaultFullScreenDialogBackgroundRadius 用于全局指定全屏对话框默认圆角;
- 新增 DialogX.defaultWaitAndTipDialogBackgroundRadius 用于全局指定等待提示对话框默认圆角;
- 新增 DialogX.defaultPopMenuBackgroundRadius 用于全局指定菜单默认圆角;
- 新增 DialogX.defaultPopTipBackgroundRadius 用于全局指定提示默认圆角;
- 新增 DialogX.defaultPopNotificationBackgroundRadius 用于全局指定通知消息默认圆角;
- 修复引发的圆角设置相关问题;

Kongzue 1 yıl önce
ebeveyn
işleme
f3db0a7fd6

+ 14 - 0
DialogX/src/main/java/com/kongzue/dialogx/DialogX.java

@@ -150,6 +150,20 @@ public class DialogX {
             "com.mobile.auth.gatewayauth",
             "com.google.android.gms.ads"
     };
+
+    public static int defaultMessageDialogBackgroundRadius = -1;
+
+    public static int defaultBottomDialogBackgroundRadius = -1;
+
+    public static int defaultFullScreenDialogBackgroundRadius = -1;
+
+    public static int defaultWaitAndTipDialogBackgroundRadius = -1;
+
+    public static int defaultPopMenuBackgroundRadius = -1;
+
+    public static int defaultPopTipBackgroundRadius = -1;
+
+    public static int defaultPopNotificationBackgroundRadius = -1;
     
     public enum THEME {
         LIGHT, DARK, AUTO

+ 7 - 5
DialogX/src/main/java/com/kongzue/dialogx/dialogs/BottomDialog.java

@@ -75,7 +75,7 @@ public class BottomDialog extends BaseDialog implements DialogXBaseBottomDialog
     protected OnBackPressedListener<BottomDialog> onBackPressedListener;
     protected BOOLEAN privateCancelable;
     protected boolean bkgInterceptTouch = true;
-    protected float backgroundRadius = -1;
+    protected float backgroundRadius = DialogX.defaultBottomDialogBackgroundRadius;
     protected Drawable titleIcon;
     protected DialogXAnimInterface<BottomDialog> dialogXAnimImpl;
     protected BUTTON_SELECT_RESULT buttonSelectResult = BUTTON_SELECT_RESULT.NONE;
@@ -558,10 +558,12 @@ public class BottomDialog extends BaseDialog implements DialogXBaseBottomDialog
                 }
             });
             if (backgroundRadius > -1) {
-                GradientDrawable gradientDrawable = (GradientDrawable) bkg.getBackground();
-                if (gradientDrawable != null) gradientDrawable.setCornerRadii(new float[]{
-                        backgroundRadius, backgroundRadius, backgroundRadius, backgroundRadius, 0, 0, 0, 0
-                });
+                if (bkg.getBackground() instanceof GradientDrawable) {
+                    GradientDrawable gradientDrawable = (GradientDrawable) bkg.getBackground();
+                    if (gradientDrawable != null) gradientDrawable.setCornerRadii(new float[]{
+                            backgroundRadius, backgroundRadius, backgroundRadius, backgroundRadius, 0, 0, 0, 0
+                    });
+                }
                 if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
                     bkg.setOutlineProvider(new ViewOutlineProvider() {
                         @Override

+ 7 - 5
DialogX/src/main/java/com/kongzue/dialogx/dialogs/FullScreenDialog.java

@@ -59,7 +59,7 @@ public class FullScreenDialog extends BaseDialog implements DialogXBaseBottomDia
     protected OnBackPressedListener<FullScreenDialog> onBackPressedListener;
     protected BOOLEAN privateCancelable;
     protected boolean hideZoomBackground;
-    protected float backgroundRadius = -1;
+    protected float backgroundRadius = DialogX.defaultFullScreenDialogBackgroundRadius;
     protected float activityContentRadius = ACTIVITY_CONTENT_RADIUS_DEFAULT;
     protected boolean allowInterceptTouch = true;
     protected DialogXAnimInterface<FullScreenDialog> dialogXAnimImpl;
@@ -341,10 +341,12 @@ public class FullScreenDialog extends BaseDialog implements DialogXBaseBottomDia
                 boxRoot.setOnClickListener(null);
             }
             if (backgroundRadius > -1) {
-                GradientDrawable gradientDrawable = (GradientDrawable) bkg.getBackground();
-                if (gradientDrawable != null) gradientDrawable.setCornerRadii(new float[]{
-                        backgroundRadius, backgroundRadius, backgroundRadius, backgroundRadius, 0, 0, 0, 0
-                });
+                if (bkg.getBackground() instanceof GradientDrawable) {
+                    GradientDrawable gradientDrawable = (GradientDrawable) bkg.getBackground();
+                    if (gradientDrawable != null) gradientDrawable.setCornerRadii(new float[]{
+                            backgroundRadius, backgroundRadius, backgroundRadius, backgroundRadius, 0, 0, 0, 0
+                    });
+                }
                 if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
                     bkg.setOutlineProvider(new ViewOutlineProvider() {
                         @Override

+ 1 - 1
DialogX/src/main/java/com/kongzue/dialogx/dialogs/MessageDialog.java

@@ -99,7 +99,7 @@ public class MessageDialog extends BaseDialog {
     protected String inputText;
     protected String inputHintText;
     protected Integer maskColor = null;
-    protected float backgroundRadius = -1;
+    protected float backgroundRadius = DialogX.defaultMessageDialogBackgroundRadius;
     protected Drawable titleIcon;
 
     protected TextInfo titleTextInfo;

+ 6 - 3
DialogX/src/main/java/com/kongzue/dialogx/dialogs/PopMenu.java

@@ -79,7 +79,7 @@ public class PopMenu extends BaseDialog {
     protected int height = -1;                                              //指定菜单高度
     protected TextInfo menuTextInfo;
     protected boolean offScreen = false;                                    //超出屏幕
-    protected float backgroundRadius = -1;
+    protected float backgroundRadius = DialogX.defaultPopMenuBackgroundRadius;
     protected DialogXAnimInterface<PopMenu> dialogXAnimImpl;
     protected OnBackPressedListener<PopMenu> onBackPressedListener;
     protected MenuItemLayoutRefreshCallback<PopMenu> menuMenuItemLayoutRefreshCallback;
@@ -587,8 +587,11 @@ public class PopMenu extends BaseDialog {
             }
 
             if (backgroundRadius > -1) {
-                GradientDrawable gradientDrawable = (GradientDrawable) boxBody.getBackground();
-                if (gradientDrawable != null) gradientDrawable.setCornerRadius(backgroundRadius);
+                if (boxBody.getBackground() instanceof GradientDrawable) {
+                    GradientDrawable gradientDrawable = (GradientDrawable) boxBody.getBackground();
+                    if (gradientDrawable != null)
+                        gradientDrawable.setCornerRadius(backgroundRadius);
+                }
                 if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
                     boxBody.setOutlineProvider(new ViewOutlineProvider() {
                         @Override

+ 6 - 3
DialogX/src/main/java/com/kongzue/dialogx/dialogs/PopNotification.java

@@ -77,7 +77,7 @@ public class PopNotification extends BaseDialog implements NoTouchInterface {
     protected OnDialogButtonClickListener<PopNotification> onPopNotificationClickListener;
     protected boolean autoTintIconInLightOrDarkMode = true;
     protected BOOLEAN tintIcon;
-    protected float backgroundRadius = -1;
+    protected float backgroundRadius = DialogX.defaultPopNotificationBackgroundRadius;
     protected DialogXAnimInterface<PopNotification> dialogXAnimImpl;
 
     protected int iconResId;
@@ -699,8 +699,11 @@ public class PopNotification extends BaseDialog implements NoTouchInterface {
             }
 
             if (backgroundRadius > -1) {
-                GradientDrawable gradientDrawable = (GradientDrawable) boxBody.getBackground();
-                if (gradientDrawable != null) gradientDrawable.setCornerRadius(backgroundRadius);
+                if (boxBody.getBackground() instanceof GradientDrawable) {
+                    GradientDrawable gradientDrawable = (GradientDrawable) boxBody.getBackground();
+                    if (gradientDrawable != null)
+                        gradientDrawable.setCornerRadius(backgroundRadius);
+                }
                 if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
                     boxBody.setOutlineProvider(new ViewOutlineProvider() {
                         @Override

+ 6 - 3
DialogX/src/main/java/com/kongzue/dialogx/dialogs/PopTip.java

@@ -75,7 +75,7 @@ public class PopTip extends BaseDialog implements NoTouchInterface {
     protected OnDialogButtonClickListener<PopTip> onButtonClickListener;
     protected OnDialogButtonClickListener<PopTip> onPopTipClickListener;
     protected BOOLEAN tintIcon;
-    protected float backgroundRadius = -1;
+    protected float backgroundRadius = DialogX.defaultPopTipBackgroundRadius;
     protected DialogXAnimInterface<PopTip> dialogXAnimImpl;
 
     protected int iconResId;
@@ -646,8 +646,11 @@ public class PopTip extends BaseDialog implements NoTouchInterface {
             }
 
             if (backgroundRadius > -1) {
-                GradientDrawable gradientDrawable = (GradientDrawable) boxBody.getBackground();
-                if (gradientDrawable != null) gradientDrawable.setCornerRadius(backgroundRadius);
+                if (boxBody.getBackground() instanceof GradientDrawable) {
+                    GradientDrawable gradientDrawable = (GradientDrawable) boxBody.getBackground();
+                    if (gradientDrawable != null)
+                        gradientDrawable.setCornerRadius(backgroundRadius);
+                }
                 if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
                     boxBody.setOutlineProvider(new ViewOutlineProvider() {
                         @Override

+ 1 - 1
DialogX/src/main/java/com/kongzue/dialogx/dialogs/WaitDialog.java

@@ -65,7 +65,7 @@ public class WaitDialog extends BaseDialog {
     protected OnBindView<WaitDialog> onBindView;
     protected int customEnterAnimResId;
     protected int customExitAnimResId;
-    protected float backgroundRadius = -1;
+    protected float backgroundRadius = DialogX.defaultWaitAndTipDialogBackgroundRadius;
     protected DialogXAnimInterface<WaitDialog> dialogXAnimImpl;
     protected OnBackPressedListener<WaitDialog> onBackPressedListener;
 

+ 1 - 1
gradle.properties

@@ -19,7 +19,7 @@ android.useAndroidX=true
 # Automatically convert third-party libraries to use AndroidX
 android.enableJetifier=true
 
-BUILD_VERSION=0.0.49
+BUILD_VERSION=0.0.50.beta1
 BUILD_VERSION_INT=49
 DIALOGX_STYLE_VERSION=5
 android.nonTransitiveRClass=true