Explorar o código

0.0.50.beta12
- 支持使用 new 构建对话框对象并复写其 `preDismiss` 方法即可处理刚触发关闭对话框时的事件,请注意,`return true` 表示拦截关闭操作,对应的,启动事件可以使用复写 `preShow` 方法进行拦截或事物处理;
- 新增各对话框支持 `get/setThisOrderIndex(int)` 来设置对话框层级,以及 `bringToFront()` 直接置顶对话框;

Kongzue hai 10 meses
pai
achega
f997bdf7c5

+ 24 - 3
DialogX/src/main/java/com/kongzue/dialogx/dialogs/BottomDialog.java

@@ -9,6 +9,7 @@ import android.graphics.drawable.BitmapDrawable;
 import android.graphics.drawable.ColorDrawable;
 import android.graphics.drawable.Drawable;
 import android.graphics.drawable.GradientDrawable;
+import android.os.Build;
 import android.text.TextUtils;
 import android.view.View;
 import android.view.ViewGroup;
@@ -292,7 +293,6 @@ public class BottomDialog extends BaseDialog implements DialogXBaseBottomDialog
                 ((ViewGroup) boxContent.getParent()).removeView(boxContent);
                 bodyContent.addView(boxContent, 1, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
             }
-
             boxCancel = convertView.findViewWithTag("cancelBox");
 
             boxButton = convertView.findViewById(R.id.box_button);
@@ -330,6 +330,10 @@ public class BottomDialog extends BaseDialog implements DialogXBaseBottomDialog
         public void init() {
             buttonSelectResult = BUTTON_SELECT_RESULT.NONE;
 
+            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
+                getDialogView().setTranslationZ(getThisOrderIndex());
+            }
+
             if (titleTextInfo == null) titleTextInfo = DialogX.titleTextInfo;
             if (messageTextInfo == null) messageTextInfo = DialogX.messageTextInfo;
             if (okTextInfo == null) okTextInfo = DialogX.okButtonTextInfo;
@@ -651,7 +655,7 @@ public class BottomDialog extends BaseDialog implements DialogXBaseBottomDialog
 
         @Override
         public void doDismiss(View v) {
-            if (BottomDialog.this.preDismiss(BottomDialog.this)){
+            if (BottomDialog.this.preDismiss(BottomDialog.this)) {
                 return;
             }
             if (v != null) v.setEnabled(false);
@@ -1382,9 +1386,26 @@ public class BottomDialog extends BaseDialog implements DialogXBaseBottomDialog
         return this;
     }
 
-    public BottomDialog appendMessage(CharSequence message){
+    public BottomDialog appendMessage(CharSequence message) {
         this.message = TextUtils.concat(this.message, message);
         refreshUI();
         return this;
     }
+
+    public BottomDialog setThisOrderIndex(int orderIndex) {
+        this.thisOrderIndex = orderIndex;
+        if (getDialogView() != null) {
+            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
+                getDialogView().setTranslationZ(orderIndex);
+            } else {
+                error("DialogX: " + dialogKey() + " 执行 .setThisOrderIndex("+orderIndex+") 失败:系统不支持此方法,SDK-API 版本必须大于 21(LOLLIPOP)");
+            }
+        }
+        return this;
+    }
+
+    public BottomDialog bringToFront() {
+        setThisOrderIndex(getHighestOrderIndex());
+        return this;
+    }
 }

+ 18 - 0
DialogX/src/main/java/com/kongzue/dialogx/dialogs/BottomMenu.java

@@ -5,6 +5,7 @@ import static android.view.View.OVER_SCROLL_NEVER;
 import android.graphics.Bitmap;
 import android.graphics.drawable.BitmapDrawable;
 import android.graphics.drawable.Drawable;
+import android.os.Build;
 import android.text.TextUtils;
 import android.view.MotionEvent;
 import android.view.View;
@@ -1456,4 +1457,21 @@ public class BottomMenu extends BottomDialog {
         refreshUI();
         return this;
     }
