瀏覽代碼

0.0.48.beta31
- 修复 WaitDialog 在通过自定义主题指定背景颜色、圆角无效的问题;

Kongzue 2 年之前
父節點
當前提交
25aa490c91

+ 6 - 6
.idea/compiler.xml

@@ -2,12 +2,12 @@
 <project version="4">
   <component name="CompilerConfiguration">
     <bytecodeTargetLevel target="1.7">
-      <module name="DialogXDemo.app" target="11" />
-      <module name="DialogXDemo.DialogX" target="11" />
-      <module name="DialogXDemo.DialogXIOSStyle" target="11" />
-      <module name="DialogXDemo.DialogXKongzueStyle" target="11" />
-      <module name="DialogXDemo.DialogXMaterialYou" target="11" />
-      <module name="DialogXDemo.DialogXMIUIStyle" target="11" />
+      <module name="DialogXDemo.app" target="17" />
+      <module name="DialogXDemo.DialogX" target="17" />
+      <module name="DialogXDemo.DialogXIOSStyle" target="17" />
+      <module name="DialogXDemo.DialogXKongzueStyle" target="17" />
+      <module name="DialogXDemo.DialogXMaterialYou" target="17" />
+      <module name="DialogXDemo.DialogXMIUIStyle" target="17" />
       <module name="DialogXInterface" target="1.7" />
     </bytecodeTargetLevel>
   </component>

+ 1 - 2
.idea/misc.xml

@@ -1,4 +1,3 @@
-<?xml version="1.0" encoding="UTF-8"?>
 <project version="4">
   <component name="DesignSurface">
     <option name="filePathToZoomLevelMap">
@@ -347,7 +346,7 @@
       </value>
     </option>
   </component>
-  <component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="11" project-jdk-type="JavaSDK">
+  <component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="jbr-17" project-jdk-type="JavaSDK">
     <output url="file://$PROJECT_DIR$/build/classes" />
   </component>
   <component name="ProjectType">

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

@@ -342,7 +342,9 @@ public class WaitDialog extends BaseDialog {
             Float dialogXRadius = (float) dip2px(15);
             if (style.overrideWaitTipRes() != null) {
                 dialogXRadius = getFloatStyleAttr((float) style.overrideWaitTipRes().overrideRadiusPx(), dialogXRadius);
-                blurFrontColor = getColorNullable(getIntStyleAttr(style.overrideWaitTipRes().overrideBackgroundColorRes(isLightTheme()), isLightTheme() ? R.color.dialogxWaitBkgDark : R.color.dialogxWaitBkgLight), blurFrontColor);
+                blurFrontColor = getColorNullable(
+                        getIntStyleAttr(style.overrideWaitTipRes().overrideBackgroundColorRes(isLightTheme()), isLightTheme() ? R.color.dialogxWaitBkgDark : R.color.dialogxWaitBkgLight),
+                        blurFrontColor);
             }
             if (blurViews != null) {
                 for (View blurView : blurViews) {
@@ -352,7 +354,7 @@ public class WaitDialog extends BaseDialog {
             } else {
                 GradientDrawable gradientDrawable = (GradientDrawable) getResources().getDrawable(R.drawable.rect_dialogx_material_wait_bkg);
                 gradientDrawable.setColor(blurFrontColor);
-                gradientDrawable.setGradientRadius(dialogXRadius);
+                gradientDrawable.setCornerRadius(dialogXRadius);
                 bkg.setBackground(gradientDrawable);
             }
             boxRoot.setClickable(true);

+ 12 - 6
DialogX/src/main/java/com/kongzue/dialogx/interfaces/BaseDialog.java

@@ -718,12 +718,12 @@ public abstract class BaseDialog implements LifecycleOwner {
         return getResources().getColor(backgroundRes);
     }
 
-    protected Integer getColorNullable(Integer res){
-        return res == null ?null:getColor(res);
+    protected Integer getColorNullable(Integer res) {
+        return res == null ? null : getColor(res);
     }
 
-    protected Integer getColorNullable(Integer res,Integer defaultResId){
-        return res == null ?defaultResId:getColor(res);
+    protected Integer getColorNullable(Integer res, Integer defaultResId) {
+        return res == null ? getColor(defaultResId) : getColor(res);
     }
 
     public enum BOOLEAN {
@@ -1007,7 +1007,13 @@ public abstract class BaseDialog implements LifecycleOwner {
         return styleValue <= 0 ? null : styleValue;
     }
 
-    protected Float getFloatStyleAttr(Float styleValue,Float defaultValue) {
-        return styleValue <= 0 ? defaultValue : styleValue;
+    protected Float getFloatStyleAttr(Float styleValue, Float defaultValue) {
+        if (styleValue <= 0) {
+            log("styleValue=" + styleValue + "<=0 ");
+            log("return defaultValue=" + defaultValue);
+            return defaultValue;
+        }
+        log("return styleValue=" + styleValue);
+        return styleValue;
     }
 }

+ 7 - 1
DialogXMaterialYou/src/main/java/com/kongzue/dialogxmaterialyou/style/MaterialYouStyle.java

@@ -1,6 +1,7 @@
 package com.kongzue.dialogxmaterialyou.style;
 
 import android.content.Context;
+import android.content.res.Resources;
 
 import com.kongzue.dialogx.interfaces.DialogXStyle;
 import com.kongzue.dialogx.interfaces.ProgressViewInterface;
@@ -117,7 +118,7 @@ public class MaterialYouStyle extends DialogXStyle {
 
         @Override
         public int overrideRadiusPx() {
-            return -1;
+            return dip2px(50);
         }
 
         @Override
@@ -140,6 +141,11 @@ public class MaterialYouStyle extends DialogXStyle {
             return new ProgressView(context);
         }
     }
+
+    private int dip2px(float dpValue) {
+        final float scale = Resources.getSystem().getDisplayMetrics().density;
+        return (int) (dpValue * scale + 0.5f);
+    }
     
     @Override
     public BottomDialogRes overrideBottomDialogRes() {

+ 1 - 0
app/src/main/java/com/kongzue/dialogxdemo/activity/MainActivity.java

@@ -16,6 +16,7 @@ import android.os.Handler;
 import android.os.Looper;
 import android.provider.Settings;
 import android.view.Gravity;
+import android.view.LayoutInflater;
 import android.view.MotionEvent;
 import android.view.View;
 import android.view.ViewGroup;