瀏覽代碼

0.0.48.beta8 更新日志

- 现已支持通过使用 new 构建实例时,override 的生命周期事件的方式来处理生命周期事务,例如:
      //复写事件演示
      new MessageDialog() {
          @Override
          public void onShow(MessageDialog dialog) {
              //...
              tip("onShow");
          }
          @Override
          public void onDismiss(MessageDialog dialog) {
              //...
              tip("onDismiss");
          }
      }

- PopTip 现在支持通过简化指令“tip(...)”进行构建,只需要引入 import static com.kongzue.dialogx.dialogs.PopTip.tip; 即可使用 tip(message)、tip(message, buttonText) 等方式快速构建提示消息;

- PopMenu 对于 baseView 的实时跟踪效果改进,以及在关联 baseView 的部分情况下菜单位置异常的问题修复;

- 修复 PopNotification 其他主题下,只显示 message 时布局异常的问题;

- 修复了 BottomDialog 的 buttonSelectResult 可能存在异常的问题(感谢反馈群群友 @'Scanf  的反馈)
myzcxhh@live.cn 2 年之前
父節點
當前提交
ce70e7de21

+ 44 - 2
DialogX/src/main/java/com/kongzue/dialogx/dialogs/BottomDialog.java

@@ -345,6 +345,7 @@ public class BottomDialog extends BaseDialog {
 
                     lifecycle.setCurrentState(Lifecycle.State.CREATED);
                     getDialogLifecycleCallback().onShow(me);
+                    BottomDialog.this.onShow(me);
 
                     onDialogShow();
 
@@ -380,6 +381,7 @@ public class BottomDialog extends BaseDialog {
                 public void onDismiss() {
                     isShow = false;
                     getDialogLifecycleCallback().onDismiss(me);
+                    BottomDialog.this.onDismiss(me);
                     dialogImpl = null;
                     bottomDialogTouchEventInterceptor = null;
                     dialogLifecycleCallback = null;
@@ -404,10 +406,10 @@ public class BottomDialog extends BaseDialog {
                 });
             }
             if (btnSelectOther != null) {
-                buttonSelectResult = BUTTON_SELECT_RESULT.BUTTON_OTHER;
                 btnSelectOther.setOnClickListener(new View.OnClickListener() {
                     @Override
                     public void onClick(View v) {
+                        buttonSelectResult = BUTTON_SELECT_RESULT.BUTTON_OTHER;
                         if (otherButtonClickListener != null) {
                             if (!otherButtonClickListener.onClick(me, v)) {
                                 dismiss();
@@ -419,10 +421,10 @@ public class BottomDialog extends BaseDialog {
                 });
             }
             if (btnSelectPositive != null) {
-                buttonSelectResult = BUTTON_SELECT_RESULT.BUTTON_OK;
                 btnSelectPositive.setOnClickListener(new View.OnClickListener() {
                     @Override
                     public void onClick(View v) {
+                        buttonSelectResult = BUTTON_SELECT_RESULT.BUTTON_OK;
                         if (okButtonClickListener != null) {
                             if (!okButtonClickListener.onClick(me, v)) {
                                 dismiss();
@@ -1232,4 +1234,44 @@ public class BottomDialog extends BaseDialog {
     public BUTTON_SELECT_RESULT getButtonSelectResult() {
         return buttonSelectResult;
     }
+
+    /**
+     * 用于使用 new 构建实例时,override 的生命周期事件
+     * 例如:
+     * new BottomDialog() {
+     *     @Override
+     *     public void onShow(BottomDialog dialog) {
+     *         //...
+     *     }
+     * }
+     *
+     * @param dialog self
+     */
+    public void onShow(BottomDialog dialog){
+
+    }
+
+    /**
+     * 用于使用 new 构建实例时,override 的生命周期事件
+     * 例如:
+     * new BottomDialog() {
+     *     @Override
+     *     public boolean onDismiss(BottomDialog dialog) {
+     *         WaitDialog.show("Please Wait...");
+     *         if (dialog.getButtonSelectResult() == BUTTON_SELECT_RESULT.BUTTON_OK) {
+     *             //点击了OK的情况
+     *             //...
+     *         } else {
+     *             //其他按钮点击、对话框dismiss的情况
+     *             //...
+     *         }
+     *         return false;
+     *     }
+     * }
+     * @param dialog self
+     */
+    //用于使用 new 构建实例时,override 的生命周期事件
+    public void onDismiss(BottomDialog dialog){
+
+    }
 }

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

@@ -189,6 +189,7 @@ public class CustomDialog extends BaseDialog {
                     lifecycle.setCurrentState(Lifecycle.State.CREATED);
 
                     getDialogLifecycleCallback().onShow(me);
+                    CustomDialog.this.onShow(me);
                     onDialogShow();
 
                     boxCustom.setVisibility(View.GONE);
@@ -198,6 +199,7 @@ public class CustomDialog extends BaseDialog {
                 public void onDismiss() {
                     isShow = false;
                     getDialogLifecycleCallback().onDismiss(me);
+                    CustomDialog.this.onDismiss(me);
                     dialogImpl = null;
                     dialogLifecycleCallback = null;
                     lifecycle.setCurrentState(Lifecycle.State.DESTROYED);
@@ -1025,4 +1027,44 @@ public class CustomDialog extends BaseDialog {
         refreshUI();
         return this;
     }
+
+    /**
+     * 用于使用 new 构建实例时,override 的生命周期事件
+     * 例如:
+     * new CustomDialog() {
+     *     @Override
+     *     public void onShow(CustomDialog dialog) {
+     *         //...
+     *     }
+     * }
+     *
+     * @param dialog self
+     */
+    public void onShow(CustomDialog dialog){
+
+    }
+
+    /**
+     * 用于使用 new 构建实例时,override 的生命周期事件
+     * 例如:
+     * new CustomDialog() {
+     *     @Override
+     *     public boolean onDismiss(CustomDialog dialog) {
+     *         WaitDialog.show("Please Wait...");
+     *         if (dialog.getButtonSelectResult() == BUTTON_SELECT_RESULT.BUTTON_OK) {
+     *             //点击了OK的情况
+     *             //...
+     *         } else {
+     *             //其他按钮点击、对话框dismiss的情况
+     *             //...
+     *         }
+     *         return false;
+     *     }
+     * }
+     * @param dialog self
+     */
+    //用于使用 new 构建实例时,override 的生命周期事件
+    public void onDismiss(CustomDialog dialog){
+
+    }
 }

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

@@ -172,12 +172,14 @@ public class FullScreenDialog extends BaseDialog {
                     onDialogShow();
                     
                     getDialogLifecycleCallback().onShow(me);
+                    FullScreenDialog.this.onShow(me);
                 }
                 
                 @Override
                 public void onDismiss() {
                     isShow = false;
                     getDialogLifecycleCallback().onDismiss(me);
+                    FullScreenDialog.this.onDismiss(me);
                     fullScreenDialogTouchEventInterceptor = null;
                     dialogImpl = null;
                     dialogLifecycleCallback = null;
@@ -701,4 +703,44 @@ public class FullScreenDialog extends BaseDialog {
         refreshUI();
         return this;
     }
+
+    /**
+     * 用于使用 new 构建实例时,override 的生命周期事件
+     * 例如:
+     * new FullScreenDialog() {
+     *     @Override
+     *     public void onShow(FullScreenDialog dialog) {
+     *         //...
+     *     }
+     * }
+     *
+     * @param dialog self
+     */
+    public void onShow(FullScreenDialog dialog){
+
+    }
+
+    /**
+     * 用于使用 new 构建实例时,override 的生命周期事件
+     * 例如:
+     * new FullScreenDialog() {
+     *     @Override
+     *     public boolean onDismiss(FullScreenDialog dialog) {
+     *         WaitDialog.show("Please Wait...");
+     *         if (dialog.getButtonSelectResult() == BUTTON_SELECT_RESULT.BUTTON_OK) {
+     *             //点击了OK的情况
+     *             //...
+     *         } else {
+     *             //其他按钮点击、对话框dismiss的情况
+     *             //...
+     *         }
+     *         return false;
+     *     }
+     * }
+     * @param dialog self
+     */
+    //用于使用 new 构建实例时,override 的生命周期事件
+    public void onDismiss(FullScreenDialog dialog){
+
+    }
 }

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

@@ -346,6 +346,7 @@ public class MessageDialog extends BaseDialog {
                     
                     onDialogShow();
                     getDialogLifecycleCallback().onShow(me);
+                    MessageDialog.this.onShow(me);
                     
                     getDialogXAnimImpl().doShowAnim(me, new ObjectRunnable<Float>() {
                         @Override
@@ -400,6 +401,7 @@ public class MessageDialog extends BaseDialog {
                 public void onDismiss() {
                     isShow = false;
                     getDialogLifecycleCallback().onDismiss(me);
+                    MessageDialog.this.onDismiss(me);
                     dialogView = null;
                     dialogLifecycleCallback = null;
                     
@@ -1411,4 +1413,44 @@ public class MessageDialog extends BaseDialog {
     public BUTTON_SELECT_RESULT getButtonSelectResult() {
         return buttonSelectResult;
     }
+
+    /**
+     * 用于使用 new 构建实例时,override 的生命周期事件
+     * 例如:
+     * new MessageDialog() {
+     *     @Override
+     *     public void onShow(MessageDialog dialog) {
+     *         //...
+     *     }
+     * }
+     *
+     * @param dialog self
+     */
+    public void onShow(MessageDialog dialog){
+
+    }
+
+    /**
+     * 用于使用 new 构建实例时,override 的生命周期事件
+     * 例如:
+     * new MessageDialog() {
+     *     @Override
+     *     public boolean onDismiss(MessageDialog dialog) {
+     *         WaitDialog.show("Please Wait...");
+     *         if (dialog.getButtonSelectResult() == BUTTON_SELECT_RESULT.BUTTON_OK) {
+     *             //点击了OK的情况
+     *             //...
+     *         } else {
+     *             //其他按钮点击、对话框dismiss的情况
+     *             //...
+     *         }
+     *         return false;
+     *     }
+     * }
+     * @param dialog self
+     */
+    //用于使用 new 构建实例时,override 的生命周期事件
+    public void onDismiss(MessageDialog dialog){
+
+    }
 }

+ 103 - 55
DialogX/src/main/java/com/kongzue/dialogx/dialogs/PopMenu.java

@@ -1,6 +1,8 @@
 package com.kongzue.dialogx.dialogs;
 
+import static android.view.View.GONE;
 import static android.view.View.OVER_SCROLL_NEVER;
+import static android.view.View.VISIBLE;
 
 import android.animation.ValueAnimator;
 import android.graphics.Outline;
@@ -247,14 +249,10 @@ public class PopMenu extends BaseDialog {
                     int[] baseViewLocCache = new int[2];
                     if (baseView != null) {
                         baseView.getLocationOnScreen(baseViewLocCache);
-                        if (!isAnimRunning && getDialogImpl() != null && !baseViewLoc.isSameLoc(baseViewLocCache)) {
+                        if (getDialogImpl() != null && !baseViewLoc.isSameLoc(baseViewLocCache)) {
                             baseViewLoc.set(baseViewLocCache);
-                            if (getDialogImpl().boxBody.getX() < 0 && getDialogImpl().boxBody.getY() < 0) {
-                                //初始化时设置
-                                setInitMenuBodyLoc();
-                            } else {
-                                //根据条件调整位置
-                                refreshMenuBodyLoc();
+                            if (!isAnimRunning) {
+                                refreshMenuLoc();
                             }
                         }
                     } else {
@@ -270,37 +268,26 @@ public class PopMenu extends BaseDialog {
         return this;
     }
 
-    private void setInitMenuBodyLoc() {
+    private void refreshMenuLoc(){
         if (getDialogImpl() == null || getDialogImpl().boxRoot == null) {
             return;
         }
-        int mWidth = PopMenu.this.width == -1 ? baseView.getWidth() : PopMenu.this.width;
-        int mHeight = PopMenu.this.height == -1 ? baseView.getHeight() : PopMenu.this.height;
-
-        int left = (int) baseViewLoc.getX();
-        int top = (int) (baseViewLoc.getY() + (overlayBaseView ? 0 : mHeight) + selectItemYDeviation);
-
-        if (left != getDialogImpl().boxBody.getX()) {
-            menuLocX = left;
-            getDialogImpl().boxBody.setX(left);
+        DialogXViewLoc loc = getMenuLoc();
+        if (loc.getX() != getDialogImpl().boxBody.getX()) {
+            getDialogImpl().boxBody.setX(loc.getX());
         }
-        if (top != getDialogImpl().boxBody.getY()) {
-            menuLocY = top;
-            getDialogImpl().boxBody.setY(top);
+        if (loc.getY() != getDialogImpl().boxBody.getY()) {
+            getDialogImpl().boxBody.setY(loc.getY() );
         }
-
-        if (mWidth != 0 && getDialogImpl().boxBody.getWidth() != mWidth) {
-            RelativeLayout.LayoutParams rLp = new RelativeLayout.LayoutParams(mWidth, ViewGroup.LayoutParams.WRAP_CONTENT);
+        if (getDialogImpl().boxBody.getWidth() != loc.getW()) {
+            RelativeLayout.LayoutParams rLp = new RelativeLayout.LayoutParams((int) loc.getW(), ViewGroup.LayoutParams.WRAP_CONTENT);
             getDialogImpl().boxBody.setLayoutParams(rLp);
         }
     }
 
-    private int menuLocX = -1, menuLocY = -1;
+    protected DialogXViewLoc getMenuLoc() {
+        DialogXViewLoc result = new DialogXViewLoc();
 
-    private void refreshMenuBodyLoc() {
-        if (getDialogImpl() == null || getDialogImpl().boxRoot == null) {
-            return;
-        }
         MaxRelativeLayout boxBody = getDialogImpl().boxBody;
         DialogXBaseRelativeLayout boxRoot = getDialogImpl().boxRoot;
         //菜单位置计算逻辑
@@ -364,22 +351,33 @@ public class PopMenu extends BaseDialog {
                     calY = boxRoot.getUseAreaHeight() - boxBody.getHeight();
                 }
             }
+            result.setX(calX).setY(calY);
+        } else {
+            int mHeight = PopMenu.this.height == -1 ? baseView.getHeight() : PopMenu.this.height;
+            int left = (int) baseViewLoc.getX();
+            int top = (int) (baseViewLoc.getY() + (overlayBaseView ? 0 : mHeight) + selectItemYDeviation);
 
-            menuLocX = calX;
-            boxBody.setX(calX);
-
-            menuLocY = calY;
-            calY = calY + selectItemYDeviation;
-            boxBody.setY(calY);
-
-            int mWidth = PopMenu.this.width == -1 ? baseView.getWidth() : PopMenu.this.width;
-            if (mWidth != 0 && getDialogImpl().boxBody.getWidth() != mWidth) {
-                RelativeLayout.LayoutParams rLp = new RelativeLayout.LayoutParams(mWidth, ViewGroup.LayoutParams.WRAP_CONTENT);
-                getDialogImpl().boxBody.setLayoutParams(rLp);
+            if (!offScreen) {
+                if (left < 0) {
+                    left = 0;
+                }
+                if ((left + boxBody.getWidth()) > boxRoot.getUseAreaWidth()) {
+                    left = boxRoot.getUseAreaWidth() - boxBody.getWidth();
+                }
+                if (top < 0) {
+                    top = 0;
+                }
+                if ((top + boxBody.getHeight()) > boxRoot.getUseAreaHeight()) {
+                    top = boxRoot.getUseAreaHeight() - boxBody.getHeight();
+                }
             }
-        } else {
-            setInitMenuBodyLoc();
+            result.setX(left).setY(top);
         }
+
+        int mWidth = PopMenu.this.width == -1 ? baseView.getWidth() : PopMenu.this.width;
+        int mHeight = PopMenu.this.height == -1 ? baseView.getHeight() : PopMenu.this.height;
+        result.setW(mWidth).setH(mHeight);
+        return result;
     }
 
     protected PopMenuArrayAdapter menuListAdapter;
@@ -398,6 +396,7 @@ public class PopMenu extends BaseDialog {
             boxBody = convertView.findViewById(R.id.box_body);
             boxCustom = convertView.findViewById(R.id.box_custom);
             listMenu = convertView.findViewById(R.id.listMenu);
+            boxBody.setVisibility(View.INVISIBLE);
             //先设置为 -1 表示未初始化位置
             boxBody.setX(-1);
             boxBody.setY(-1);
@@ -420,6 +419,7 @@ public class PopMenu extends BaseDialog {
                     lifecycle.setCurrentState(Lifecycle.State.CREATED);
                     onDialogShow();
                     getDialogLifecycleCallback().onShow(me);
+                    PopMenu.this.onShow(me);
                     refreshUI();
                 }
 
@@ -427,6 +427,7 @@ public class PopMenu extends BaseDialog {
                 public void onDismiss() {
                     isShow = false;
                     getDialogLifecycleCallback().onDismiss(me);
+                    PopMenu.this.onDismiss(me);
                     menuListAdapter = null;
                     dialogImpl = null;
                     baseView = null;
@@ -638,29 +639,28 @@ public class PopMenu extends BaseDialog {
                                 }
                             }
 
-                            refreshMenuBodyLoc();
-                            selectItemYDeviation = (int) (menuLocY - baseViewLoc.getY());
+                            refreshMenuLoc();
+                            selectItemYDeviation = (int) (getMenuLoc().getY() - baseViewLoc.getY());
 
                             //展开动画
                             ValueAnimator enterAnim = ValueAnimator.ofFloat(0f, 1f);
                             enterAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
                                 @Override
                                 public void onAnimationUpdate(ValueAnimator animation) {
-                                    float interpolatedTime = (float) animation.getAnimatedValue();
-                                    int aimHeight = interpolatedTime == 1 ? ViewGroup.LayoutParams.WRAP_CONTENT : (int) (targetHeight * interpolatedTime);
+                                    float animatedValue = (float) animation.getAnimatedValue();
+                                    isAnimRunning = animatedValue != 1f;
+
+                                    DialogXViewLoc loc = getMenuLoc();
+
+                                    int aimHeight = animatedValue == 1f ? ViewGroup.LayoutParams.WRAP_CONTENT : (int) (targetHeight * animatedValue);
                                     boxBody.getLayoutParams().height = aimHeight;
                                     boxBody.getLayoutParams().width = getWidth() == -1 ? baseView.getWidth() : getWidth();
                                     if ((boxBody.getY() + aimHeight) > boxRoot.getSafeHeight()) {
                                         boxBody.setY(boxRoot.getSafeHeight() - aimHeight);
                                     }
-                                    float calX = menuLocX != -1 ? menuLocX : baseViewLoc.getX();
-                                    float calY = baseViewLoc.getY() + selectItemYDeviation * interpolatedTime;
-                                    if ((calX + boxBody.getWidth()) > boxRoot.getUseAreaWidth()) {
-                                        calX = boxRoot.getUseAreaWidth() - boxBody.getWidth();
-                                    }
-                                    if ((calY + boxBody.getHeight()) > boxRoot.getUseAreaHeight()) {
-                                        calY = boxRoot.getUseAreaHeight() - boxBody.getHeight();
-                                    }
+                                    float calX = loc.getX() != -1 ? loc.getX() : baseViewLoc.getX();
+                                    float calY = baseViewLoc.getY() + selectItemYDeviation * animatedValue;
+
                                     if (!offScreen) {
                                         if (calX < 0) {
                                             calX = 0;
@@ -668,17 +668,25 @@ public class PopMenu extends BaseDialog {
                                         if (calY < 0) {
                                             calY = 0;
                                         }
+                                        if ((calX + boxBody.getWidth()) > boxRoot.getUseAreaWidth()) {
+                                            calX = boxRoot.getUseAreaWidth() - boxBody.getWidth();
+                                        }
+                                        if ((calY + boxBody.getHeight()) > boxRoot.getUseAreaHeight()) {
+                                            calY = boxRoot.getUseAreaHeight() - boxBody.getHeight();
+                                        }
                                     }
                                     boxBody.setX(calX);
                                     boxBody.setY(calY);
 
                                     boxBody.requestLayout();
+                                    if (boxBody.getVisibility() != VISIBLE) {
+                                        boxBody.setVisibility(View.VISIBLE);
+                                    }
                                 }
                             });
                             enterAnim.setInterpolator(new DecelerateInterpolator(2f));
                             enterAnim.setDuration(enterAnimDurationTemp);
                             enterAnim.start();
-                            boxBody.setVisibility(View.VISIBLE);
 
                             //模糊背景
                             if (getStyle().popMenuSettings() != null &&
@@ -1000,7 +1008,7 @@ public class PopMenu extends BaseDialog {
 
     public PopMenu setAlignGravity(int alignGravity) {
         this.alignGravity = alignGravity;
-        refreshMenuBodyLoc();
+        refreshMenuLoc();
         return this;
     }
 
@@ -1152,4 +1160,44 @@ public class PopMenu extends BaseDialog {
         refreshUI();
         return this;
     }
+
+    /**
+     * 用于使用 new 构建实例时,override 的生命周期事件
+     * 例如:
+     * new PopMenu() {
+     *     @Override
+     *     public void onShow(PopMenu dialog) {
+     *         //...
+     *     }
+     * }
+     *
+     * @param dialog self
+     */
+    public void onShow(PopMenu dialog){
+
+    }
+
+    /**
+     * 用于使用 new 构建实例时,override 的生命周期事件
+     * 例如:
+     * new PopMenu() {
+     *     @Override
+     *     public boolean onDismiss(PopMenu dialog) {
+     *         WaitDialog.show("Please Wait...");
+     *         if (dialog.getButtonSelectResult() == BUTTON_SELECT_RESULT.BUTTON_OK) {
+     *             //点击了OK的情况
+     *             //...
+     *         } else {
+     *             //其他按钮点击、对话框dismiss的情况
+     *             //...
+     *         }
+     *         return false;
+     *     }
+     * }
+     * @param dialog self
+     */
+    //用于使用 new 构建实例时,override 的生命周期事件
+    public void onDismiss(PopMenu dialog){
+
+    }
 }

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

@@ -547,6 +547,7 @@ public class PopNotification extends BaseDialog implements NoTouchInterface {
 
                     onDialogShow();
                     getDialogLifecycleCallback().onShow(me);
+                    PopNotification.this.onShow(me);
                 }
 
                 @Override
@@ -556,6 +557,7 @@ public class PopNotification extends BaseDialog implements NoTouchInterface {
                     }
                     isShow = false;
                     getDialogLifecycleCallback().onDismiss(me);
+                    PopNotification.this.onDismiss(me);
                     dialogImpl = null;
                     lifecycle.setCurrentState(Lifecycle.State.DESTROYED);
                     System.gc();
@@ -1426,4 +1428,44 @@ public class PopNotification extends BaseDialog implements NoTouchInterface {
         refreshUI();
         return this;
     }
+
+    /**
+     * 用于使用 new 构建实例时,override 的生命周期事件
+     * 例如:
+     * new PopNotification() {
+     *     @Override
+     *     public void onShow(PopNotification dialog) {
+     *         //...
+     *     }
+     * }
+     *
+     * @param dialog self
+     */
+    public void onShow(PopNotification dialog){
+
+    }
+
+    /**
+     * 用于使用 new 构建实例时,override 的生命周期事件
+     * 例如:
+     * new PopNotification() {
+     *     @Override
+     *     public boolean onDismiss(PopNotification dialog) {
+     *         WaitDialog.show("Please Wait...");
+     *         if (dialog.getButtonSelectResult() == BUTTON_SELECT_RESULT.BUTTON_OK) {
+     *             //点击了OK的情况
+     *             //...
+     *         } else {
+     *             //其他按钮点击、对话框dismiss的情况
+     *             //...
+     *         }
+     *         return false;
+     *     }
+     * }
+     * @param dialog self
+     */
+    //用于使用 new 构建实例时,override 的生命周期事件
+    public void onDismiss(PopNotification dialog){
+
+    }
 }

File diff suppressed because it is too large
+ 170 - 144
DialogX/src/main/java/com/kongzue/dialogx/dialogs/PopTip.java


+ 43 - 2
DialogX/src/main/java/com/kongzue/dialogx/dialogs/WaitDialog.java

@@ -352,7 +352,8 @@ public class WaitDialog extends BaseDialog {
                             });
 
                             onDialogShow();
-                            getDialogLifecycleCallback().onShow(me());
+                            getDialogLifecycleCallback().onShow(WaitDialog.this);
+                            WaitDialog.this.onShow(WaitDialog.this);
 
                             lifecycle.setCurrentState(Lifecycle.State.RESUMED);
                         }
@@ -362,7 +363,8 @@ public class WaitDialog extends BaseDialog {
                 @Override
                 public void onDismiss() {
                     isShow = false;
-                    getDialogLifecycleCallback().onDismiss(me());
+                    getDialogLifecycleCallback().onDismiss(WaitDialog.this);
+                    WaitDialog.this.onDismiss(WaitDialog.this);
                     if (dialogImpl != null) dialogImpl.clear();
                     dialogImpl = null;
                     if (dialogView != null) dialogView.clear();
@@ -1148,4 +1150,43 @@ public class WaitDialog extends BaseDialog {
         refreshUI();
         return this;
     }
+
+    /**
+     * 用于使用 new 构建实例时,override 的生命周期事件
+     * 例如:
+     * new WaitDialog() {
+     *
+     * @param dialog self
+     * @Override public void onShow(WaitDialog dialog) {
+     * //...
+     * }
+     * }
+     */
+    public void onShow(WaitDialog dialog) {
+
+    }
+
+    /**
+     * 用于使用 new 构建实例时,override 的生命周期事件
+     * 例如:
+     * new WaitDialog() {
+     *
+     * @param dialog self
+     * @Override public boolean onDismiss(WaitDialog dialog) {
+     * WaitDialog.show("Please Wait...");
+     * if (dialog.getButtonSelectResult() == BUTTON_SELECT_RESULT.BUTTON_OK) {
+     * //点击了OK的情况
+     * //...
+     * } else {
+     * //其他按钮点击、对话框dismiss的情况
+     * //...
+     * }
+     * return false;
+     * }
+     * }
+     */
+    //用于使用 new 构建实例时,override 的生命周期事件
+    public void onDismiss(WaitDialog dialog) {
+
+    }
 }

+ 65 - 65
DialogXIOSStyle/src/main/res/layout/layout_dialogx_popnotification_ios.xml

@@ -21,83 +21,83 @@
         android:clickable="true"
         android:tag="blurBody">
 
-        <ImageView
-            android:id="@+id/img_dialogx_pop_icon"
-            android:layout_width="45dp"
-            android:layout_height="45dp"
-            android:layout_centerVertical="true"
-            android:layout_marginLeft="15dp"
-            android:layout_marginTop="15dp"
-            android:layout_marginBottom="15dp"
-            android:visibility="gone" />
-
-        <LinearLayout
+        <RelativeLayout
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:layout_centerVertical="true"
-            android:layout_marginLeft="10dp"
-            android:layout_toLeftOf="@+id/txt_dialogx_button"
-            android:layout_toRightOf="@+id/img_dialogx_pop_icon"
-            android:gravity="center_vertical"
-            android:orientation="vertical">
+            android:paddingTop="15dp"
+            android:paddingBottom="15dp">
 
-            <TextView
-                android:id="@+id/txt_dialogx_pop_title"
+            <ImageView
+                android:id="@+id/img_dialogx_pop_icon"
+                android:layout_width="45dp"
+                android:layout_height="45dp"
+                android:layout_centerVertical="true"
+                android:layout_marginLeft="15dp"
+                android:visibility="gone" />
+
+            <LinearLayout
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
+                android:layout_centerVertical="true"
                 android:layout_marginLeft="10dp"
-                android:layout_marginTop="15dp"
-                android:layout_marginRight="15dp"
-                android:layout_marginBottom="15dp"
-                android:layout_weight="1"
-                android:gravity="left|center_vertical"
-                android:text="Notification!"
-                android:textColor="@color/black"
-                android:textSize="14dp"
-                android:textStyle="bold" />
+                android:layout_toLeftOf="@+id/txt_dialogx_button"
+                android:layout_toRightOf="@+id/img_dialogx_pop_icon"
+                android:gravity="center_vertical"
+                android:orientation="vertical">
+
+                <TextView
+                    android:id="@+id/txt_dialogx_pop_title"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:layout_marginLeft="10dp"
+                    android:layout_marginRight="15dp"
+                    android:layout_weight="1"
+                    android:gravity="left|center_vertical"
+                    android:text="Notification!"
+                    android:textColor="@color/black"
+                    android:textSize="14dp"
+                    android:textStyle="bold" />
+
+                <TextView
+                    android:id="@+id/txt_dialogx_pop_message"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:layout_marginLeft="10dp"
+                    android:layout_marginRight="15dp"
+                    android:layout_weight="1"
+                    android:gravity="left|center_vertical"
+                    android:text="Notification!"
+                    android:textColor="@color/black70"
+                    android:textSize="14dp"
+                    android:visibility="gone" />
+
+                <RelativeLayout
+                    android:id="@+id/box_custom"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:visibility="gone" />
+            </LinearLayout>
 
             <TextView
-                android:id="@+id/txt_dialogx_pop_message"
-                android:layout_width="match_parent"
+                android:id="@+id/txt_dialogx_button"
+                android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
-                android:layout_marginLeft="10dp"
-                android:layout_marginTop="-15dp"
+                android:layout_alignParentRight="true"
+                android:layout_centerVertical="true"
+                android:layout_marginLeft="5dp"
                 android:layout_marginRight="15dp"
-                android:layout_marginBottom="15dp"
-                android:layout_weight="1"
-                android:visibility="gone"
+                android:background="@drawable/button_dialogx_ios_circle"
                 android:gravity="left|center_vertical"
-                android:text="Notification!"
-                android:textColor="@color/black70"
-                android:textSize="14dp"/>
-
-            <RelativeLayout
-                android:id="@+id/box_custom"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
+                android:paddingLeft="15dp"
+                android:paddingTop="7dp"
+                android:paddingRight="15dp"
+                android:paddingBottom="7dp"
+                android:singleLine="true"
+                android:text="Dismiss"
+                android:textColor="@color/dialogxColorBlue"
+                android:textSize="14dp"
                 android:visibility="gone" />
-        </LinearLayout>
-
-        <TextView
-            android:id="@+id/txt_dialogx_button"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_alignParentRight="true"
-            android:layout_centerVertical="true"
-            android:layout_marginLeft="5dp"
-            android:layout_marginRight="15dp"
-            android:layout_marginBottom="10dp"
-            android:background="@drawable/button_dialogx_ios_circle"
-            android:gravity="left|center_vertical"
-            android:paddingLeft="15dp"
-            android:paddingTop="7dp"
-            android:paddingRight="15dp"
-            android:paddingBottom="7dp"
-            android:singleLine="true"
-            android:text="Dismiss"
-            android:textColor="@color/dialogxColorBlue"
-            android:textSize="14dp"
-            android:visibility="gone" />
+        </RelativeLayout>
 
     </com.kongzue.dialogx.util.views.MaxRelativeLayout>
 

+ 65 - 65
DialogXIOSStyle/src/main/res/layout/layout_dialogx_popnotification_ios_dark.xml

@@ -16,83 +16,83 @@
         android:clickable="true"
         android:tag="blurBody">
 
-        <ImageView
-            android:id="@+id/img_dialogx_pop_icon"
-            android:layout_width="45dp"
-            android:layout_height="45dp"
-            android:layout_centerVertical="true"
-            android:layout_marginLeft="15dp"
-            android:layout_marginTop="15dp"
-            android:layout_marginBottom="15dp"
-            android:visibility="gone" />
-
-        <LinearLayout
+        <RelativeLayout
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:layout_centerVertical="true"
-            android:layout_marginLeft="10dp"
-            android:layout_toLeftOf="@+id/txt_dialogx_button"
-            android:layout_toRightOf="@+id/img_dialogx_pop_icon"
-            android:gravity="center_vertical"
-            android:orientation="vertical">
+            android:paddingTop="15dp"
+            android:paddingBottom="15dp">
 
-            <TextView
-                android:id="@+id/txt_dialogx_pop_title"
+            <ImageView
+                android:id="@+id/img_dialogx_pop_icon"
+                android:layout_width="45dp"
+                android:layout_height="45dp"
+                android:layout_centerVertical="true"
+                android:layout_marginLeft="15dp"
+                android:visibility="gone" />
+
+            <LinearLayout
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
+                android:layout_centerVertical="true"
                 android:layout_marginLeft="10dp"
-                android:layout_marginTop="15dp"
-                android:layout_marginRight="15dp"
-                android:layout_marginBottom="15dp"
-                android:layout_weight="1"
-                android:gravity="left|center_vertical"
-                android:text="Notification!"
-                android:textColor="@color/white"
-                android:textSize="14dp"
-                android:textStyle="bold" />
+                android:layout_toLeftOf="@+id/txt_dialogx_button"
+                android:layout_toRightOf="@+id/img_dialogx_pop_icon"
+                android:gravity="center_vertical"
+                android:orientation="vertical">
+
+                <TextView
+                    android:id="@+id/txt_dialogx_pop_title"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:layout_marginLeft="10dp"
+                    android:layout_marginRight="15dp"
+                    android:layout_weight="1"
+                    android:gravity="left|center_vertical"
+                    android:text="Notification!"
+                    android:textColor="@color/white"
+                    android:textSize="14dp"
+                    android:textStyle="bold" />
+
+                <TextView
+                    android:id="@+id/txt_dialogx_pop_message"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:layout_marginLeft="10dp"
+                    android:layout_marginRight="15dp"
+                    android:layout_weight="1"
+                    android:gravity="left|center_vertical"
+                    android:text="Notification!"
+                    android:textColor="@color/white70"
+                    android:textSize="14dp"
+                    android:visibility="gone" />
+
+                <RelativeLayout
+                    android:id="@+id/box_custom"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:visibility="gone" />
+            </LinearLayout>
 
             <TextView
-                android:id="@+id/txt_dialogx_pop_message"
-                android:layout_width="match_parent"
+                android:id="@+id/txt_dialogx_button"
+                android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
-                android:layout_marginLeft="10dp"
-                android:layout_marginTop="-15dp"
+                android:layout_alignParentRight="true"
+                android:layout_centerVertical="true"
+                android:layout_marginLeft="5dp"
                 android:layout_marginRight="15dp"
-                android:layout_marginBottom="15dp"
-                android:layout_weight="1"
-                android:visibility="gone"
+                android:background="@drawable/button_dialogx_ios_circle_night"
                 android:gravity="left|center_vertical"
-                android:text="Notification!"
-                android:textColor="@color/white70"
-                android:textSize="14dp"/>
-
-            <RelativeLayout
-                android:id="@+id/box_custom"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
+                android:paddingLeft="15dp"
+                android:paddingTop="7dp"
+                android:paddingRight="15dp"
+                android:paddingBottom="7dp"
+                android:singleLine="true"
+                android:text="Dismiss"
+                android:textColor="@color/dialogxPopButtonBlueDark"
+                android:textSize="14dp"
                 android:visibility="gone" />
-        </LinearLayout>
-
-        <TextView
-            android:id="@+id/txt_dialogx_button"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_alignParentRight="true"
-            android:layout_centerVertical="true"
-            android:layout_marginLeft="5dp"
-            android:layout_marginRight="15dp"
-            android:layout_marginBottom="10dp"
-            android:background="@drawable/button_dialogx_ios_circle_night"
-            android:gravity="left|center_vertical"
-            android:paddingLeft="15dp"
-            android:paddingTop="7dp"
-            android:paddingRight="15dp"
-            android:paddingBottom="7dp"
-            android:singleLine="true"
-            android:text="Dismiss"
-            android:textColor="@color/dialogxPopButtonBlueDark"
-            android:textSize="14dp"
-            android:visibility="gone" />
+        </RelativeLayout>
 
     </com.kongzue.dialogx.util.views.MaxRelativeLayout>
 

+ 14 - 16
DialogXMIUIStyle/src/main/res/layout/layout_dialogx_popnotification_miui.xml

@@ -9,16 +9,18 @@
 
     <com.kongzue.dialogx.util.views.MaxLinearLayout
         android:id="@+id/box_body"
-        android:alpha="0.98"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:layout_marginLeft="15dp"
         android:layout_marginRight="15dp"
+        android:alpha="0.98"
         android:background="@drawable/rect_dialogx_miui_popnotification_bkg"
         android:clickable="true"
         android:elevation="20dp"
         android:gravity="center_vertical"
-        android:orientation="horizontal">
+        android:orientation="horizontal"
+        android:paddingTop="15dp"
+        android:paddingBottom="15dp">
 
         <ImageView
             android:id="@+id/img_dialogx_pop_icon"
@@ -26,8 +28,7 @@
             android:layout_height="23dp"
             android:layout_gravity="top"
             android:layout_marginLeft="18dp"
-            android:layout_marginTop="18dp"
-            android:layout_marginBottom="15dp"/>
+            android:layout_marginTop="3dp" />
 
         <LinearLayout
             android:layout_width="match_parent"
@@ -40,9 +41,7 @@
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
                 android:layout_marginLeft="15dp"
-                android:layout_marginTop="15dp"
                 android:layout_marginRight="15dp"
-                android:layout_marginBottom="18dp"
                 android:gravity="left|center_vertical"
                 android:text="Notification!"
                 android:textColor="@color/black"
@@ -54,22 +53,26 @@
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
                 android:layout_marginLeft="15dp"
-                android:layout_marginTop="-15dp"
+                android:layout_marginTop="5dp"
                 android:layout_marginRight="15dp"
-                android:layout_marginBottom="20dp"
+                android:layout_marginBottom="5dp"
                 android:gravity="left|center_vertical"
                 android:text="Notification!"
                 android:textColor="@color/black60"
-                android:textSize="13dp"/>
+                android:textSize="13dp" />
+
+            <RelativeLayout
+                android:id="@+id/box_custom"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content" />
 
             <TextView
                 android:id="@+id/txt_dialogx_button"
                 android:layout_width="wrap_content"
                 android:layout_height="match_parent"
                 android:layout_marginLeft="15dp"
-                android:layout_marginTop="-10dp"
+                android:layout_marginTop="5dp"
                 android:layout_marginRight="5dp"
-                android:layout_marginBottom="14dp"
                 android:background="@drawable/button_dialogx_miui_light"
                 android:gravity="left|center_vertical"
                 android:paddingLeft="15dp"
@@ -80,11 +83,6 @@
                 android:text="Dismiss"
                 android:textColor="@color/dialogxColorMIUINotificationButton"
                 android:textSize="12dp" />
-
-            <RelativeLayout
-                android:id="@+id/box_custom"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content" />
         </LinearLayout>
 
     </com.kongzue.dialogx.util.views.MaxLinearLayout>

+ 14 - 16
DialogXMIUIStyle/src/main/res/layout/layout_dialogx_popnotification_miui_dark.xml

@@ -9,16 +9,18 @@
 
     <com.kongzue.dialogx.util.views.MaxLinearLayout
         android:id="@+id/box_body"
-        android:alpha="0.98"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:layout_marginLeft="15dp"
         android:layout_marginRight="15dp"
+        android:alpha="0.98"
         android:background="@drawable/rect_dialogx_miui_popnotification_bkg_night"
         android:clickable="true"
         android:elevation="20dp"
         android:gravity="center_vertical"
-        android:orientation="horizontal">
+        android:orientation="horizontal"
+        android:paddingTop="15dp"
+        android:paddingBottom="15dp">
 
         <ImageView
             android:id="@+id/img_dialogx_pop_icon"
@@ -26,8 +28,7 @@
             android:layout_height="23dp"
             android:layout_gravity="top"
             android:layout_marginLeft="18dp"
-            android:layout_marginTop="18dp"
-            android:layout_marginBottom="15dp"/>
+            android:layout_marginTop="3dp" />
 
         <LinearLayout
             android:layout_width="match_parent"
@@ -40,9 +41,7 @@
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
                 android:layout_marginLeft="15dp"
-                android:layout_marginTop="15dp"
                 android:layout_marginRight="15dp"
-                android:layout_marginBottom="18dp"
                 android:gravity="left|center_vertical"
                 android:text="Notification!"
                 android:textColor="@color/white"
@@ -54,22 +53,26 @@
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
                 android:layout_marginLeft="15dp"
-                android:layout_marginTop="-15dp"
+                android:layout_marginTop="5dp"
                 android:layout_marginRight="15dp"
-                android:layout_marginBottom="20dp"
+                android:layout_marginBottom="5dp"
                 android:gravity="left|center_vertical"
                 android:text="Notification!"
                 android:textColor="@color/white60"
-                android:textSize="13dp"/>
+                android:textSize="13dp" />
+
+            <RelativeLayout
+                android:id="@+id/box_custom"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content" />
 
             <TextView
                 android:id="@+id/txt_dialogx_button"
                 android:layout_width="wrap_content"
                 android:layout_height="match_parent"
                 android:layout_marginLeft="15dp"
-                android:layout_marginTop="-10dp"
+                android:layout_marginTop="5dp"
                 android:layout_marginRight="5dp"
-                android:layout_marginBottom="14dp"
                 android:background="@drawable/button_dialogx_miui_night"
                 android:gravity="left|center_vertical"
                 android:paddingLeft="15dp"
@@ -80,11 +83,6 @@
                 android:text="Dismiss"
                 android:textColor="@color/dialogxColorMIUINotificationButtonNight"
                 android:textSize="12dp" />
-
-            <RelativeLayout
-                android:id="@+id/box_custom"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content" />
         </LinearLayout>
 
     </com.kongzue.dialogx.util.views.MaxLinearLayout>

+ 15 - 19
DialogXMaterialYou/src/main/res/layout/layout_dialogx_popnotification_material_you.xml

@@ -13,22 +13,23 @@
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:layout_marginLeft="15dp"
-        android:layout_marginRight="15dp"
         android:layout_marginTop="10dp"
+        android:layout_marginRight="15dp"
         android:background="@drawable/rect_dialogx_material_you_popnotification_bkg"
         android:clickable="true"
         android:elevation="10dp"
         android:gravity="center_vertical"
-        android:orientation="horizontal">
+        android:orientation="horizontal"
+        android:outlineSpotShadowColor="@color/black30"
+        android:paddingTop="18dp"
+        android:paddingBottom="13dp">
 
         <ImageView
             android:id="@+id/img_dialogx_pop_icon"
             android:layout_width="30dp"
             android:layout_height="30dp"
             android:layout_marginLeft="15dp"
-            android:layout_marginTop="15dp"
             android:layout_marginRight="-10dp"
-            android:layout_marginBottom="15dp"
             android:visibility="gone" />
 
         <LinearLayout
@@ -42,39 +43,39 @@
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
                 android:layout_marginLeft="25dp"
-                android:layout_marginTop="18dp"
                 android:layout_marginRight="20dp"
-                android:layout_marginBottom="18dp"
+                android:layout_marginBottom="5dp"
                 android:layout_weight="1"
                 android:gravity="left|center_vertical"
                 android:text="Notification!"
                 android:textColor="@color/black"
-                android:textSize="14dp"
-                android:textStyle="bold" />
+                android:textSize="16dp" />
 
             <TextView
                 android:id="@+id/txt_dialogx_pop_message"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
                 android:layout_marginLeft="25dp"
-                android:layout_marginTop="-15dp"
                 android:layout_marginRight="15dp"
-                android:layout_marginBottom="20dp"
+                android:layout_marginBottom="7dp"
                 android:layout_weight="1"
                 android:gravity="left|center_vertical"
                 android:text="Notification!"
                 android:textColor="@color/black70"
-                android:visibility="gone"
-                android:textSize="14dp"/>
+                android:textSize="14dp"
+                android:visibility="gone" />
+
+            <RelativeLayout
+                android:id="@+id/box_custom"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content" />
 
             <TextView
                 android:id="@+id/txt_dialogx_button"
                 android:layout_width="wrap_content"
                 android:layout_height="match_parent"
                 android:layout_marginLeft="10dp"
-                android:layout_marginTop="-20dp"
                 android:layout_marginRight="5dp"
-                android:layout_marginBottom="10dp"
                 android:background="@drawable/button_dialogx_material_you_light"
                 android:gravity="left|center_vertical"
                 android:paddingLeft="15dp"
@@ -86,11 +87,6 @@
                 android:textColor="@color/dialogxColorBlue"
                 android:textSize="14dp"
                 android:visibility="gone" />
-
-            <RelativeLayout
-                android:id="@+id/box_custom"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content" />
         </LinearLayout>
 
     </com.kongzue.dialogx.util.views.MaxLinearLayout>

+ 15 - 19
DialogXMaterialYou/src/main/res/layout/layout_dialogx_popnotification_material_you_dark.xml

@@ -4,8 +4,8 @@
     android:id="@+id/box_root"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
-    android:theme="@style/DialogXCompatThemeNight"
     android:orientation="vertical"
+    android:theme="@style/DialogXCompatThemeNight"
     app:baseFocusable="false">
 
     <com.kongzue.dialogx.util.views.MaxLinearLayout
@@ -13,22 +13,22 @@
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:layout_marginLeft="15dp"
-        android:layout_marginRight="15dp"
         android:layout_marginTop="10dp"
+        android:layout_marginRight="15dp"
         android:background="@drawable/rect_dialogx_material_you_popnotification_bkg_night"
         android:clickable="true"
         android:elevation="10dp"
         android:gravity="center_vertical"
-        android:orientation="horizontal">
+        android:orientation="horizontal"
+        android:paddingTop="18dp"
+        android:paddingBottom="13dp">
 
         <ImageView
             android:id="@+id/img_dialogx_pop_icon"
             android:layout_width="30dp"
             android:layout_height="30dp"
             android:layout_marginLeft="15dp"
-            android:layout_marginTop="15dp"
             android:layout_marginRight="-10dp"
-            android:layout_marginBottom="15dp"
             android:visibility="gone" />
 
         <LinearLayout
@@ -42,9 +42,8 @@
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
                 android:layout_marginLeft="25dp"
-                android:layout_marginTop="18dp"
                 android:layout_marginRight="20dp"
-                android:layout_marginBottom="18dp"
+                android:layout_marginBottom="5dp"
                 android:layout_weight="1"
                 android:gravity="left|center_vertical"
                 android:text="Notification!"
@@ -57,24 +56,27 @@
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
                 android:layout_marginLeft="25dp"
-                android:layout_marginTop="-15dp"
                 android:layout_marginRight="15dp"
-                android:layout_marginBottom="20dp"
-                android:visibility="gone"
+                android:layout_marginBottom="7dp"
                 android:layout_weight="1"
                 android:gravity="left|center_vertical"
                 android:text="Notification!"
                 android:textColor="@color/white70"
-                android:textSize="14dp"/>
+                android:textSize="14dp"
+                android:visibility="gone" />
+
+            <RelativeLayout
+                android:id="@+id/box_custom"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:visibility="gone" />
 
             <TextView
                 android:id="@+id/txt_dialogx_button"
                 android:layout_width="wrap_content"
                 android:layout_height="match_parent"
                 android:layout_marginLeft="10dp"
-                android:layout_marginTop="-20dp"
                 android:layout_marginRight="5dp"
-                android:layout_marginBottom="10dp"
                 android:background="@drawable/button_dialogx_material_you_night"
                 android:gravity="left|center_vertical"
                 android:paddingLeft="15dp"
@@ -86,12 +88,6 @@
                 android:textColor="@color/dialogxPopButtonBlueDark"
                 android:textSize="14dp"
                 android:visibility="gone" />
-
-            <RelativeLayout
-                android:id="@+id/box_custom"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:visibility="gone" />
         </LinearLayout>
 
 

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

@@ -1,5 +1,7 @@
 package com.kongzue.dialogxdemo.activity;
 
+import static com.kongzue.dialogx.dialogs.PopTip.tip;
+
 import android.animation.ValueAnimator;
 import android.content.ActivityNotFoundException;
 import android.content.Context;
@@ -313,6 +315,33 @@ public class MainActivity extends BaseActivity {
 //                }
 //            }
 //        });
+
+//        //复写事件演示
+//        new MessageDialog() {
+//            @Override
+//            public void onShow(MessageDialog dialog) {
+//                //...
+//                tip("onShow");
+//            }
+//
+//            @Override
+//            public void onDismiss(MessageDialog dialog) {
+//                WaitDialog.show("Please Wait...");
+//                if (dialog.getButtonSelectResult() == BUTTON_SELECT_RESULT.BUTTON_OK) {
+//                    //点击了OK的情况
+//                    //...
+//                } else {
+//                    //其他按钮点击、对话框dismiss的情况
+//                    //...
+//                }
+//                tip("onDismiss");
+//            }
+//        }
+//                .setTitle("Title")
+//                .setMessage("message")
+//                .setOkButton("OK")
+//                .setCancelButton("Cancel")
+//                .show();
     }
 
     //用于模拟进度提示
@@ -452,6 +481,8 @@ public class MainActivity extends BaseActivity {
         btnSelectMenu.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View view) {
+                PopMenu.overrideEnterDuration = 500;
+                view.animate().x(0).setDuration(1000);
                 PopMenu.show(view, new String[]{"选项1", "选项2", "选项3"})
                         .setOnMenuItemClickListener(new OnMenuItemClickListener<PopMenu>() {
                             @Override
@@ -758,25 +789,26 @@ public class MainActivity extends BaseActivity {
             @Override
             public void onClick(View v) {
                 BottomDialog.show(new OnBindView<BottomDialog>(rdoDark.isChecked() ? R.layout.layout_custom_reply_dark : R.layout.layout_custom_reply) {
-                    @Override
-                    public void onBind(final BottomDialog dialog, View v) {
-                        btnReplyCommit = v.findViewById(R.id.btn_reply_commit);
-                        editReplyCommit = v.findViewById(R.id.edit_reply_commit);
-                        btnReplyCommit.setOnClickListener(new View.OnClickListener() {
                             @Override
-                            public void onClick(View v) {
-                                dialog.dismiss();
-                                PopTip.show("提交内容:\n" + editReplyCommit.getText().toString());
-                            }
-                        });
-                        editReplyCommit.postDelayed(new Runnable() {
-                            @Override
-                            public void run() {
-                                showIME(editReplyCommit);
+                            public void onBind(final BottomDialog dialog, View v) {
+                                btnReplyCommit = v.findViewById(R.id.btn_reply_commit);
+                                editReplyCommit = v.findViewById(R.id.edit_reply_commit);
+                                btnReplyCommit.setOnClickListener(new View.OnClickListener() {
+                                    @Override
+                                    public void onClick(View v) {
+                                        dialog.dismiss();
+                                        PopTip.show("提交内容:\n" + editReplyCommit.getText().toString());
+                                    }
+                                });
+                                editReplyCommit.postDelayed(new Runnable() {
+                                    @Override
+                                    public void run() {
+                                        showIME(editReplyCommit);
+                                    }
+                                }, 300);
                             }
-                        }, 300);
-                    }
-                }).setAllowInterceptTouch(false);
+                        })
+                        .setAllowInterceptTouch(false);
             }
         });
 

+ 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.48.beta7
+BUILD_VERSION=0.0.48.beta8
 BUILD_VERSION_INT=47
 DIALOGX_STYLE_VERSION=5

Some files were not shown because too many files changed in this diff