+
+    public BottomMenu setThisOrderIndex(int orderIndex) {
+        this.thisOrderIndex = orderIndex;
+        if (getDialogView() != null) {
+            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
+                getDialogView().setTranslationZ(orderIndex);
+            } else {
+                error("DialogX: " + dialogKey() + " 执行 .setThisOrderIndex("+orderIndex+") 失败:系统不支持此方法,SDK-API 版本必须大于 21(LOLLIPOP)");
+            }
+        }
+        return this;
+    }
+
+    public BottomMenu bringToFront() {
+        setThisOrderIndex(getHighestOrderIndex());
+        return this;
+    }
 }

+ 23 - 0
DialogX/src/main/java/com/kongzue/dialogx/dialogs/CustomDialog.java

@@ -3,6 +3,7 @@ package com.kongzue.dialogx.dialogs;
 import android.animation.ValueAnimator;
 import android.app.Activity;
 import android.graphics.Color;
+import android.os.Build;
 import android.view.Gravity;
 import android.view.View;
 import android.view.ViewGroup;
@@ -182,6 +183,11 @@ public class CustomDialog extends BaseDialog {
                 baseViewLoc[2] = baseView().getWidth();
                 baseViewLoc[3] = baseView().getHeight();
             }
+
+            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
+                getDialogView().setTranslationZ(getThisOrderIndex());
+            }
+
             boxRoot.setParentDialog(me);
             boxRoot.setOnLifecycleCallBack(new DialogXBaseRelativeLayout.OnLifecycleCallBack() {
                 @Override
@@ -1143,4 +1149,21 @@ public class CustomDialog extends BaseDialog {
         refreshUI();
         return this;
     }
+
+    public CustomDialog setThisOrderIndex(int orderIndex) {
+        this.thisOrderIndex = orderIndex;
+        if (getDialogView() != null) {
+            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
+                getDialogView().setTranslationZ(orderIndex);
+            } else {
+                error("DialogX: " + dialogKey() + " 执行 .setThisOrderIndex("+orderIndex+") 失败:系统不支持此方法,SDK-API 版本必须大于 21(LOLLIPOP)");
+            }
+        }
+        return this;
+    }
+
+    public CustomDialog bringToFront() {
+        setThisOrderIndex(getHighestOrderIndex());
+        return this;
+    }
 }

+ 22 - 0
DialogX/src/main/java/com/kongzue/dialogx/dialogs/FullScreenDialog.java

@@ -185,6 +185,11 @@ public class FullScreenDialog extends BaseDialog implements DialogXBaseBottomDia
         @Override
         public void init() {
             boxRoot.setParentDialog(me);
+
+            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
+                getDialogView().setTranslationZ(getThisOrderIndex());
+            }
+
             boxRoot.setOnLifecycleCallBack(new DialogXBaseRelativeLayout.OnLifecycleCallBack() {
                 @Override
                 public void onShow() {
@@ -948,4 +953,21 @@ public class FullScreenDialog extends BaseDialog implements DialogXBaseBottomDia
         refreshUI();
         return this;
     }
+
+    public FullScreenDialog setThisOrderIndex(int orderIndex) {
+        this.thisOrderIndex = orderIndex;
+        if (getDialogView() != null) {
+            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
+                getDialogView().setTranslationZ(orderIndex);
+            } else {
+                error("DialogX: " + dialogKey() + " 执行 .setThisOrderIndex("+orderIndex+") 失败:系统不支持此方法,SDK-API 版本必须大于 21(LOLLIPOP)");
+            }
+        }
+        return this;
+    }
+
+    public FullScreenDialog bringToFront() {
+        setThisOrderIndex(getHighestOrderIndex());
+        return this;
+    }
 }

+ 18 - 0
DialogX/src/main/java/com/kongzue/dialogx/dialogs/GuideDialog.java

@@ -11,6 +11,7 @@ import android.graphics.Rect;
 import android.graphics.RectF;
 import android.graphics.drawable.BitmapDrawable;
 import android.graphics.drawable.Drawable;
+import android.os.Build;
 import android.view.Gravity;
 import android.view.View;
 import android.view.ViewGroup;
