浏览代码

fix bugs
CustomDialog remove black translucent mask

kongzue 4 年之前
父节点
当前提交
4c7751c4b4

+ 3 - 3
DialogX/build.gradle

@@ -6,7 +6,7 @@ def siteUrl = 'https://github.com/kongzue/DialogX' //项目在github主页地址
 def gitUrl = 'https://github.com/kongzue/DialogX.git'   //Git仓库的地址
 
 group = "com.kongzue.dialogx"
-version = "0.0.11"
+version = "0.0.12"
 
 android {
     compileSdkVersion 30
@@ -14,8 +14,8 @@ android {
     defaultConfig {
         minSdkVersion 21
         targetSdkVersion 30
-        versionCode 10
-        versionName "0.0.11"
+        versionCode 12
+        versionName "0.0.12"
 
         consumerProguardFiles "consumer-rules.pro"
 

+ 8 - 2
DialogX/src/main/java/com/kongzue/dialogx/dialogs/CustomDialog.java

@@ -92,8 +92,6 @@ public class CustomDialog extends BaseDialog {
         
         @Override
         public void init() {
-            boxRoot.setAutoUnsafePlacePadding(autoUnsafePlacePadding);
-            
             boxRoot.setOnLifecycleCallBack(new DialogXBaseRelativeLayout.OnLifecycleCallBack() {
                 @Override
                 public void onShow() {
@@ -176,6 +174,7 @@ public class CustomDialog extends BaseDialog {
         
         @Override
         public void refreshView() {
+            boxRoot.setAutoUnsafePlacePadding(autoUnsafePlacePadding);
             if (cancelable) {
                 boxRoot.setOnClickListener(new View.OnClickListener() {
                     @Override
@@ -330,6 +329,13 @@ public class CustomDialog extends BaseDialog {
     
     public CustomDialog setAutoUnsafePlacePadding(boolean autoUnsafePlacePadding) {
         this.autoUnsafePlacePadding = autoUnsafePlacePadding;
+        refreshUI();
+        return this;
+    }
+    
+    public CustomDialog setFullScreen(boolean fullscreen) {
+        this.autoUnsafePlacePadding = !autoUnsafePlacePadding;
+        refreshUI();
         return this;
     }
 }

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

@@ -200,6 +200,9 @@ public class BaseDialog {
         if (getContext() == null) {
             error("DialogX 未初始化。\n请检查是否在启动对话框前进行初始化操作,使用以下代码进行初始化:\nDialogX.init(context);\n\n另外建议您前往查看 DialogX 的文档进行使用:https://github.com/kongzue/DialogX");
         }
+        if (style.styleVer != DialogXStyle.styleVer) {
+            error("DialogX 所引用的 Style 不符合当前适用版本:" + DialogXStyle.styleVer + " 引入的 Style(" + style.getClass().getSimpleName() + ") 版本" + style.styleVer);
+        }
     }
     
     protected String getString(int titleResId) {

+ 7 - 18
DialogX/src/main/java/com/kongzue/dialogx/util/BottomDialogTouchEventInterceptor.java

@@ -42,8 +42,6 @@ public class BottomDialogTouchEventInterceptor {
         refresh(me, impl);
     }
     
-    private int touchY, touchX;
-    
     public void refresh(final BottomDialog me, final BottomDialog.DialogImpl impl) {
         if (me == null || impl == null || impl.bkg == null || impl.scrollView == null) {
             return;
@@ -70,8 +68,8 @@ public class BottomDialogTouchEventInterceptor {
                             bkgTouchDownY = event.getY();
                             isBkgTouched = true;
                             bkgOldY = impl.bkg.getY();
+                            
                             return false;
-                        //break;
                         case MotionEvent.ACTION_MOVE:
                             if (isBkgTouched) {
                                 float aimY = impl.bkg.getY() + event.getY() - bkgTouchDownY;
@@ -81,18 +79,18 @@ public class BottomDialogTouchEventInterceptor {
                                             bkgTouchDownY = event.getY();
                                             scrolledY = 0;
                                         }
-                                        
+
                                         impl.scrollView.scrollTo(0, (int) (scrolledY - (event.getY() - bkgTouchDownY)));
                                         impl.bkg.setY(0);
-                                        
                                         oldMode = -1;
+                                        return true;
                                     }
                                 } else {
                                     if (oldMode == -1) {
                                         bkgTouchDownY = event.getY();
                                         aimY = impl.bkg.getY() + event.getY() - bkgTouchDownY;
                                     }
-                                    
+
                                     if (impl.bkg.isChildScrollViewCanScroll()) {
                                         impl.bkg.setY(aimY);
                                     } else {
@@ -100,19 +98,12 @@ public class BottomDialogTouchEventInterceptor {
                                             impl.bkg.setY(aimY);
                                         }
                                     }
-                                    
+
                                     oldMode = 0;
-                                }
-                                
-                                float moveY = event.getRawY();
-                                float moveX = event.getRawX();
-                                if (Math.abs(moveY - touchY) > dip2px(20) || Math.abs(moveX - touchX) > dip2px(20)) {
                                     return true;
-                                } else {
-                                    return false;
                                 }
                             }
-                            //break;
+                            return false;
                         case MotionEvent.ACTION_UP:
                         case MotionEvent.ACTION_CANCEL:
                             scrolledY = impl.scrollView.getScrollY();
@@ -142,11 +133,9 @@ public class BottomDialogTouchEventInterceptor {
                                     enterAnim.start();
                                 }
                             }
-                            
                             return false;
-                        //break;
                     }
-                    return true;
+                    return false;
                 }
             });
         } else {

+ 1 - 1
DialogX/src/main/res/layout/item_dialogx_material_bottom_menu_normal_text.xml

@@ -33,7 +33,7 @@
             android:layout_height="wrap_content"
             android:layout_weight="1"
             android:gravity="left|center_vertical"
-            android:singleLine="true"
+            android:maxLines="1"
             android:text=""
             android:textColor="@color/black90"
             android:textSize="16dp" />

+ 0 - 1
DialogX/src/main/res/layout/layout_dialogx_custom.xml

@@ -3,7 +3,6 @@
     android:id="@+id/box_root"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
-    android:background="@color/black20"
     android:orientation="vertical">
 
     <RelativeLayout

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

@@ -607,7 +607,7 @@ public class MainActivity extends BaseActivity {
                             }
                         });
                     }
-                });
+                }).setFullScreen(true);
             }
         });