Kaynağa Gözat

0.0.43.beta9

kongzue 3 yıl önce
ebeveyn
işleme
b2aec6f601

BIN
DialogX/libs/DialogXInterface.jar


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

@@ -117,6 +117,12 @@ public class DialogX {
     @Deprecated
     public static boolean useActivityLayoutTranslationNavigationBar = false;
     
+    /**
+     * 不适用沉浸式的情况下请开启此选项,导航栏部分将显示为黑色背景
+     * 彩蛋:a_man 私人定制款属性
+     */
+    public static boolean noTranslation_for_a_man_custom = true;
+    
     public enum THEME {
         LIGHT, DARK, AUTO
     }

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

@@ -4,6 +4,9 @@ import android.app.Activity;
 import android.content.Context;
 import android.content.res.Configuration;
 import android.content.res.TypedArray;
+import android.graphics.Canvas;
+import android.graphics.Color;
+import android.graphics.Paint;
 import android.graphics.Rect;
 import android.os.Build;
 import android.util.AttributeSet;
@@ -212,7 +215,22 @@ public class DialogXBaseRelativeLayout extends RelativeLayout {
         if (bkgView != null && bkgView.getLayoutParams() instanceof LayoutParams) {
             LayoutParams bkgLp = (LayoutParams) bkgView.getLayoutParams();
             if (bkgLp.getRules()[ALIGN_PARENT_BOTTOM] == RelativeLayout.TRUE && isAutoUnsafePlacePadding()) {
-                bkgView.setPadding(0, 0, 0, bottom);
+                if (!DialogX.noTranslation_for_a_man_custom) {
+                    bkgView.setPadding(0, 0, 0, bottom);
+                } else {
+                    View boxBkg = findViewById(R.id.box_bkg);
+                    BottomDialogScrollView scrollView = findViewById(R.id.scrollView);
+                    if (!scrollView.isCanScroll()){
+                        if (boxBkg.getPaddingBottom() == 0) {
+                            boxBkg.setPadding(0, 0, 0, bottom);
+                        } else {
+                            bkgView.setPadding(0, 0, 0, bottom);
+                        }
+                    }else{
+                        boxBkg.setPadding(0, 0, 0, 0);
+                        bkgView.setPadding(0, 0, 0, bottom);
+                    }
+                }
                 setPadding(left, top, right, 0);
                 return;
             }

+ 2 - 7
DialogX/src/main/java/com/kongzue/dialogx/util/views/MaxLinearLayout.java

@@ -43,11 +43,6 @@ public class MaxLinearLayout extends LinearLayout {
         init(context, attrs);
     }
     
-    public MaxLinearLayout(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
-        super(context, attrs, defStyleAttr, defStyleRes);
-        init(context, attrs);
-    }
-    
     private void init(Context context, AttributeSet attrs) {
         if (attrs != null) {
             TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.DialogXMaxLayout);
@@ -86,10 +81,10 @@ public class MaxLinearLayout extends LinearLayout {
             preWidth = widthSize;
         }
         if (maxHeight > 0) {
-            heightSize = Math.min(heightSize, maxHeight);
+            heightSize = Math.max(heightSize, maxHeight);
         }
         if (maxWidth > 0) {
-            widthSize = Math.min(widthSize, maxWidth);
+            widthSize = Math.max(widthSize, maxWidth);
         }
         View blurView = findViewWithTag("blurView");
         View contentView = findViewWithoutTag("blurView");

+ 6 - 2
DialogX/src/main/java/com/kongzue/dialogx/util/views/MaxRelativeLayout.java

@@ -3,6 +3,9 @@ package com.kongzue.dialogx.util.views;
 import android.animation.ValueAnimator;
 import android.content.Context;
 import android.content.res.TypedArray;
+import android.graphics.Canvas;
+import android.graphics.Color;
+import android.graphics.Paint;
 import android.os.Build;
 import android.util.AttributeSet;
 import android.util.Log;
@@ -12,6 +15,7 @@ import android.view.ViewParent;
 import android.widget.RelativeLayout;
 import android.widget.ScrollView;
 
+import com.kongzue.dialogx.DialogX;
 import com.kongzue.dialogx.R;
 
 import static android.view.View.MeasureSpec.EXACTLY;
@@ -107,10 +111,10 @@ public class MaxRelativeLayout extends RelativeLayout {
             maxWidth = Math.min(maxWidth, Math.min(widthSize, preWidth));
         }
         if (maxHeight > 0) {
-            heightSize = Math.min(heightSize, maxHeight);
+            heightSize = Math.max(heightSize, maxHeight);
         }
         if (maxWidth > 0) {
-            widthSize = Math.min(widthSize, maxWidth);
+            widthSize = Math.max(widthSize, maxWidth);
         }
         View blurView = findViewWithTag("blurView");
         View contentView = findViewWithoutTag("blurView");

+ 1 - 1
gradle.properties

@@ -18,5 +18,5 @@ android.useAndroidX=true
 # Automatically convert third-party libraries to use AndroidX
 android.enableJetifier=true
 
-BUILD_VERSION=0.0.43.beta8
+BUILD_VERSION=0.0.43.beta9
 BUILD_VERSION_INT=42