@@ -805,4 +806,21 @@ public class GuideDialog extends CustomDialog {
         refreshUI();
         return this;
     }
+
+    public GuideDialog setThisOrderIndex(int orderIndex) {
+        this.thisOrderIndex = orderIndex;
+        if (getDialogView() != null) {
+            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
+                getDialogView().setTranslationZ(orderIndex);
+            } else {
+                error("DialogX: " + dialogKey() + " 执行 .setThisOrderIndex("+orderIndex+") 失败:系统不支持此方法,SDK-API 版本必须大于 21(LOLLIPOP)");
+            }
+        }
+        return this;
+    }
+
+    public GuideDialog bringToFront() {
+        setThisOrderIndex(getHighestOrderIndex());
+        return this;
+    }
 }

+ 18 - 0
DialogX/src/main/java/com/kongzue/dialogx/dialogs/InputDialog.java

@@ -3,6 +3,7 @@ package com.kongzue.dialogx.dialogs;
 import android.graphics.Bitmap;
 import android.graphics.drawable.BitmapDrawable;
 import android.graphics.drawable.Drawable;
+import android.os.Build;
 import android.text.TextUtils;
 import android.view.View;
 
@@ -712,4 +713,21 @@ public class InputDialog extends MessageDialog {
         refreshUI();
         return this;
     }
+
+    public InputDialog setThisOrderIndex(int orderIndex) {
+        this.thisOrderIndex = orderIndex;
+        if (getDialogView() != null) {
+            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
+                getDialogView().setTranslationZ(orderIndex);
+            } else {
+                error("DialogX: " + dialogKey() + " 执行 .setThisOrderIndex("+orderIndex+") 失败:系统不支持此方法,SDK-API 版本必须大于 21(LOLLIPOP)");
+            }
+        }
+        return this;
+    }
+
+    public InputDialog bringToFront() {
+        setThisOrderIndex(getHighestOrderIndex());
+        return this;
+    }
 }

+ 22 - 0
DialogX/src/main/java/com/kongzue/dialogx/dialogs/MessageDialog.java

@@ -319,6 +319,11 @@ public class MessageDialog extends BaseDialog {
 
         public void init() {
             buttonSelectResult = BUTTON_SELECT_RESULT.NONE;
+
+            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
+                getDialogView().setTranslationZ(getThisOrderIndex());
+            }
+
             if (titleTextInfo == null) titleTextInfo = DialogX.titleTextInfo;
             if (messageTextInfo == null) messageTextInfo = DialogX.messageTextInfo;
             if (okTextInfo == null) okTextInfo = DialogX.okButtonTextInfo;
@@ -1520,4 +1525,21 @@ public class MessageDialog extends BaseDialog {
         refreshUI();
         return this;
     }
+
+    public MessageDialog setThisOrderIndex(int orderIndex) {
+        this.thisOrderIndex = orderIndex;
+        if (getDialogView() != null) {
+            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
+                getDialogView().setTranslationZ(orderIndex);
+            } else {
+                error("DialogX: " + dialogKey() + " 执行 .setThisOrderIndex("+orderIndex+") 失败:系统不支持此方法,SDK-API 版本必须大于 21(LOLLIPOP)");
+            }
+        }
+        return this;
+    }
+
+    public MessageDialog bringToFront() {
+        setThisOrderIndex(getHighestOrderIndex());
+        return this;
+    }
 }

+ 17 - 0
DialogX/src/main/java/com/kongzue/dialogx/dialogs/PopMenu.java

@@ -1416,4 +1416,21 @@ public class PopMenu extends BaseDialog {
         this.autoTintIconInLightOrDarkMode = autoTintIconInLightOrDarkMode;
         return this;
     }
