Explorar el Código

0.0.49.beta1
- 修复 BlurRelativeLayout 和 BlurLinearLayout 在 iOS 主题下使用 DialogFragment 模式时存在的渲染宽度和高度 <=0 导致的异常(issues:324);

Kongzue hace 2 años
padre
commit
ce03352d9c

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

@@ -178,7 +178,7 @@ public abstract class BaseDialog implements LifecycleOwner {
                 publicWindowInsets(dialog.getRootFrameLayout().getRootWindowInsets());
             }
 
-            log(dialog.dialogKey() + ".show");
+            log(dialog.dialogKey() + ".show on " + dialog.getOwnActivity());
 
             addDialogToRunningList(dialog);
             switch (dialog.dialogImplMode) {
@@ -297,7 +297,7 @@ public abstract class BaseDialog implements LifecycleOwner {
                 publicWindowInsets(baseDialog.getRootFrameLayout().getRootWindowInsets());
             }
 
-            log(baseDialog + ".show");
+            log(baseDialog + ".show on " + activity);
             addDialogToRunningList(baseDialog);
 
             switch (baseDialog.dialogImplMode) {
@@ -526,11 +526,11 @@ public abstract class BaseDialog implements LifecycleOwner {
     public abstract boolean isCancelable();
 
     public View createView(int layoutId) {
-        if (getApplicationContext() == null) {
+        if (getOwnActivity() == null) {
             error("DialogX 未初始化(E3)。\n请检查是否在启动对话框前进行初始化操作,使用以下代码进行初始化:\nDialogX.init(context);\n\n另外建议您前往查看 DialogX 的文档进行使用:https://github.com/kongzue/DialogX");
             return null;
         }
-        return LayoutInflater.from(getApplicationContext()).inflate(layoutId, null);
+        return LayoutInflater.from(getOwnActivity()).inflate(layoutId, null);
     }
 
     public boolean isShow() {

+ 3 - 3
DialogX/src/main/java/com/kongzue/dialogx/util/views/DialogXBaseRelativeLayout.java

@@ -427,7 +427,7 @@ public class DialogXBaseRelativeLayout extends RelativeLayout {
 
     public DialogXBaseRelativeLayout setParentDialog(BaseDialog parentDialog) {
         this.parentDialog = parentDialog;
-        if (parentDialog!=null && parentDialog.getDialogImplMode() != DialogX.IMPL_MODE.VIEW) {
+        if (parentDialog != null && parentDialog.getDialogImplMode() != DialogX.IMPL_MODE.VIEW) {
             setFitsSystemWindows(true);
             if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
                 paddingView(getRootWindowInsets());
@@ -442,7 +442,7 @@ public class DialogXBaseRelativeLayout extends RelativeLayout {
     protected void onConfigurationChanged(Configuration newConfig) {
         super.onConfigurationChanged(newConfig);
         boolean newLightStatus = ((newConfig.uiMode & Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_NO);
-        if (isLightMode != newLightStatus && DialogX.globalTheme == DialogX.THEME.AUTO && getParentDialog()!=null) {
+        if (isLightMode != newLightStatus && DialogX.globalTheme == DialogX.THEME.AUTO && getParentDialog() != null) {
             getParentDialog().restartDialog();
         }
     }
@@ -526,7 +526,7 @@ public class DialogXBaseRelativeLayout extends RelativeLayout {
 
     protected void log(String s) {
         if (debugMode) {
-            Log.e(">>>" , s);
+            Log.e(">>>", s);
         }
     }
 }

+ 2 - 0
DialogXIOSStyle/src/main/java/com/kongzue/dialogx/style/views/BlurLinearLayout.java

@@ -415,6 +415,7 @@ public class BlurLinearLayout extends MaxLinearLayout implements BlurViewType {
     }
 
     private void drawBlurredBitmapCompat(Canvas canvas) {
+        if (getWidth() <= 0 || getHeight() <= 0) return;
         if (mBlurredBitmap != null) {
             mRectDst.right = getWidth();
             mRectDst.bottom = getHeight();
@@ -434,6 +435,7 @@ public class BlurLinearLayout extends MaxLinearLayout implements BlurViewType {
     }
 
     protected void drawBlurredBitmap(Canvas canvas, Bitmap blurredBitmap) {
+        if (getWidth() <= 0 || getHeight() <= 0) return;
         if (blurredBitmap != null) {
             mRectSrc.right = blurredBitmap.getWidth();
             mRectSrc.bottom = blurredBitmap.getHeight();

+ 3 - 1
DialogXIOSStyle/src/main/java/com/kongzue/dialogx/style/views/BlurRelativeLayout.java

@@ -415,6 +415,7 @@ public class BlurRelativeLayout extends MaxRelativeLayout implements BlurViewTyp
     }
 
     private void drawBlurredBitmapCompat(Canvas canvas) {
+        if (getWidth() <= 0 || getHeight() <= 0) return;
         if (mBlurredBitmap != null) {
             mRectDst.right = getWidth();
             mRectDst.bottom = getHeight();
@@ -434,6 +435,7 @@ public class BlurRelativeLayout extends MaxRelativeLayout implements BlurViewTyp
     }
 
     protected void drawBlurredBitmap(Canvas canvas, Bitmap blurredBitmap) {
+        if (getWidth() <= 0 || getHeight() <= 0) return;
         if (blurredBitmap != null) {
             mRectSrc.right = blurredBitmap.getWidth();
             mRectSrc.bottom = blurredBitmap.getHeight();
@@ -571,7 +573,7 @@ public class BlurRelativeLayout extends MaxRelativeLayout implements BlurViewTyp
         return (int) (dpValue * scale + 0.5f);
     }
 
-    private int getOverlayColor(){
+    private int getOverlayColor() {
         return needRemoveAlphaColor() ? removeAlphaColor(mOverlayColor) : mOverlayColor;
     }
 }

+ 0 - 1
DialogXMaterialYou/src/main/res/layout/layout_dialogx_material_you.xml

@@ -18,7 +18,6 @@
             android:layout_centerInParent="true"
             android:layout_marginLeft="35dp"
             android:layout_marginRight="35dp"
-
             android:background="@drawable/rect_dialogx_material_you_bkg_light"
             android:elevation="27dp">
 

+ 2 - 2
app/release/output-metadata.json

@@ -11,8 +11,8 @@
       "type": "SINGLE",
       "filters": [],
       "attributes": [],
-      "versionCode": 47,
-      "versionName": "0.0.48.beta24",
+      "versionCode": 48,
+      "versionName": "0.0.48",
       "outputFile": "app-release.apk"
     }
   ],

+ 31 - 29
app/src/main/res/layout/activity_main.xml

@@ -22,11 +22,11 @@
             android:layout_width="wrap_content"
             android:layout_height="50dp"
             android:layout_centerHorizontal="true"
+            android:fontFamily="sans-serif-black"
             android:gravity="center"
             android:text="Kongzue DialogX"
             android:textColor="#dc000000"
             android:textSize="16dp"
-            android:fontFamily="sans-serif-black"
             android:textStyle="bold"
             app:layout_constraintBottom_toBottomOf="parent"
             app:layout_constraintLeft_toLeftOf="parent"
@@ -90,6 +90,7 @@
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
                 android:fadingEdge="horizontal"
+                android:overScrollMode="never"
                 android:requiresFadingEdge="horizontal"
                 android:scrollbars="none">
 
@@ -202,6 +203,7 @@
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
                 android:fadingEdge="horizontal"
+                android:overScrollMode="never"
                 android:requiresFadingEdge="horizontal"
                 android:scrollbars="none">
 
@@ -270,13 +272,13 @@
                     android:layout_marginTop="15dp"
                     android:paddingLeft="15dp"
                     android:paddingTop="10dp"
-                    app:icon="@mipmap/img_button_messagedialog"
                     android:paddingRight="15dp"
                     android:paddingBottom="10dp"
                     android:text="消息对话框"
                     android:textSize="13dp"
                     android:textStyle="bold"
-                    app:cornerRadius="99dp" />
+                    app:cornerRadius="99dp"
+                    app:icon="@mipmap/img_button_messagedialog" />
 
                 <com.google.android.material.button.MaterialButton
                     android:id="@+id/btn_selectDialog"
@@ -288,12 +290,12 @@
                     android:paddingTop="10dp"
                     android:paddingRight="15dp"
                     android:paddingBottom="10dp"
-                    app:icon="@mipmap/img_button_selectdialog"
                     android:text="选择对话框"
                     android:textColor="@color/white"
                     android:textSize="13dp"
                     android:textStyle="bold"
-                    app:cornerRadius="99dp" />
+                    app:cornerRadius="99dp"
+                    app:icon="@mipmap/img_button_selectdialog" />
 
                 <com.google.android.material.button.MaterialButton
                     android:id="@+id/btn_inputDialog"
@@ -302,7 +304,6 @@
                     android:layout_margin="5dp"
                     android:layout_marginTop="15dp"
                     android:paddingLeft="15dp"
-                    app:icon="@mipmap/img_button_inputdialog"
                     android:paddingTop="10dp"
                     android:paddingRight="15dp"
                     android:paddingBottom="10dp"
@@ -310,7 +311,8 @@
                     android:textColor="@color/white"
                     android:textSize="13dp"
                     android:textStyle="bold"
-                    app:cornerRadius="99dp" />
+                    app:cornerRadius="99dp"
+                    app:icon="@mipmap/img_button_inputdialog" />
 
             </com.kongzue.stacklabelview.StackLayout>
 
@@ -336,20 +338,19 @@
                     android:paddingLeft="15dp"
                     android:paddingTop="10dp"
                     android:paddingRight="15dp"
-                    app:icon="@mipmap/img_button_waiting"
                     android:paddingBottom="10dp"
                     android:text="等待对话框"
                     android:textColor="@color/white"
                     android:textSize="13dp"
                     android:textStyle="bold"
-                    app:cornerRadius="99dp" />
+                    app:cornerRadius="99dp"
+                    app:icon="@mipmap/img_button_waiting" />
 
                 <com.google.android.material.button.MaterialButton
                     android:id="@+id/btn_waitAndTipDialog"
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
                     android:layout_margin="5dp"
-                    app:icon="@mipmap/img_button_alert"
                     android:paddingLeft="15dp"
                     android:paddingTop="10dp"
                     android:paddingRight="15dp"
@@ -358,7 +359,8 @@
                     android:textColor="@color/white"
                     android:textSize="13dp"
                     android:textStyle="bold"
-                    app:cornerRadius="99dp" />
+                    app:cornerRadius="99dp"
+                    app:icon="@mipmap/img_button_alert" />
 
             </com.kongzue.stacklabelview.StackLayout>
 
@@ -376,19 +378,18 @@
                     android:paddingTop="10dp"
                     android:paddingRight="15dp"
                     android:paddingBottom="10dp"
-                    app:icon="@mipmap/img_button_right"
                     android:text="完成"
                     android:textColor="@color/white"
                     android:textSize="13dp"
                     android:textStyle="bold"
-                    app:cornerRadius="99dp" />
+                    app:cornerRadius="99dp"
+                    app:icon="@mipmap/img_button_right" />
 
                 <com.google.android.material.button.MaterialButton
                     android:id="@+id/btn_tipWarning"
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
                     android:layout_margin="5dp"
-                    app:icon="@mipmap/img_button_warning"
                     android:paddingLeft="15dp"
                     android:paddingTop="10dp"
                     android:paddingRight="15dp"
@@ -397,13 +398,13 @@
                     android:textColor="@color/white"
                     android:textSize="13dp"
                     android:textStyle="bold"
-                    app:cornerRadius="99dp" />
+                    app:cornerRadius="99dp"
+                    app:icon="@mipmap/img_button_warning" />
 
                 <com.google.android.material.button.MaterialButton
                     android:id="@+id/btn_tipError"
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
-                    app:icon="@mipmap/img_button_error"
                     android:layout_margin="5dp"
                     android:paddingLeft="15dp"
                     android:paddingTop="10dp"
@@ -413,7 +414,8 @@
                     android:textColor="@color/white"
                     android:textSize="13dp"
                     android:textStyle="bold"
-                    app:cornerRadius="99dp" />
+                    app:cornerRadius="99dp"
+                    app:icon="@mipmap/img_button_error" />
 
                 <com.google.android.material.button.MaterialButton
                     android:id="@+id/btn_tipProgress"
@@ -424,12 +426,12 @@
                     android:paddingTop="10dp"
                     android:paddingRight="15dp"
                     android:paddingBottom="10dp"
-                    app:icon="@mipmap/img_button_progressing"
                     android:text="模拟进度"
                     android:textColor="@color/white"
                     android:textSize="13dp"
                     android:textStyle="bold"
-                    app:cornerRadius="99dp" />
+                    app:cornerRadius="99dp"
+                    app:icon="@mipmap/img_button_progressing" />
 
             </com.kongzue.stacklabelview.StackLayout>
 
@@ -457,18 +459,17 @@
                     android:paddingRight="15dp"
                     android:paddingBottom="10dp"
                     android:text="轻量消息提示"
-                    app:icon="@mipmap/img_button_simple_poptip"
                     android:textColor="@color/white"
                     android:textSize="13dp"
                     android:textStyle="bold"
-                    app:cornerRadius="99dp" />
+                    app:cornerRadius="99dp"
+                    app:icon="@mipmap/img_button_simple_poptip" />
 
                 <com.google.android.material.button.MaterialButton
                     android:id="@+id/btn_poptip_bigMessage"
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
                     android:layout_margin="5dp"
-                    app:icon="@mipmap/img_button_big_poptip"
                     android:paddingLeft="15dp"
                     android:paddingTop="10dp"
                     android:paddingRight="15dp"
@@ -477,7 +478,8 @@
                     android:textColor="@color/white"
                     android:textSize="13dp"
                     android:textStyle="bold"
-                    app:cornerRadius="99dp" />
+                    app:cornerRadius="99dp"
+                    app:icon="@mipmap/img_button_big_poptip" />
 
             </com.kongzue.stacklabelview.StackLayout>
 
@@ -495,19 +497,18 @@
                     android:paddingTop="10dp"
                     android:paddingRight="15dp"
                     android:paddingBottom="10dp"
-                    app:icon="@mipmap/img_button_right"
                     android:text="完成"
                     android:textColor="@color/white"
                     android:textSize="13dp"
                     android:textStyle="bold"
-                    app:cornerRadius="99dp" />
+                    app:cornerRadius="99dp"
+                    app:icon="@mipmap/img_button_right" />
 
                 <com.google.android.material.button.MaterialButton
                     android:id="@+id/btn_poptip_warning"
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
                     android:layout_margin="5dp"
-                    app:icon="@mipmap/img_button_warning"
                     android:paddingLeft="15dp"
                     android:paddingTop="10dp"
                     android:paddingRight="15dp"
@@ -516,14 +517,14 @@
                     android:textColor="@color/white"
                     android:textSize="13dp"
                     android:textStyle="bold"
-                    app:cornerRadius="99dp" />
+                    app:cornerRadius="99dp"
+                    app:icon="@mipmap/img_button_warning" />
 
                 <com.google.android.material.button.MaterialButton
                     android:id="@+id/btn_poptip_error"
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
                     android:layout_margin="5dp"
-                    app:icon="@mipmap/img_button_error"
                     android:paddingLeft="15dp"
                     android:paddingTop="10dp"
                     android:paddingRight="15dp"
@@ -532,7 +533,8 @@
                     android:textColor="@color/white"
                     android:textSize="13dp"
                     android:textStyle="bold"
-                    app:cornerRadius="99dp" />
+                    app:cornerRadius="99dp"
+                    app:icon="@mipmap/img_button_error" />
 
             </com.kongzue.stacklabelview.StackLayout>
 

+ 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.48
+BUILD_VERSION=0.0.49.beta1
 BUILD_VERSION_INT=48
 DIALOGX_STYLE_VERSION=5
 android.nonTransitiveRClass=true