浏览代码

0.0.47.beta18 update

kongzue 2 年之前
父节点
当前提交
86fb71c641
共有 2 个文件被更改,包括 16 次插入14 次删除
  1. 15 13
      DialogX/src/main/java/com/kongzue/dialogx/util/views/DialogXBaseRelativeLayout.java
  2. 1 1
      gradle.properties

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

@@ -166,9 +166,9 @@ public class DialogXBaseRelativeLayout extends RelativeLayout {
 
             if (BaseDialog.getTopActivity() == null) return;
 
-            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
-                View decorView = (View) getParent();
-                if (decorView != null) {
+            View decorView = (View) getParent();
+            if (decorView != null) {
+                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
                     parentKey = Integer.toHexString(decorView.hashCode());
                     getDynamicWindowInsetsAnimationListener(parentKey).add(dynamicWindowInsetsAnimationListener = new DynamicWindowInsetsAnimationListener() {
                         @Override
@@ -177,17 +177,16 @@ public class DialogXBaseRelativeLayout extends RelativeLayout {
                         }
                     });
                     initDynamicSafeAreaListener();
+                    paddingWindowInsetsByDefault();
+                } else {
+                    decorView.getViewTreeObserver().addOnGlobalLayoutListener(decorViewLayoutListener = new ViewTreeObserver.OnGlobalLayoutListener() {
+                        @Override
+                        public void onGlobalLayout() {
+                            paddingWindowInsetsByDefault();
+                        }
+                    });
+                    decorViewLayoutListener.onGlobalLayout();
                 }
-                paddingWindowInsetsByDefault();
-            } else {
-                View decorView = (View) getParent();
-                decorView.getViewTreeObserver().addOnGlobalLayoutListener(decorViewLayoutListener = new ViewTreeObserver.OnGlobalLayoutListener() {
-                    @Override
-                    public void onGlobalLayout() {
-                        paddingWindowInsetsByDefault();
-                    }
-                });
-                decorViewLayoutListener.onGlobalLayout();
             }
 
             if (onLifecycleCallBack != null) {
@@ -292,6 +291,9 @@ public class DialogXBaseRelativeLayout extends RelativeLayout {
 
     @Override
     public boolean requestFocus(int direction, Rect previouslyFocusedRect) {
+        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH) {
+            initDynamicSafeAreaListener();
+        }
         if (direction == View.FOCUS_DOWN && requestFocusView != null && requestFocusView.get() != null) {
             return requestFocusView.get().requestFocus();
         }

+ 1 - 1
gradle.properties

@@ -19,6 +19,6 @@ android.useAndroidX=true
 # Automatically convert third-party libraries to use AndroidX
 android.enableJetifier=true
 
-BUILD_VERSION=0.0.47.beta17
+BUILD_VERSION=0.0.47.beta18
 BUILD_VERSION_INT=46
 DIALOGX_STYLE_VERSION=5