+
+    public PopMenu setThisOrderIndex(int orderIndex) {
+        this.thisOrderIndex = orderIndex;
+        if (getDialogView() != null) {
+            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
+                getDialogView().setTranslationZ(orderIndex);
+            } else {
+                error("DialogX: " + dialogKey() + " 执行 .setThisOrderIndex("+orderIndex+") 失败:系统不支持此方法,SDK-API 版本必须大于 21(LOLLIPOP)");
+            }
+        }
+        return this;
+    }
+
+    public PopMenu bringToFront() {
+        setThisOrderIndex(getHighestOrderIndex());
+        return this;
+    }
 }

+ 21 - 0
DialogX/src/main/java/com/kongzue/dialogx/dialogs/PopNotification.java

@@ -533,6 +533,10 @@ public class PopNotification extends BaseDialog implements NoTouchInterface {
             if (buttonTextInfo == null) buttonTextInfo = DialogX.buttonTextInfo;
             if (backgroundColor == null) backgroundColor = DialogX.backgroundColor;
 
+            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
+                getDialogView().setTranslationZ(getThisOrderIndex());
+            }
+
             if (autoDismissTimer == null) {
                 showShort();
             }
@@ -1541,4 +1545,21 @@ public class PopNotification extends BaseDialog implements NoTouchInterface {
         refreshUI();
         return this;
     }
+
+    public PopNotification setThisOrderIndex(int orderIndex) {
+        this.thisOrderIndex = orderIndex;
+        if (getDialogView() != null) {
+            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
+                getDialogView().setTranslationZ(orderIndex);
+            } else {
+                error("DialogX: " + dialogKey() + " 执行 .setThisOrderIndex("+orderIndex+") 失败:系统不支持此方法,SDK-API 版本必须大于 21(LOLLIPOP)");
+            }
+        }
+        return this;
+    }
+
+    public PopNotification bringToFront() {
+        setThisOrderIndex(getHighestOrderIndex());
+        return this;
+    }
 }

+ 21 - 0
DialogX/src/main/java/com/kongzue/dialogx/dialogs/PopTip.java

@@ -499,6 +499,10 @@ public class PopTip extends BaseDialog implements NoTouchInterface {
 
         @Override
         public void init() {
+            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
+                getDialogView().setTranslationZ(getThisOrderIndex());
+            }
+
             if (messageTextInfo == null) messageTextInfo = DialogX.popTextInfo;
             if (buttonTextInfo == null) buttonTextInfo = DialogX.buttonTextInfo;
             if (backgroundColor == null) backgroundColor = DialogX.backgroundColor;
@@ -1368,4 +1372,21 @@ public class PopTip extends BaseDialog implements NoTouchInterface {
         refreshUI();
         return this;
     }
+
+    public PopTip setThisOrderIndex(int orderIndex) {
+        this.thisOrderIndex = orderIndex;
+        if (getDialogView() != null) {
+            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
+                getDialogView().setTranslationZ(orderIndex);
+            } else {
+                error("DialogX: " + dialogKey() + " 执行 .setThisOrderIndex("+orderIndex+") 失败:系统不支持此方法,SDK-API 版本必须大于 21(LOLLIPOP)");
+            }
+        }
+        return this;
+    }
+
+    public PopTip bringToFront() {
+        setThisOrderIndex(getHighestOrderIndex());
+        return this;
+    }
 }

+ 18 - 0
DialogX/src/main/java/com/kongzue/dialogx/dialogs/TipDialog.java

@@ -1,6 +1,7 @@
 package com.kongzue.dialogx.dialogs;
 
 import android.app.Activity;
+import android.os.Build;
 import android.text.TextUtils;
 
 import com.kongzue.dialogx.DialogX;
@@ -270,4 +271,21 @@ public class TipDialog extends WaitDialog {
         refreshUI();
         return this;
     }
+
+    public TipDialog setThisOrderIndex(int orderIndex) {
+        this.thisOrderIndex = orderIndex;
+        if (getDialogView() != null) {
+            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
+                getDialogView().setTranslationZ(orderIndex);
+            } else {
+                error("DialogX: " + dialogKey() + " 执行 .setThisOrderIndex("+orderIndex+") 失败:系统不支持此方法,SDK-API 版本必须大于 21(LOLLIPOP)");
+            }
+        }
+        return this;
+    }
+
+    public TipDialog bringToFront() {
+        setThisOrderIndex(getHighestOrderIndex());
+        return this;
+    }
 }

