Explorar o código

0.0.43.beta10

kongzue %!s(int64=3) %!d(string=hai) anos
pai
achega
0d7a1e41c7

+ 3 - 2
DialogX/src/main/java/com/kongzue/dialogx/DialogX.java

@@ -1,6 +1,7 @@
 package com.kongzue.dialogx;
 
 import android.content.Context;
+import android.graphics.Color;
 import android.util.Log;
 
 import com.kongzue.dialogx.interfaces.BaseDialog;
@@ -118,10 +119,10 @@ public class DialogX {
     public static boolean useActivityLayoutTranslationNavigationBar = false;
     
     /**
-     * 新增属性 `DialogX.noTranslation_for_a_man_custom` 在不适用沉浸式的情况下开启此选项,BottomDialog 的导航栏部分将不会沉浸式(对话框内容布局不会叠加在导航栏下)
+     * 设置 BottomDialog 导航栏背景颜色
      * 彩蛋:a_man 私人定制款属性
      */
-    public static boolean noTranslation_for_a_man_custom = true;
+    public static int bottomDialogNavbarColor = Color.TRANSPARENT;
     
     public enum THEME {
         LIGHT, DARK, AUTO

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

@@ -215,22 +215,8 @@ 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()) {
-                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);
-                    }
-                }
+                bkgView.setPadding(0, 0, 0, bottom);
+                bkgView.setNavBarHeight(bottom);
                 setPadding(left, top, right, 0);
                 return;
             }

+ 20 - 0
DialogX/src/main/java/com/kongzue/dialogx/util/views/MaxRelativeLayout.java

@@ -190,6 +190,26 @@ public class MaxRelativeLayout extends RelativeLayout {
     
     private OnYChanged onYChangedListener;
     
+    int navBarHeight;
+    Paint navBarPaint;
+    
+    public void setNavBarHeight(int height) {
+        navBarHeight = height;
+        invalidate();
+    }
+    
+    @Override
+    protected void onDraw(Canvas canvas) {
+        super.onDraw(canvas);
+        if (navBarHeight != 0 && DialogX.bottomDialogNavbarColor != 0) {
+            if (navBarPaint == null) {
+                navBarPaint = new Paint();
+                navBarPaint.setColor(DialogX.bottomDialogNavbarColor);
+            }
+            canvas.drawRect(0, getHeight() - navBarHeight, getWidth(), getHeight(), navBarPaint);
+        }
+    }
+    
     public interface OnYChanged {
         void y(float y);
     }

+ 2 - 0
app/src/main/java/com/kongzue/dialogxdemo/App.java

@@ -1,5 +1,7 @@
 package com.kongzue.dialogxdemo;
 
+import android.graphics.Color;
+
 import com.kongzue.baseframework.BaseApp;
 import com.kongzue.dialogx.DialogX;
 import com.kongzue.dialogx.style.MaterialStyle;

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

@@ -696,7 +696,7 @@ public class MainActivity extends BaseActivity {
         btnShowBreak.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View v) {
-                jump(MainActivity.class, new JumpParameter().put("showBreak", true).put("fromActivity", getInstanceKey()));
+                jump(AppCompatActivityTest.class, new JumpParameter().put("showBreak", true).put("fromActivity", getInstanceKey()));
             }
         });
         

+ 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.beta9
+BUILD_VERSION=0.0.43.beta10
 BUILD_VERSION_INT=42