瀏覽代碼

0.0.45.beta6

kongzue 3 年之前
父節點
當前提交
cee59793a4

+ 1 - 0
DialogX/src/main/java/com/kongzue/dialogx/util/views/ActivityScreenShotImageView.java

@@ -128,6 +128,7 @@ public class ActivityScreenShotImageView extends AppCompatImageView {
     private boolean isScreenshotSuccess;
     
     private void drawViewImage(View view) {
+        if (view.getWidth()==0 || view.getHeight()==0)return;
         view.buildDrawingCache();
         Rect rect = new Rect();
         view.getWindowVisibleDisplayFrame(rect);

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

@@ -45,6 +45,7 @@ public class DialogXBaseRelativeLayout extends RelativeLayout {
     private BaseDialog parentDialog;
     private boolean autoUnsafePlacePadding = true;
     private boolean focusable = true;
+    private boolean interceptBack = true;
     
     private OnLifecycleCallBack onLifecycleCallBack;
     private OnBackPressedListener onBackPressedListener;
@@ -75,6 +76,7 @@ public class DialogXBaseRelativeLayout extends RelativeLayout {
                 TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.DialogXBaseRelativeLayout);
                 focusable = a.getBoolean(R.styleable.DialogXBaseRelativeLayout_baseFocusable, true);
                 autoUnsafePlacePadding = a.getBoolean(R.styleable.DialogXBaseRelativeLayout_autoSafeArea, true);
+                interceptBack = a.getBoolean(R.styleable.DialogXBaseRelativeLayout_interceptBack, true);
                 a.recycle();
                 isInited = true;
             }
@@ -121,7 +123,7 @@ public class DialogXBaseRelativeLayout extends RelativeLayout {
     
     @Override
     public boolean dispatchKeyEvent(KeyEvent event) {
-        if (isAttachedToWindow() && event.getAction() == KeyEvent.ACTION_UP && event.getKeyCode() == KeyEvent.KEYCODE_BACK) {
+        if (isAttachedToWindow() && event.getAction() == KeyEvent.ACTION_UP && event.getKeyCode() == KeyEvent.KEYCODE_BACK && interceptBack) {
             if (onBackPressedListener != null) {
                 onBackPressedListener.onBackPressed();
             }
@@ -307,4 +309,13 @@ public class DialogXBaseRelativeLayout extends RelativeLayout {
     public boolean isBaseFocusable() {
         return focusable;
     }
+    
+    public boolean isInterceptBack() {
+        return interceptBack;
+    }
+    
+    public DialogXBaseRelativeLayout setInterceptBack(boolean interceptBack) {
+        this.interceptBack = interceptBack;
+        return this;
+    }
 }

+ 1 - 0
DialogX/src/main/res/values/attrs.xml

@@ -25,6 +25,7 @@
     <declare-styleable name="DialogXBaseRelativeLayout">
         <attr name="baseFocusable" format="boolean"/>
         <attr name="autoSafeArea" format="boolean"/>
+        <attr name="interceptBack" format="boolean"/>
     </declare-styleable>
 
     <item name="id_frame_layout_custom" type="id"/>

+ 1 - 1
gradle.properties

@@ -19,5 +19,5 @@ android.useAndroidX=true
 # Automatically convert third-party libraries to use AndroidX
 android.enableJetifier=true
 
-BUILD_VERSION=0.0.45.beta5
+BUILD_VERSION=0.0.45.beta6
 BUILD_VERSION_INT=44