+ 21 - 0
DialogX/src/main/java/com/kongzue/dialogx/dialogs/WaitDialog.java

@@ -219,6 +219,7 @@ public class WaitDialog extends BaseDialog {
 
     protected void setWaitDialogView(View v) {
         dialogView = new WeakReference<>(v);
+        setDialogView(v);
     }
 
     public WaitDialog show() {
@@ -327,6 +328,10 @@ public class WaitDialog extends BaseDialog {
         }
 
         public void init() {
+            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
+                getDialogView().setTranslationZ(getThisOrderIndex());
+            }
+
             if (messageTextInfo == null) messageTextInfo = DialogX.tipTextInfo;
             if (backgroundColor == null) backgroundColor = DialogX.tipBackgroundColor;
 
@@ -1220,4 +1225,20 @@ public class WaitDialog extends BaseDialog {
         refreshUI();
         return this;
     }
+    public WaitDialog setThisOrderIndex(int orderIndex) {
+        this.thisOrderIndex = orderIndex;
+        if (getDialogView() != null) {
+            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
+                getDialogView().setTranslationZ(orderIndex);
+            } else {
+                error("DialogX: " + dialogKey() + " 执行 .setThisOrderIndex("+orderIndex+") 失败:系统不支持此方法,SDK-API 版本必须大于 21(LOLLIPOP)");
+            }
+        }
+        return this;
+    }
+
+    public WaitDialog bringToFront() {
+        setThisOrderIndex(getHighestOrderIndex());
+        return this;
+    }
 }

+ 22 - 2
DialogX/src/main/java/com/kongzue/dialogx/interfaces/BaseDialog.java

@@ -77,6 +77,7 @@ public abstract class BaseDialog implements LifecycleOwner {
     protected DialogXRunnable onShowRunnable;
     protected DialogXRunnable onDismissRunnable;
     protected boolean enableImmersiveMode = true;   // 沉浸式适配
+    protected int thisOrderIndex = 0;
 
     public enum BUTTON_SELECT_RESULT {
         NONE,           // 未做出选择
@@ -705,12 +706,15 @@ public abstract class BaseDialog implements LifecycleOwner {
         }
     }
 
-    protected String getString(int titleResId) {
+    protected String getString(int resId) {
         if (getApplicationContext() == null) {
             error("DialogX 未初始化(E6)。\n请检查是否在启动对话框前进行初始化操作,使用以下代码进行初始化:\nDialogX.init(context);\n\n另外建议您前往查看 DialogX 的文档进行使用:https://github.com/kongzue/DialogX");
             return null;
         }
-        return getResources().getString(titleResId);
+        if (resId == 0) {
+            return "";
+        }
+        return getResources().getString(resId);
     }
 
     protected int getColor(int backgroundRes) {
@@ -1075,4 +1079,20 @@ public abstract class BaseDialog implements LifecycleOwner {
     public boolean preDismiss(BaseDialog dialog) {
         return false;
     }
+
+    public int getThisOrderIndex() {
+        return thisOrderIndex;
+    }
+
+    public BaseDialog setThisOrderIndex(int thisOrderIndex) {
+        this.thisOrderIndex = thisOrderIndex;
+        return this;
+    }
+
+    protected int getHighestOrderIndex() {
+        if (getOwnActivity() != null && getDecorView(getOwnActivity()) != null) {
+            return getDecorView(getOwnActivity()).getChildCount();
+        }
+        return runningDialogList == null ? 1 : runningDialogList.size();
+    }
 }

+ 0 - 30
DialogX/src/main/java/com/kongzue/dialogx/util/views/MaxLinearLayout.java

@@ -86,42 +86,12 @@ public class MaxLinearLayout extends LinearLayout {
         if (widthSize > maxWidth && maxWidth != 0) {
             widthSize = maxWidth;
         }
-        View blurView = findViewWithTag("blurView");
-        View contentView = findViewWithoutTag("blurView");
-        if (contentView != null && blurView != null) {
-            int widthTemp = contentView.getMeasuredWidth() == 0 ? getMeasuredWidth() : contentView.getMeasuredWidth();
-            int heightTemp = contentView.getMeasuredHeight() == 0 ? getMeasuredHeight() : contentView.getMeasuredHeight();
-            if (widthTemp < minWidth) widthTemp = minWidth;
-            if (heightTemp < minHeight) heightTemp = minHeight;
-            
-            RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams) blurView.getLayoutParams();
-            lp.addRule(RelativeLayout.CENTER_IN_PARENT);
-            lp.width = widthTemp;
-            lp.height = heightTemp;
-            blurView.setLayoutParams(lp);
-        } else {
-            if (blurView != null) {
-                RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams) blurView.getLayoutParams();
-                lp.width = getMeasuredWidth();
-                lp.height = getMeasuredHeight();
-                blurView.setLayoutParams(lp);
-            }
-        }
         
         int maxHeightMeasureSpec = MeasureSpec.makeMeasureSpec(heightSize, heightMode);
         int maxWidthMeasureSpec = MeasureSpec.makeMeasureSpec(widthSize, widthMode);
         super.onMeasure(maxWidthMeasureSpec, maxHeightMeasureSpec);
     }
     
-    private View findViewWithoutTag(String tag) {
-        for (int i = 0; i < getChildCount(); i++) {
-            if (!tag.equals(getChildAt(i).getTag())) {
-                return getChildAt(i);
-            }
-        }
-        return null;
-    }
-    
     public int dip2px(float dpValue) {
         final float scale = getResources().getDisplayMetrics().density;
         return (int) (dpValue * scale + 0.5f);

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

@@ -82,8 +82,6 @@ public class MaxRelativeLayout extends RelativeLayout {
         }
     }
 
-    private ScrollView childScrollView;
-
     public MaxRelativeLayout setMaxHeight(int maxHeight) {
         if (maxHeight > 0) this.maxHeight = maxHeight;
         return this;
@@ -125,56 +123,10 @@ public class MaxRelativeLayout extends RelativeLayout {
         if (widthSize > maxWidth && maxWidth != 0) {
             widthSize = maxWidth + getPaddingLeft() + getPaddingRight();
         }
-        View blurView = findViewWithTag("blurView");
-        View contentView = this.contentView == null ? findViewWithoutTag("blurView") : this.contentView;
-        if (contentView != null && blurView != null) {
-            int widthTemp = contentView.getMeasuredWidth() == 0 ? getMeasuredWidth() : contentView.getMeasuredWidth();
-            int heightTemp = contentView.getMeasuredHeight() == 0 ? getMeasuredHeight() : contentView.getMeasuredHeight();
-            if (widthTemp < minWidth) widthTemp = minWidth;
-            if (heightTemp < minHeight) heightTemp = minHeight;
-
-            LayoutParams lp = (LayoutParams) blurView.getLayoutParams();
-            lp.addRule(RelativeLayout.CENTER_IN_PARENT);
-            lp.width = widthTemp;
-            lp.height = heightTemp;
-            blurView.setLayoutParams(lp);
-        } else {
-            if (blurView != null) {
-                LayoutParams lp = (LayoutParams) blurView.getLayoutParams();
-                lp.width = getMeasuredWidth();
-                lp.height = getMeasuredHeight();
-                blurView.setLayoutParams(lp);
-            }
-        }
 
         int maxHeightMeasureSpec = MeasureSpec.makeMeasureSpec(heightSize, heightMode);
         int maxWidthMeasureSpec = MeasureSpec.makeMeasureSpec(widthSize, widthMode);
         super.onMeasure(maxWidthMeasureSpec, maxHeightMeasureSpec);
-
-        childScrollView = findViewById(R.id.scrollView);
-    }
-
-    private View findViewWithoutTag(String tag) {
-        for (int i = 0; i < getChildCount(); i++) {
-            if (!tag.equals(getChildAt(i).getTag())) {
-                return getChildAt(i);
-            }
-        }
-        return null;
-    }
-
-    @Deprecated
-    public boolean isChildScrollViewCanScroll() {
-        if (childScrollView == null) return false;
-        if (!childScrollView.isEnabled()) {
-            return false;
-        }
-        View child = childScrollView.getChildAt(0);
-        if (child != null) {
-            int childHeight = child.getHeight();
-            return childScrollView.getHeight() < childHeight;
-        }
-        return false;
     }
 
     public int dip2px(float dpValue) {

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

@@ -437,43 +437,18 @@ public class MainActivity extends BaseActivity {
         btnContextMenu.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View v) {
-                new PopMenu() {
-                    @Override
-                    public boolean preDismiss(BaseDialog dialog) {
-                        log(System.currentTimeMillis() + " preDismissEvent");
-                        return super.preDismiss(dialog);
-                    }
-                }
-                        .setMenus("添加", "编辑", "删除", "分享")
+                PopMenu.show("添加", "编辑", "删除", "分享")
+                        .setIconResIds(R.mipmap.img_dialogx_demo_add, R.mipmap.img_dialogx_demo_edit, R.mipmap.img_dialogx_demo_delete, R.mipmap.img_dialogx_demo_share)
                         .setOnMenuItemClickListener(new OnMenuItemClickListener<PopMenu>() {
                             @Override
                             public boolean onClick(PopMenu dialog, CharSequence text, int index) {
-                                log(System.currentTimeMillis() + " onItemClickEvent");
+                                if (index == 0) {
+                                    dialog.setMenuList(new String[]{"产品A", "产品B", "产品C"});
+                                    return true;
+                                }
                                 return false;
                             }
-                        })
-                        .onDismiss(new DialogXRunnable<PopMenu>() {
-                            @Override
-                            public void run(PopMenu dialog) {
-                                log(System.currentTimeMillis() + " onDismissEvent");
-                            }
-                        })
-                        .show();
-                ;
-
-
-//                PopMenu.show("添加", "编辑", "删除", "分享")
-//                        .setIconResIds(R.mipmap.img_dialogx_demo_add, R.mipmap.img_dialogx_demo_edit, R.mipmap.img_dialogx_demo_delete, R.mipmap.img_dialogx_demo_share)
-//                        .setOnMenuItemClickListener(new OnMenuItemClickListener<PopMenu>() {
-//                            @Override
-//                            public boolean onClick(PopMenu dialog, CharSequence text, int index) {
-//                                if (index == 0) {
-//                                    dialog.setMenuList(new String[]{"产品A", "产品B", "产品C"});
-//                                    return true;
-//                                }
-//                                return false;
-//                            }
-//                        });
+                        });
             }
         });
 
@@ -534,7 +509,7 @@ public class MainActivity extends BaseActivity {
                             @Override
                             public boolean onClick(MessageDialog baseDialog, View v) {
                                 PopTip.show("点击确定按钮");
-                                return false;
+                                return true;
                             }
                         });
             }
@@ -718,6 +693,8 @@ public class MainActivity extends BaseActivity {
                                 return super.onSlideTouchEvent(dialog, v, event);
                             }
                         })
+
+                        .setMinHeight(dip2px(400))
                         .show();
             }
         });
@@ -1344,7 +1321,6 @@ public class MainActivity extends BaseActivity {
             public void onClick(View v) {
                 notificationIndex++;
                 PopNotification.build()
-                        .noAutoDismiss()
                         .setMessage("这是一条消息 " + notificationIndex)
                         .setOnPopNotificationClickListener(new OnDialogButtonClickListener<PopNotification>() {
                             @Override

+ 1 - 1
gradle.properties

@@ -19,7 +19,7 @@ android.useAndroidX=true
 # Automatically convert third-party libraries to use AndroidX
 android.enableJetifier=true
 
-BUILD_VERSION=0.0.50.beta11
+BUILD_VERSION=0.0.50.beta12
 BUILD_VERSION_INT=49
 DIALOGX_STYLE_VERSION=5
 android.nonTransitiveRClass=true