Browse Source

0.0.47.beta14 update

kongzue 2 years ago
parent
commit
71c0765cd9

+ 214 - 202
DialogX/src/main/java/com/kongzue/dialogx/dialogs/CustomDialog.java

@@ -38,7 +38,7 @@ import com.kongzue.dialogx.util.views.MaxRelativeLayout;
  * @createTime: 2020/10/20 11:59
  */
 public class CustomDialog extends BaseDialog {
-    
+
     public static int overrideEnterDuration = -1;
     public static int overrideExitDuration = -1;
     public static int overrideEnterAnimRes = 0;
@@ -59,14 +59,14 @@ public class CustomDialog extends BaseDialog {
     protected boolean bkgInterceptTouch = true;
     protected OnBackgroundMaskClickListener<CustomDialog> onBackgroundMaskClickListener;
     protected DialogXAnimInterface<CustomDialog> dialogXAnimImpl;
-    
+
     protected View baseView;
     protected int alignViewGravity = -1;                                    //指定菜单相对 baseView 的位置
     protected int width = -1;                                               //指定菜单宽度
     protected int height = -1;                                              //指定菜单高度
     protected int[] baseViewLoc;
     protected int[] marginRelativeBaseView = new int[4];
-    
+
     public enum ALIGN {
         CENTER,
         TOP,
@@ -86,39 +86,39 @@ public class CustomDialog extends BaseDialog {
         RIGHT_TOP,
         RIGHT_BOTTOM
     }
-    
+
     protected CustomDialog() {
         super();
     }
-    
+
     public static CustomDialog build() {
         return new CustomDialog();
     }
-    
+
     public static CustomDialog build(OnBindView<CustomDialog> onBindView) {
         return new CustomDialog().setCustomView(onBindView);
     }
-    
+
     public CustomDialog(OnBindView<CustomDialog> onBindView) {
         this.onBindView = onBindView;
     }
-    
+
     public static CustomDialog show(OnBindView<CustomDialog> onBindView) {
         CustomDialog customDialog = new CustomDialog(onBindView);
         customDialog.show();
         return customDialog;
     }
-    
+
     public static CustomDialog show(OnBindView<CustomDialog> onBindView, ALIGN align) {
         CustomDialog customDialog = new CustomDialog(onBindView);
         customDialog.align = align;
         customDialog.show();
         return customDialog;
     }
-    
+
     public CustomDialog show() {
         if (isHide && getDialogView() != null && isShow) {
-            if (hideWithExitAnim && getDialogImpl() != null) {
+            if (hideWithExitAnim && getDialogImpl() != null && getDialogImpl().boxCustom != null) {
                 getDialogView().setVisibility(View.VISIBLE);
                 getDialogImpl().getDialogXAnimImpl().doShowAnim(CustomDialog.this, new ObjectRunnable<Float>() {
                     @Override
@@ -143,7 +143,7 @@ public class CustomDialog extends BaseDialog {
         show(dialogView);
         return this;
     }
-    
+
     public CustomDialog show(Activity activity) {
         super.beforeShow();
         if (getDialogView() == null) {
@@ -154,22 +154,22 @@ public class CustomDialog extends BaseDialog {
         show(activity, dialogView);
         return this;
     }
-    
+
     public class DialogImpl implements DialogConvertViewInterface {
-        
+
         public DialogXBaseRelativeLayout boxRoot;
         public MaxRelativeLayout boxCustom;
-        
+
         public DialogImpl(View convertView) {
             if (convertView == null) return;
             boxRoot = convertView.findViewById(R.id.box_root);
             boxCustom = convertView.findViewById(R.id.box_custom);
-            
+
             init();
             dialogImpl = this;
             refreshView();
         }
-        
+
         @Override
         public void init() {
             if (baseViewLoc == null && baseView != null) {
@@ -182,15 +182,15 @@ public class CustomDialog extends BaseDialog {
                 public void onShow() {
                     isShow = true;
                     preShow = false;
-                    
+
                     lifecycle.setCurrentState(Lifecycle.State.CREATED);
-                    
+
                     getDialogLifecycleCallback().onShow(me);
                     onDialogShow();
-                    
+
                     boxCustom.setVisibility(View.GONE);
                 }
-                
+
                 @Override
                 public void onDismiss() {
                     isShow = false;
@@ -201,7 +201,7 @@ public class CustomDialog extends BaseDialog {
                     System.gc();
                 }
             });
-            
+
             boxRoot.setOnBackPressedListener(new DialogXBaseRelativeLayout.PrivateBackPressedListener() {
                 @Override
                 public boolean onBackPressed() {
@@ -217,7 +217,7 @@ public class CustomDialog extends BaseDialog {
                     return true;
                 }
             });
-            
+
             boxRoot.post(new Runnable() {
                 @Override
                 public void run() {
@@ -228,18 +228,20 @@ public class CustomDialog extends BaseDialog {
                             boxRoot.setBkgAlpha(value);
                         }
                     });
-                    getDialogImpl().boxCustom.setVisibility(View.VISIBLE);
-                    
+                    if (getDialogImpl().boxCustom != null) {
+                        getDialogImpl().boxCustom.setVisibility(View.VISIBLE);
+                    }
+
                     lifecycle.setCurrentState(Lifecycle.State.RESUMED);
                 }
             });
-            
+
             onDialogInit();
         }
-        
+
         boolean initSetCustomViewLayoutListener = false;
         ALIGN alignCache;
-        
+
         @Override
         public void refreshView() {
             if (boxRoot == null || getTopActivity() == null) {
@@ -248,10 +250,12 @@ public class CustomDialog extends BaseDialog {
             boxRoot.setRootPadding(screenPaddings[0], screenPaddings[1], screenPaddings[2], screenPaddings[3]);
             if (baseView != null) {
                 if (!initSetCustomViewLayoutListener) {
-                    RelativeLayout.LayoutParams rlp;
-                    rlp = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
-                    boxCustom.setLayoutParams(rlp);
-                    
+                    if (boxCustom != null) {
+                        RelativeLayout.LayoutParams rlp;
+                        rlp = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
+                        boxCustom.setLayoutParams(rlp);
+                    }
+
                     Runnable onLayoutChangeRunnable = new Runnable() {
                         @Override
                         public void run() {
@@ -269,7 +273,7 @@ public class CustomDialog extends BaseDialog {
                                     calX = (baseViewLeft + baseView.getMeasuredWidth() / 2 - boxCustom.getWidth() / 2);
                                     calY = (baseViewTop + baseView.getMeasuredHeight() / 2 - boxCustom.getHeight() / 2);
                                 }
-                                
+
                                 if (isAlignBaseViewGravity(Gravity.TOP)) {
                                     calY = baseViewTop - boxCustom.getHeight() - marginRelativeBaseView[3];
                                 }
@@ -284,15 +288,15 @@ public class CustomDialog extends BaseDialog {
                                 }
                                 baseViewLoc[2] = baseView.getWidth();
                                 baseViewLoc[3] = baseView.getHeight();
-                                
+
                                 if (calX != 0) boxCustom.setX(calX);
                                 if (calY != 0) boxCustom.setY(calY);
-                                
+
                                 onGetBaseViewLoc(baseViewLoc);
                             }
                         }
                     };
-                    
+
                     boxCustom.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
                         @Override
                         public void onGlobalLayout() {
@@ -303,69 +307,71 @@ public class CustomDialog extends BaseDialog {
                     initSetCustomViewLayoutListener = true;
                 }
             } else {
-                RelativeLayout.LayoutParams rlp;
-                rlp = ((RelativeLayout.LayoutParams) boxCustom.getLayoutParams());
-                if (rlp == null || (alignCache != null && alignCache != align)) {
-                    rlp = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
-                }
-                switch (align) {
-                    case TOP_LEFT:
-                    case LEFT_TOP:
-                        rlp.removeRule(RelativeLayout.CENTER_IN_PARENT);
-                        rlp.addRule(RelativeLayout.ALIGN_PARENT_TOP);
-                        rlp.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
-                        break;
-                    case TOP:
-                    case TOP_CENTER:
-                        rlp.removeRule(RelativeLayout.CENTER_IN_PARENT);
-                        rlp.addRule(RelativeLayout.ALIGN_PARENT_TOP);
-                        rlp.addRule(RelativeLayout.CENTER_HORIZONTAL);
-                        break;
-                    case TOP_RIGHT:
-                    case RIGHT_TOP:
-                        rlp.removeRule(RelativeLayout.CENTER_IN_PARENT);
-                        rlp.addRule(RelativeLayout.ALIGN_PARENT_TOP);
-                        rlp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
-                        break;
-                    case BOTTOM_LEFT:
-                    case LEFT_BOTTOM:
-                        rlp.removeRule(RelativeLayout.CENTER_IN_PARENT);
-                        rlp.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
-                        break;
-                    case BOTTOM:
-                    case BOTTOM_CENTER:
-                        rlp.removeRule(RelativeLayout.CENTER_IN_PARENT);
-                        rlp.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
-                        rlp.addRule(RelativeLayout.CENTER_HORIZONTAL);
-                        break;
-                    case BOTTOM_RIGHT:
-                    case RIGHT_BOTTOM:
-                        rlp.removeRule(RelativeLayout.CENTER_IN_PARENT);
-                        rlp.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
-                        rlp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
-                        break;
-                    case CENTER:
-                        rlp.removeRule(RelativeLayout.ALIGN_PARENT_TOP);
-                        rlp.removeRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
-                        rlp.addRule(RelativeLayout.CENTER_IN_PARENT);
-                        break;
-                    case LEFT:
-                    case LEFT_CENTER:
-                        rlp.removeRule(RelativeLayout.CENTER_IN_PARENT);
-                        rlp.addRule(RelativeLayout.ALIGN_PARENT_TOP);
-                        rlp.addRule(RelativeLayout.CENTER_VERTICAL);
-                        break;
-                    case RIGHT:
-                    case RIGHT_CENTER:
-                        rlp.removeRule(RelativeLayout.CENTER_IN_PARENT);
-                        rlp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
-                        rlp.addRule(RelativeLayout.CENTER_VERTICAL);
-                        break;
+                if (boxCustom != null) {
+                    RelativeLayout.LayoutParams rlp;
+                    rlp = ((RelativeLayout.LayoutParams) boxCustom.getLayoutParams());
+                    if (rlp == null || (alignCache != null && alignCache != align)) {
+                        rlp = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
+                    }
+                    switch (align) {
+                        case TOP_LEFT:
+                        case LEFT_TOP:
+                            rlp.removeRule(RelativeLayout.CENTER_IN_PARENT);
+                            rlp.addRule(RelativeLayout.ALIGN_PARENT_TOP);
+                            rlp.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
+                            break;
+                        case TOP:
+                        case TOP_CENTER:
+                            rlp.removeRule(RelativeLayout.CENTER_IN_PARENT);
+                            rlp.addRule(RelativeLayout.ALIGN_PARENT_TOP);
+                            rlp.addRule(RelativeLayout.CENTER_HORIZONTAL);
+                            break;
+                        case TOP_RIGHT:
+                        case RIGHT_TOP:
+                            rlp.removeRule(RelativeLayout.CENTER_IN_PARENT);
+                            rlp.addRule(RelativeLayout.ALIGN_PARENT_TOP);
+                            rlp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
+                            break;
+                        case BOTTOM_LEFT:
+                        case LEFT_BOTTOM:
+                            rlp.removeRule(RelativeLayout.CENTER_IN_PARENT);
+                            rlp.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
+                            break;
+                        case BOTTOM:
+                        case BOTTOM_CENTER:
+                            rlp.removeRule(RelativeLayout.CENTER_IN_PARENT);
+                            rlp.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
+                            rlp.addRule(RelativeLayout.CENTER_HORIZONTAL);
+                            break;
+                        case BOTTOM_RIGHT:
+                        case RIGHT_BOTTOM:
+                            rlp.removeRule(RelativeLayout.CENTER_IN_PARENT);
+                            rlp.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
+                            rlp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
+                            break;
+                        case CENTER:
+                            rlp.removeRule(RelativeLayout.ALIGN_PARENT_TOP);
+                            rlp.removeRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
+                            rlp.addRule(RelativeLayout.CENTER_IN_PARENT);
+                            break;
+                        case LEFT:
+                        case LEFT_CENTER:
+                            rlp.removeRule(RelativeLayout.CENTER_IN_PARENT);
+                            rlp.addRule(RelativeLayout.ALIGN_PARENT_TOP);
+                            rlp.addRule(RelativeLayout.CENTER_VERTICAL);
+                            break;
+                        case RIGHT:
+                        case RIGHT_CENTER:
+                            rlp.removeRule(RelativeLayout.CENTER_IN_PARENT);
+                            rlp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
+                            rlp.addRule(RelativeLayout.CENTER_VERTICAL);
+                            break;
+                    }
+                    alignCache = align;
+                    boxCustom.setLayoutParams(rlp);
                 }
-                alignCache = align;
-                boxCustom.setLayoutParams(rlp);
             }
-            
+
             boxRoot.setAutoUnsafePlacePadding(autoUnsafePlacePadding);
             if (bkgInterceptTouch) {
                 if (isCancelable()) {
@@ -383,28 +389,30 @@ public class CustomDialog extends BaseDialog {
             } else {
                 boxRoot.setClickable(false);
             }
-            
-            if (onBindView != null && onBindView.getCustomView() != null) {
+
+            if (onBindView != null && onBindView.getCustomView() != null && boxCustom!=null) {
                 onBindView.bindParent(boxCustom, me);
             }
-            
-            if (width != -1) {
-                boxCustom.setMaxWidth(width);
-                boxCustom.setMinimumWidth(width);
-            }
-            
-            if (height != -1) {
-                boxCustom.setMaxHeight(height);
-                boxCustom.setMinimumHeight(height);
+
+            if (boxCustom!=null) {
+                if (width != -1) {
+                    boxCustom.setMaxWidth(width);
+                    boxCustom.setMinimumWidth(width);
+                }
+
+                if (height != -1) {
+                    boxCustom.setMaxHeight(height);
+                    boxCustom.setMinimumHeight(height);
+                }
             }
-            
+
             boxRoot.setBackgroundColor(getMaskColor());
-            
+
             onDialogRefreshUI();
         }
-        
+
         long exitAnimDurationTemp = -1;
-        
+
         @Override
         public void doDismiss(View v) {
             if (v != null) v.setEnabled(false);
@@ -414,7 +422,7 @@ public class CustomDialog extends BaseDialog {
                     @Override
                     public void run() {
                         getDialogXAnimImpl().doExitAnim(CustomDialog.this, new ObjectRunnable<Float>() {
-                            
+
                             @Override
                             public void run(Float animProgress) {
                                 float value = animProgress;
@@ -431,18 +439,20 @@ public class CustomDialog extends BaseDialog {
                 });
             }
         }
-        
+
         protected DialogXAnimInterface<CustomDialog> getDialogXAnimImpl() {
             if (dialogXAnimImpl == null) {
                 dialogXAnimImpl = new DialogXAnimInterface<CustomDialog>() {
                     @Override
                     public void doShowAnim(CustomDialog customDialog, ObjectRunnable<Float> animProgress) {
                         Animation enterAnim = getEnterAnimation();
-                        boxCustom.setVisibility(View.VISIBLE);
-                        boxCustom.startAnimation(enterAnim);
-                        
+                        if (boxCustom!=null) {
+                            boxCustom.setVisibility(View.VISIBLE);
+                            boxCustom.startAnimation(enterAnim);
+                        }
+
                         boxRoot.setBackgroundColor(maskColor);
-                        
+
                         ValueAnimator bkgAlpha = ValueAnimator.ofFloat(0f, 1f);
                         bkgAlpha.setDuration(enterAnim.getDuration());
                         bkgAlpha.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@@ -453,7 +463,7 @@ public class CustomDialog extends BaseDialog {
                         });
                         bkgAlpha.start();
                     }
-                    
+
                     @Override
                     public void doExitAnim(CustomDialog customDialog, ObjectRunnable<Float> animProgress) {
                         int exitAnimResIdTemp = R.anim.anim_dialogx_default_exit;
@@ -463,18 +473,20 @@ public class CustomDialog extends BaseDialog {
                         if (exitAnimResId != 0) {
                             exitAnimResIdTemp = exitAnimResId;
                         }
-                        
-                        Animation exitAnim = AnimationUtils.loadAnimation(getTopActivity() == null ? boxCustom.getContext() : getTopActivity(), exitAnimResIdTemp);
-                        exitAnimDurationTemp = exitAnim.getDuration();
-                        if (overrideExitDuration >= 0) {
-                            exitAnimDurationTemp = overrideExitDuration;
-                        }
-                        if (exitAnimDuration >= 0) {
-                            exitAnimDurationTemp = exitAnimDuration;
+
+                        if (boxCustom!=null) {
+                            Animation exitAnim = AnimationUtils.loadAnimation(getTopActivity() == null ? boxCustom.getContext() : getTopActivity(), exitAnimResIdTemp);
+                            exitAnimDurationTemp = exitAnim.getDuration();
+                            if (overrideExitDuration >= 0) {
+                                exitAnimDurationTemp = overrideExitDuration;
+                            }
+                            if (exitAnimDuration >= 0) {
+                                exitAnimDurationTemp = exitAnimDuration;
+                            }
+                            exitAnim.setDuration(exitAnimDurationTemp);
+                            boxCustom.startAnimation(exitAnim);
                         }
-                        exitAnim.setDuration(exitAnimDurationTemp);
-                        boxCustom.startAnimation(exitAnim);
-                        
+
                         ValueAnimator bkgAlpha = ValueAnimator.ofFloat(1f, 0f);
                         bkgAlpha.setDuration(exitAnimDurationTemp);
                         bkgAlpha.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@@ -490,7 +502,7 @@ public class CustomDialog extends BaseDialog {
             return dialogXAnimImpl;
         }
     }
-    
+
     private Animation getEnterAnimation() {
         Animation enterAnim;
         if (enterAnimResId == R.anim.anim_dialogx_default_enter &&
@@ -548,15 +560,15 @@ public class CustomDialog extends BaseDialog {
         enterAnim.setDuration(enterAnimDurationTemp);
         return enterAnim;
     }
-    
+
     protected void onGetBaseViewLoc(int[] baseViewLoc) {
     }
-    
+
     @Override
     public String dialogKey() {
         return getClass().getSimpleName() + "(" + Integer.toHexString(hashCode()) + ")";
     }
-    
+
     public void refreshUI() {
         if (getDialogImpl() == null) return;
         runOnMain(new Runnable() {
@@ -566,7 +578,7 @@ public class CustomDialog extends BaseDialog {
             }
         });
     }
-    
+
     public void dismiss() {
         runOnMain(new Runnable() {
             @Override
@@ -576,38 +588,38 @@ public class CustomDialog extends BaseDialog {
             }
         });
     }
-    
+
     public DialogLifecycleCallback<CustomDialog> getDialogLifecycleCallback() {
         return dialogLifecycleCallback == null ? new DialogLifecycleCallback<CustomDialog>() {
         } : dialogLifecycleCallback;
     }
-    
+
     public CustomDialog setDialogLifecycleCallback(DialogLifecycleCallback<CustomDialog> dialogLifecycleCallback) {
         this.dialogLifecycleCallback = dialogLifecycleCallback;
         if (isShow) dialogLifecycleCallback.onShow(me);
         return this;
     }
-    
+
     public OnBackPressedListener<CustomDialog> getOnBackPressedListener() {
         return (OnBackPressedListener<CustomDialog>) onBackPressedListener;
     }
-    
+
     public CustomDialog setOnBackPressedListener(OnBackPressedListener<CustomDialog> onBackPressedListener) {
         this.onBackPressedListener = onBackPressedListener;
         refreshUI();
         return this;
     }
-    
+
     public CustomDialog setStyle(DialogXStyle style) {
         this.style = style;
         return this;
     }
-    
+
     public CustomDialog setTheme(DialogX.THEME theme) {
         this.theme = theme;
         return this;
     }
-    
+
     public boolean isCancelable() {
         if (privateCancelable != null) {
             return privateCancelable == BOOLEAN.TRUE;
@@ -617,131 +629,131 @@ public class CustomDialog extends BaseDialog {
         }
         return cancelable;
     }
-    
+
     public CustomDialog setCancelable(boolean cancelable) {
         this.privateCancelable = cancelable ? BOOLEAN.TRUE : BOOLEAN.FALSE;
         refreshUI();
         return this;
     }
-    
+
     public CustomDialog.DialogImpl getDialogImpl() {
         return dialogImpl;
     }
-    
+
     public CustomDialog setCustomView(OnBindView<CustomDialog> onBindView) {
         this.onBindView = onBindView;
         refreshUI();
         return this;
     }
-    
+
     public View getCustomView() {
         if (onBindView == null) return null;
         return onBindView.getCustomView();
     }
-    
+
     public CustomDialog removeCustomView() {
         this.onBindView.clean();
         refreshUI();
         return this;
     }
-    
+
     public int getEnterAnimResId() {
         return enterAnimResId;
     }
-    
+
     public CustomDialog setEnterAnimResId(int enterAnimResId) {
         this.enterAnimResId = enterAnimResId;
         return this;
     }
-    
+
     public int getExitAnimResId() {
         return exitAnimResId;
     }
-    
+
     public CustomDialog setExitAnimResId(int exitAnimResId) {
         this.exitAnimResId = exitAnimResId;
         return this;
     }
-    
+
     public CustomDialog setAnimResId(int enterAnimResId, int exitAnimResId) {
         this.enterAnimResId = enterAnimResId;
         this.exitAnimResId = exitAnimResId;
         return this;
     }
-    
+
     public ALIGN getAlign() {
         return align;
     }
-    
+
     public CustomDialog setAlign(ALIGN align) {
         this.align = align;
         refreshUI();
         return this;
     }
-    
+
     public boolean isAutoUnsafePlacePadding() {
         return autoUnsafePlacePadding;
     }
-    
+
     public CustomDialog setAutoUnsafePlacePadding(boolean autoUnsafePlacePadding) {
         this.autoUnsafePlacePadding = autoUnsafePlacePadding;
         refreshUI();
         return this;
     }
-    
+
     public CustomDialog setFullScreen(boolean fullscreen) {
         this.autoUnsafePlacePadding = !autoUnsafePlacePadding;
         refreshUI();
         return this;
     }
-    
+
     public CustomDialog setMaskColor(@ColorInt int maskColor) {
         this.maskColor = maskColor;
         refreshUI();
         return this;
     }
-    
+
     public int getMaskColor() {
         return maskColor;
     }
-    
+
     public long getEnterAnimDuration() {
         return enterAnimDuration;
     }
-    
+
     public CustomDialog setEnterAnimDuration(long enterAnimDuration) {
         this.enterAnimDuration = enterAnimDuration;
         return this;
     }
-    
+
     public long getExitAnimDuration() {
         return exitAnimDuration;
     }
-    
+
     public CustomDialog setExitAnimDuration(long exitAnimDuration) {
         this.exitAnimDuration = exitAnimDuration;
         return this;
     }
-    
+
     @Override
     public void restartDialog() {
         if (dialogView != null) {
             dismiss(dialogView);
             isShow = false;
         }
-        if (getDialogImpl().boxCustom != null) {
+        if (getDialogImpl()!=null &&getDialogImpl().boxCustom != null) {
             getDialogImpl().boxCustom.removeAllViews();
         }
-        
+
         enterAnimDuration = 0;
         dialogView = createView(R.layout.layout_dialogx_custom);
         dialogImpl = new DialogImpl(dialogView);
         if (dialogView != null) dialogView.setTag(me);
         show(dialogView);
     }
-    
+
     private boolean isHide;
-    
+
     public void hide() {
         isHide = true;
         hideWithExitAnim = false;
@@ -749,9 +761,9 @@ public class CustomDialog extends BaseDialog {
             getDialogView().setVisibility(View.GONE);
         }
     }
-    
+
     protected boolean hideWithExitAnim;
-    
+
     public void hideWithExitAnim() {
         hideWithExitAnim = true;
         isHide = true;
@@ -772,31 +784,31 @@ public class CustomDialog extends BaseDialog {
             });
         }
     }
-    
+
     @Override
     protected void shutdown() {
         dismiss();
     }
-    
+
     public CustomDialog setDialogImplMode(DialogX.IMPL_MODE dialogImplMode) {
         this.dialogImplMode = dialogImplMode;
         return this;
     }
-    
+
     public boolean isBkgInterceptTouch() {
         return bkgInterceptTouch;
     }
-    
+
     public CustomDialog setBkgInterceptTouch(boolean bkgInterceptTouch) {
         this.bkgInterceptTouch = bkgInterceptTouch;
         refreshUI();
         return this;
     }
-    
+
     public int getAlignBaseViewGravity() {
         return alignViewGravity;
     }
-    
+
     /**
      * 判断是否有设置对应的位置关系
      *
@@ -806,7 +818,7 @@ public class CustomDialog extends BaseDialog {
     public boolean isAlignBaseViewGravity(int gravity) {
         return (alignViewGravity & gravity) == gravity;
     }
-    
+
     public CustomDialog setAlignBaseViewGravity(View baseView, int alignGravity) {
         this.baseView = baseView;
         this.alignViewGravity = alignGravity;
@@ -815,7 +827,7 @@ public class CustomDialog extends BaseDialog {
         setFullScreen(true);
         return this;
     }
-    
+
     public CustomDialog setAlignBaseView(View baseView) {
         this.baseView = baseView;
         baseViewLoc = new int[4];
@@ -823,7 +835,7 @@ public class CustomDialog extends BaseDialog {
         setFullScreen(true);
         return this;
     }
-    
+
     public CustomDialog setAlignBaseViewGravity(int alignGravity) {
         this.alignViewGravity = alignGravity;
         if (baseView != null) {
@@ -833,79 +845,79 @@ public class CustomDialog extends BaseDialog {
         setFullScreen(true);
         return this;
     }
-    
+
     public CustomDialog setAlignBaseViewGravity(View baseView, int alignGravity, int marginLeft,
                                                 int marginTop, int marginRight, int marginBottom) {
         this.marginRelativeBaseView = new int[]{marginLeft, marginTop, marginRight, marginBottom};
         refreshUI();
         return setAlignBaseViewGravity(baseView, alignGravity);
     }
-    
+
     public int[] getBaseViewMargin() {
         return marginRelativeBaseView;
     }
-    
+
     public CustomDialog setBaseViewMargin(int[] marginRelativeBaseView) {
         this.marginRelativeBaseView = marginRelativeBaseView;
         refreshUI();
         return this;
     }
-    
+
     public CustomDialog setBaseViewMargin(int marginLeft, int marginTop,
                                           int marginRight, int marginBottom) {
         this.marginRelativeBaseView = new int[]{marginLeft, marginTop, marginRight, marginBottom};
         refreshUI();
         return this;
     }
-    
+
     public CustomDialog setBaseViewMarginLeft(int marginLeft) {
         this.marginRelativeBaseView[0] = marginLeft;
         refreshUI();
         return this;
     }
-    
+
     public CustomDialog setBaseViewMarginTop(int marginTop) {
         this.marginRelativeBaseView[1] = marginTop;
         refreshUI();
         return this;
     }
-    
+
     public CustomDialog setBaseViewMarginRight(int marginRight) {
         this.marginRelativeBaseView[2] = marginRight;
         refreshUI();
         return this;
     }
-    
+
     public CustomDialog setBaseViewMarginBottom(int marginBottom) {
         this.marginRelativeBaseView[3] = marginBottom;
         refreshUI();
         return this;
     }
-    
+
     public int getBaseViewMarginLeft(int marginLeft) {
         return this.marginRelativeBaseView[0];
     }
-    
+
     public int getBaseViewMarginTop(int marginLeft) {
         return this.marginRelativeBaseView[1];
     }
-    
+
     public int getBaseViewMarginRight(int marginLeft) {
         return this.marginRelativeBaseView[2];
     }
-    
+
     public int getBaseViewMarginBottom(int marginLeft) {
         return this.marginRelativeBaseView[3];
     }
-    
+
     public View getBaseView() {
         return baseView;
     }
-    
+
     public int getWidth() {
         return width;
     }
-    
+
     /**
      * 设置对话框 UI 宽度(单位:像素)
      *
@@ -917,11 +929,11 @@ public class CustomDialog extends BaseDialog {
         refreshUI();
         return this;
     }
-    
+
     public int getHeight() {
         return height;
     }
-    
+
     /**
      * 设置对话框 UI 高度(单位:像素)
      *
@@ -933,31 +945,31 @@ public class CustomDialog extends BaseDialog {
         refreshUI();
         return this;
     }
-    
+
     public OnBackgroundMaskClickListener<CustomDialog> getOnBackgroundMaskClickListener() {
         return onBackgroundMaskClickListener;
     }
-    
+
     public CustomDialog setOnBackgroundMaskClickListener(OnBackgroundMaskClickListener<CustomDialog> onBackgroundMaskClickListener) {
         this.onBackgroundMaskClickListener = onBackgroundMaskClickListener;
         return this;
     }
-    
+
     public DialogXAnimInterface<CustomDialog> getDialogXAnimImpl() {
         return dialogXAnimImpl;
     }
-    
+
     public CustomDialog setDialogXAnimImpl(DialogXAnimInterface<CustomDialog> dialogXAnimImpl) {
         this.dialogXAnimImpl = dialogXAnimImpl;
         return this;
     }
-    
+
     public CustomDialog setRootPadding(int padding) {
         this.screenPaddings = new int[]{padding, padding, padding, padding};
         refreshUI();
         return this;
     }
-    
+
     public CustomDialog setRootPadding(int paddingLeft, int paddingTop, int paddingRight, int paddingBottom) {
         this.screenPaddings = new int[]{paddingLeft, paddingTop, paddingRight, paddingBottom};
         refreshUI();

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

@@ -79,6 +79,7 @@ public class TipDialog extends WaitDialog {
     
     public static WaitDialog show(CharSequence message, TYPE tip) {
         boolean noInstance = noInstance();
+        log("noInstance:"+noInstance);
         if (noInstance) instanceBuild();
         me().setTip(message, tip);
         showWithInstance(noInstance);

+ 140 - 139
DialogX/src/main/java/com/kongzue/dialogx/dialogs/WaitDialog.java

@@ -50,7 +50,7 @@ import java.lang.ref.WeakReference;
  * @createTime: 2020/9/27 14:50
  */
 public class WaitDialog extends BaseDialog {
-    
+
     public static int overrideEnterDuration = -1;
     public static int overrideExitDuration = -1;
     public static int overrideEnterAnimRes = 0;
@@ -63,13 +63,13 @@ public class WaitDialog extends BaseDialog {
     protected float backgroundRadius = -1;
     protected DialogXAnimInterface<WaitDialog> dialogXAnimImpl;
     protected OnBackPressedListener<WaitDialog> onBackPressedListener;
-    
+
     public enum TYPE {
         /**
          * @deprecated NONE 和 PROGRESSING 不建议使用,禁止使用此方法。
          * 此类型等同于直接使用 WaitDialog,因此请勿使用 TipDialog 并指定使用 TYPE.NONE,
          * 如有需要,请直接使用: WaitDialog.show(...)
-         *
+         * <p>
          * 要是用进度,请直接使用 WaitDialog.show(float)
          */
         @Deprecated
@@ -80,7 +80,7 @@ public class WaitDialog extends BaseDialog {
         @Deprecated
         PROGRESSING
     }
-    
+
     protected static WeakReference<WaitDialog> me;
     protected CharSequence message;
     protected long tipShowDuration = 1500;
@@ -89,24 +89,24 @@ public class WaitDialog extends BaseDialog {
     protected TextInfo messageTextInfo;
     protected int maskColor = -1;
     protected BOOLEAN privateCancelable;
-    
+
     protected DialogLifecycleCallback<WaitDialog> dialogLifecycleCallback;
     protected OnBackgroundMaskClickListener<WaitDialog> onBackgroundMaskClickListener;
-    
+
     protected WaitDialog() {
         super();
         cancelable = DialogX.cancelableTipDialog;
     }
-    
+
     protected static WaitDialog instanceBuild() {
         me = new WeakReference<>(new WaitDialog());
         return me.get();
     }
-    
+
     public static WaitDialog build() {
         return new WaitDialog();
     }
-    
+
     public static WaitDialog show(CharSequence message) {
         boolean noInstance = noInstance();
         if (noInstance) instanceBuild();
@@ -114,7 +114,7 @@ public class WaitDialog extends BaseDialog {
         showWithInstance(noInstance);
         return me();
     }
-    
+
     public static WaitDialog show(Activity activity, CharSequence message) {
         boolean noInstance = noInstance(activity);
         if (noInstance) instanceBuild();
@@ -123,7 +123,7 @@ public class WaitDialog extends BaseDialog {
         if (noInstance) showWithInstance(instance, activity);
         return instance;
     }
-    
+
     public static WaitDialog show(int messageResId) {
         boolean noInstance = noInstance();
         if (noInstance) instanceBuild();
@@ -131,7 +131,7 @@ public class WaitDialog extends BaseDialog {
         showWithInstance(noInstance);
         return me();
     }
-    
+
     public static WaitDialog show(Activity activity, int messageResId) {
         boolean noInstance = noInstance(activity);
         if (noInstance) instanceBuild();
@@ -140,7 +140,7 @@ public class WaitDialog extends BaseDialog {
         if (noInstance) showWithInstance(instance, activity);
         return instance;
     }
-    
+
     public static WaitDialog show(CharSequence message, float progress) {
         boolean noInstance = noInstance();
         if (noInstance) instanceBuild();
@@ -149,7 +149,7 @@ public class WaitDialog extends BaseDialog {
         showWithInstance(noInstance);
         return me();
     }
-    
+
     public static WaitDialog show(Activity activity, CharSequence message, float progress) {
         boolean noInstance = noInstance(activity);
         if (noInstance) instanceBuild();
@@ -159,7 +159,7 @@ public class WaitDialog extends BaseDialog {
         if (noInstance) showWithInstance(instance, activity);
         return instance;
     }
-    
+
     public static WaitDialog show(int messageResId, float progress) {
         boolean noInstance = noInstance();
         if (noInstance) instanceBuild();
@@ -168,7 +168,7 @@ public class WaitDialog extends BaseDialog {
         showWithInstance(noInstance);
         return me();
     }
-    
+
     public static WaitDialog show(Activity activity, int messageResId, float progress) {
         boolean noInstance = noInstance(activity);
         if (noInstance) instanceBuild();
@@ -178,7 +178,7 @@ public class WaitDialog extends BaseDialog {
         if (noInstance) showWithInstance(instance, activity);
         return instance;
     }
-    
+
     public static WaitDialog show(Activity activity, float progress) {
         boolean noInstance = noInstance(activity);
         if (noInstance) instanceBuild();
@@ -188,7 +188,7 @@ public class WaitDialog extends BaseDialog {
         if (noInstance) showWithInstance(instance, activity);
         return instance;
     }
-    
+
     public static WaitDialog show(float progress) {
         boolean noInstance = noInstance();
         if (noInstance) instanceBuild();
@@ -197,28 +197,28 @@ public class WaitDialog extends BaseDialog {
         showWithInstance(noInstance);
         return me();
     }
-    
+
     public float getProgress() {
         return waitProgress;
     }
-    
+
     public WaitDialog setProgress(float waitProgress) {
         this.waitProgress = waitProgress;
         refreshUI();
         return this;
     }
-    
+
     private WeakReference<View> dialogView;
-    
+
     protected View getWaitDialogView() {
         if (dialogView == null) return null;
         return dialogView.get();
     }
-    
+
     protected void setWaitDialogView(View v) {
         dialogView = new WeakReference<>(v);
     }
-    
+
     public WaitDialog show() {
         super.beforeShow();
         runOnMain(new Runnable() {
@@ -240,7 +240,7 @@ public class WaitDialog extends BaseDialog {
         });
         return this;
     }
-    
+
     public WaitDialog show(final Activity activity) {
         super.beforeShow();
         activity.runOnUiThread(new Runnable() {
@@ -262,9 +262,9 @@ public class WaitDialog extends BaseDialog {
         });
         return this;
     }
-    
+
     protected WeakReference<DialogImpl> dialogImpl;
-    
+
     public class DialogImpl implements DialogConvertViewInterface {
         public DialogXBaseRelativeLayout boxRoot;
         public MaxRelativeLayout bkg;
@@ -273,13 +273,13 @@ public class WaitDialog extends BaseDialog {
         public ProgressViewInterface progressView;
         public RelativeLayout boxCustomView;
         public TextView txtInfo;
-        
+
         private int layoutResId;
-        
+
         public DialogImpl(int layoutResId) {
             this.layoutResId = layoutResId;
         }
-        
+
         public void lazyCreate() {
             View dialogView = createView(layoutResId);
             if (dialogView == null) return;
@@ -300,7 +300,7 @@ public class WaitDialog extends BaseDialog {
             setDialogImpl(this);
             refreshView();
         }
-        
+
         public DialogImpl(View convertView) {
             if (convertView == null) return;
             boxRoot = convertView.findViewById(R.id.box_root);
@@ -319,18 +319,18 @@ public class WaitDialog extends BaseDialog {
             setDialogImpl(this);
             refreshView();
         }
-        
+
         public void init() {
             if (messageTextInfo == null) messageTextInfo = DialogX.tipTextInfo;
             if (backgroundColor == -1) backgroundColor = DialogX.tipBackgroundColor;
-            
+
             if (style.overrideWaitTipRes() == null) {
                 blurView.setRadiusPx(dip2px(15));
             } else {
                 blurView.setRadiusPx(style.overrideWaitTipRes().overrideRadiusPx() < 0 ? dip2px(15) : style.overrideWaitTipRes().overrideRadiusPx());
             }
             boxRoot.setClickable(true);
-            
+
             boxRoot.setParentDialog(me());
             boxRoot.setOnLifecycleCallBack(new DialogXBaseRelativeLayout.OnLifecycleCallBack() {
                 @Override
@@ -343,22 +343,22 @@ public class WaitDialog extends BaseDialog {
                         @Override
                         public void run() {
                             if (getTopActivity() == null) return;
-                            
+
                             getDialogXAnimImpl().doShowAnim(WaitDialog.this, new ObjectRunnable<Float>() {
                                 @Override
                                 public void run(Float value) {
                                     boxRoot.setBkgAlpha(value);
                                 }
                             });
-                            
+
                             onDialogShow();
                             getDialogLifecycleCallback().onShow(me());
-                            
+
                             lifecycle.setCurrentState(Lifecycle.State.RESUMED);
                         }
                     });
                 }
-                
+
                 @Override
                 public void onDismiss() {
                     isShow = false;
@@ -374,7 +374,7 @@ public class WaitDialog extends BaseDialog {
                     System.gc();
                 }
             });
-            
+
             if (readyTipType != null) {
                 progressView.noLoading();
                 ((View) progressView).postDelayed(new Runnable() {
@@ -384,7 +384,7 @@ public class WaitDialog extends BaseDialog {
                     }
                 }, 100);
             }
-            
+
             boxRoot.setOnBackPressedListener(new DialogXBaseRelativeLayout.PrivateBackPressedListener() {
                 @Override
                 public boolean onBackPressed() {
@@ -402,20 +402,20 @@ public class WaitDialog extends BaseDialog {
             });
             onDialogInit();
         }
-        
+
         private float oldProgress;
-        
+
         public void refreshView() {
             if (boxRoot == null || getTopActivity() == null) {
                 return;
             }
             boxRoot.setRootPadding(screenPaddings[0], screenPaddings[1], screenPaddings[2], screenPaddings[3]);
-    
+
             bkg.setMaxWidth(getMaxWidth());
             bkg.setMaxHeight(getMaxHeight());
             bkg.setMinimumWidth(getMinWidth());
             bkg.setMinimumHeight(getMinHeight());
-            
+
             if (style.overrideWaitTipRes() != null) {
                 int overrideBackgroundColorRes = style.overrideWaitTipRes().overrideBackgroundColorRes(isLightTheme());
                 if (overrideBackgroundColorRes == 0) {
@@ -445,7 +445,7 @@ public class WaitDialog extends BaseDialog {
                 }
             }
             if (DialogX.tipProgressColor != -1) progressView.setColor(DialogX.tipProgressColor);
-            
+
             if (waitProgress >= 0 && waitProgress <= 1 && oldProgress != waitProgress) {
                 progressView.progress(waitProgress);
                 oldProgress = waitProgress;
@@ -464,14 +464,14 @@ public class WaitDialog extends BaseDialog {
                     bkg.setClipToOutline(true);
                 }
             }
-            
+
             showText(txtInfo, message);
             useTextInfo(txtInfo, messageTextInfo);
-            
+
             if (maskColor != -1) {
                 boxRoot.setBackgroundColor(maskColor);
             }
-            
+
             if (onBindView != null && onBindView.getCustomView() != null) {
                 onBindView.bindParent(boxCustomView, WaitDialog.this);
                 boxCustomView.setVisibility(View.VISIBLE);
@@ -480,7 +480,7 @@ public class WaitDialog extends BaseDialog {
                 boxCustomView.setVisibility(View.GONE);
                 boxProgress.setVisibility(View.VISIBLE);
             }
-            
+
             if (bkgInterceptTouch) {
                 if (isCancelable()) {
                     boxRoot.setOnClickListener(new View.OnClickListener() {
@@ -499,11 +499,11 @@ public class WaitDialog extends BaseDialog {
             }
             onDialogRefreshUI();
         }
-        
+
         public void doDismiss(final View v) {
             if (boxRoot == null) return;
             if (getTopActivity() == null) return;
-            
+
             if (!dismissAnimFlag) {
                 dismissAnimFlag = true;
                 boxRoot.post(new Runnable() {
@@ -528,7 +528,7 @@ public class WaitDialog extends BaseDialog {
                 });
             }
         }
-        
+
         protected DialogXAnimInterface<WaitDialog> getDialogXAnimImpl() {
             if (dialogXAnimImpl == null) {
                 dialogXAnimImpl = new DialogXAnimInterface<WaitDialog>() {
@@ -552,7 +552,7 @@ public class WaitDialog extends BaseDialog {
                         }
                         enterAnim.setDuration(enterAnimDurationTemp);
                         bkg.startAnimation(enterAnim);
-                        
+
                         ValueAnimator bkgAlpha = ValueAnimator.ofFloat(0f, 1f);
                         bkgAlpha.setDuration(enterAnimDurationTemp);
                         bkgAlpha.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@@ -562,20 +562,20 @@ public class WaitDialog extends BaseDialog {
                             }
                         });
                         bkgAlpha.start();
-                        
+
                         boxRoot.animate()
                                 .setDuration(enterAnimDurationTemp)
                                 .alpha(1f)
                                 .setInterpolator(new DecelerateInterpolator())
                                 .setListener(null);
                     }
-                    
+
                     @Override
                     public void doExitAnim(WaitDialog dialog, ObjectRunnable<Float> animProgress) {
                         Context context = getTopActivity();
                         if (context == null) context = boxRoot.getContext();
                         if (context == null) return;
-                        
+
                         int exitAnimResId = R.anim.anim_dialogx_default_exit;
                         if (overrideExitAnimRes != 0) {
                             exitAnimResId = overrideExitAnimRes;
@@ -594,12 +594,12 @@ public class WaitDialog extends BaseDialog {
                         exitAnim.setDuration(exitAnimDurationTemp);
                         exitAnim.setInterpolator(new AccelerateInterpolator());
                         bkg.startAnimation(exitAnim);
-                        
+
                         boxRoot.animate()
                                 .alpha(0f)
                                 .setInterpolator(new AccelerateInterpolator())
                                 .setDuration(exitAnimDurationTemp);
-                        
+
                         ValueAnimator bkgAlpha = ValueAnimator.ofFloat(1f, 0f);
                         bkgAlpha.setDuration(exitAnimDurationTemp);
                         bkgAlpha.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@@ -614,7 +614,7 @@ public class WaitDialog extends BaseDialog {
             }
             return dialogXAnimImpl;
         }
-        
+
         public void showTip(final TYPE tip) {
             runOnMain(new Runnable() {
                 @Override
@@ -635,7 +635,7 @@ public class WaitDialog extends BaseDialog {
                             progressView.error();
                             break;
                     }
-                    
+
                     if (boxProgress != null && boxProgress.getVisibility() == View.VISIBLE) {
                         //此事件是在完成衔接动画绘制后执行的逻辑
                         progressView.whenShowTick(new Runnable() {
@@ -673,16 +673,16 @@ public class WaitDialog extends BaseDialog {
             });
         }
     }
-    
+
     private void setDialogImpl(DialogImpl d) {
         if (dialogImpl != null && dialogImpl.get() != d) dialogImpl = new WeakReference<>(d);
     }
-    
+
     @Override
     public String dialogKey() {
         return getClass().getSimpleName() + "(" + Integer.toHexString(hashCode()) + ")";
     }
-    
+
     @Override
     public boolean isLightTheme() {
         if (DialogX.tipTheme == null) {
@@ -691,7 +691,7 @@ public class WaitDialog extends BaseDialog {
             return DialogX.tipTheme == DialogX.THEME.LIGHT;
         }
     }
-    
+
     public void refreshUI() {
         if (getDialogImpl() == null) return;
         runOnMain(new Runnable() {
@@ -701,8 +701,9 @@ public class WaitDialog extends BaseDialog {
             }
         });
     }
-    
+
     public void doDismiss() {
+        isShow = false;
         runOnMain(new Runnable() {
             @Override
             public void run() {
@@ -712,16 +713,16 @@ public class WaitDialog extends BaseDialog {
             }
         });
     }
-    
+
     public static void dismiss() {
         me().doDismiss();
     }
-    
+
     public static void dismiss(Activity activity) {
         WaitDialog instance = getInstance(activity);
         if (instance != null) instance.doDismiss();
     }
-    
+
     protected static WaitDialog me() {
         for (BaseDialog baseDialog : getRunningDialogList()) {
             if (baseDialog instanceof WaitDialog) {
@@ -735,37 +736,37 @@ public class WaitDialog extends BaseDialog {
         }
         return me.get();
     }
-    
+
     protected TYPE readyTipType;
-    
+
     protected void showTip(CharSequence message, TYPE type) {
         showType = type.ordinal();
         this.message = message;
         readyTipType = type;
         show();
     }
-    
+
     protected void showTip(Activity activity, CharSequence message, TYPE type) {
         showType = type.ordinal();
         this.message = message;
         readyTipType = type;
         show(activity);
     }
-    
+
     protected void showTip(int messageResId, TYPE type) {
         showType = type.ordinal();
         this.message = getString(messageResId);
         readyTipType = type;
         show();
     }
-    
+
     protected void showTip(Activity activity, int messageResId, TYPE type) {
         showType = type.ordinal();
         this.message = getString(messageResId);
         readyTipType = type;
         show(activity);
     }
-    
+
     protected void showTip(TYPE type) {
         if (readyTipType == type) {
             return;
@@ -776,44 +777,44 @@ public class WaitDialog extends BaseDialog {
             getDialogImpl().showTip(type);
         }
     }
-    
+
     protected void setTip(TYPE type) {
         showTip(type);
     }
-    
+
     protected void setTip(CharSequence message, TYPE type) {
         this.message = message;
         showTip(type);
         refreshUI();
     }
-    
+
     protected void setTip(int messageResId, TYPE type) {
         this.message = getString(messageResId);
         showTip(type);
         refreshUI();
     }
-    
+
     protected void setTipShowDuration(long tipShowDuration) {
         this.tipShowDuration = tipShowDuration;
         showTip(readyTipType);
     }
-    
+
     public static CharSequence getMessage() {
         return me().message;
     }
-    
+
     public static WaitDialog setMessage(CharSequence message) {
         me().preMessage(message);
         me().refreshUI();
         return me();
     }
-    
+
     public static WaitDialog setMessage(int messageResId) {
         me().preMessage(messageResId);
         me().refreshUI();
         return me();
     }
-    
+
     public boolean isCancelable() {
         if (privateCancelable != null) {
             return privateCancelable == BOOLEAN.TRUE;
@@ -823,13 +824,13 @@ public class WaitDialog extends BaseDialog {
         }
         return DialogX.cancelableTipDialog;
     }
-    
+
     public WaitDialog setCancelable(boolean cancelable) {
         privateCancelable = cancelable ? BOOLEAN.TRUE : BOOLEAN.FALSE;
         refreshUI();
         return this;
     }
-    
+
     /**
      * 用于从 WaitDialog 到 TipDialog 的消息设置
      * 此方法不会立即执行,而是等到动画衔接完成后由事件设置
@@ -841,100 +842,100 @@ public class WaitDialog extends BaseDialog {
         this.message = message;
         return this;
     }
-    
+
     protected WaitDialog preMessage(int messageResId) {
         this.message = getString(messageResId);
         return this;
     }
-    
+
     public DialogLifecycleCallback<WaitDialog> getDialogLifecycleCallback() {
         return dialogLifecycleCallback == null ? new DialogLifecycleCallback<WaitDialog>() {
         } : dialogLifecycleCallback;
     }
-    
+
     public WaitDialog setDialogLifecycleCallback(DialogLifecycleCallback<WaitDialog> dialogLifecycleCallback) {
         this.dialogLifecycleCallback = dialogLifecycleCallback;
         if (isShow) dialogLifecycleCallback.onShow(me());
         return this;
     }
-    
+
     public DialogImpl getDialogImpl() {
         if (dialogImpl == null) return null;
         return dialogImpl.get();
     }
-    
+
     public WaitDialog setCustomView(OnBindView<WaitDialog> onBindView) {
         this.onBindView = onBindView;
         refreshUI();
         return this;
     }
-    
+
     public View getCustomView() {
         if (onBindView == null) return null;
         return onBindView.getCustomView();
     }
-    
+
     public WaitDialog removeCustomView() {
         this.onBindView.clean();
         refreshUI();
         return this;
     }
-    
+
     public OnBackPressedListener<WaitDialog> getOnBackPressedListener() {
         return (OnBackPressedListener<WaitDialog>) onBackPressedListener;
     }
-    
+
     public WaitDialog setOnBackPressedListener(OnBackPressedListener<WaitDialog> onBackPressedListener) {
         this.onBackPressedListener = onBackPressedListener;
         refreshUI();
         return this;
     }
-    
+
     public int getBackgroundColor() {
         return backgroundColor;
     }
-    
+
     public WaitDialog setBackgroundColor(@ColorInt int backgroundColor) {
         this.backgroundColor = backgroundColor;
         refreshUI();
         return this;
     }
-    
+
     public WaitDialog setBackgroundColorRes(@ColorRes int backgroundColorResId) {
         this.backgroundColor = getColor(backgroundColorResId);
         refreshUI();
         return this;
     }
-    
+
     public WaitDialog setMaskColor(@ColorInt int maskColor) {
         this.maskColor = maskColor;
         refreshUI();
         return this;
     }
-    
+
     public WaitDialog setEnterAnimDuration(long enterAnimDuration) {
         this.enterAnimDuration = enterAnimDuration;
         return this;
     }
-    
+
     public long getExitAnimDuration() {
         return exitAnimDuration;
     }
-    
+
     public WaitDialog setExitAnimDuration(long exitAnimDuration) {
         this.exitAnimDuration = exitAnimDuration;
         return this;
     }
-    
+
     @Override
     public void restartDialog() {
         refreshUI();
     }
-    
+
     public static WaitDialog getInstance() {
         return me();
     }
-    
+
     /**
      * 获取当前 WaitDialog 显示状态
      * <p>
@@ -950,37 +951,37 @@ public class WaitDialog extends BaseDialog {
     public static int getType() {
         return me().showType;
     }
-    
+
     public WaitDialog setAnimResId(int enterResId, int exitResId) {
         customEnterAnimResId = enterResId;
         customExitAnimResId = exitResId;
         return this;
     }
-    
+
     public WaitDialog setEnterAnimResId(int enterResId) {
         customEnterAnimResId = enterResId;
         return this;
     }
-    
+
     public WaitDialog setExitAnimResId(int exitResId) {
         customExitAnimResId = exitResId;
         return this;
     }
-    
+
     protected static boolean noInstance() {
-        if (getTopActivity() != null && getTopActivity() instanceof Activity && getInstance((Activity) getTopActivity()) != null) {
+        if (getTopActivity() != null && getInstance((Activity) getTopActivity()) != null) {
             return false;
         }
-        return me == null || me.get() == null || me.get().getOwnActivity() == null || me.get().getOwnActivity() != getTopActivity();
+        return me == null || me.get() == null || me.get().getOwnActivity() == null || me.get().getOwnActivity() != getTopActivity() || !me.get().isShow;
     }
-    
+
     protected static boolean noInstance(Activity activity) {
         if (getTopActivity() != null && getInstance(activity) != null) {
             return false;
         }
-        return me == null || me.get() == null || me.get().getOwnActivity() == null || me.get().getOwnActivity() != activity;
+        return me == null || me.get() == null || me.get().getOwnActivity() == null || me.get().getOwnActivity() != activity || !me.get().isShow;
     }
-    
+
     public static WaitDialog getInstanceNotNull(Activity activity) {
         for (BaseDialog baseDialog : getRunningDialogList()) {
             if (baseDialog instanceof WaitDialog) {
@@ -991,7 +992,7 @@ public class WaitDialog extends BaseDialog {
         }
         return instanceBuild();
     }
-    
+
     public static WaitDialog getInstance(Activity activity) {
         for (BaseDialog baseDialog : getRunningDialogList()) {
             if (baseDialog instanceof WaitDialog) {
@@ -1002,7 +1003,7 @@ public class WaitDialog extends BaseDialog {
         }
         return null;
     }
-    
+
     protected static void showWithInstance(boolean noInstance) {
         if (noInstance) {
             me().show();
@@ -1010,7 +1011,7 @@ public class WaitDialog extends BaseDialog {
             me().refreshUI();
         }
     }
-    
+
     protected static void showWithInstance(WaitDialog instance, Activity activity) {
         if (activity == null) {
             instance.show();
@@ -1018,125 +1019,125 @@ public class WaitDialog extends BaseDialog {
             instance.show(activity);
         }
     }
-    
+
     @Override
     protected void shutdown() {
         dismiss();
     }
-    
+
     public WaitDialog setMaxWidth(int maxWidth) {
         this.maxWidth = maxWidth;
         refreshUI();
         return this;
     }
-    
+
     public WaitDialog setMaxHeight(int maxHeight) {
         this.maxHeight = maxHeight;
         refreshUI();
         return this;
     }
-    
+
     public WaitDialog setMinHeight(int minHeight) {
         this.minHeight = minHeight;
         refreshUI();
         return this;
     }
-    
+
     public WaitDialog setMinWidth(int minWidth) {
         this.minWidth = minWidth;
         refreshUI();
         return this;
     }
-    
+
     public WaitDialog setDialogImplMode(DialogX.IMPL_MODE dialogImplMode) {
         this.dialogImplMode = dialogImplMode;
         return this;
     }
-    
+
     public boolean isBkgInterceptTouch() {
         return bkgInterceptTouch;
     }
-    
+
     public WaitDialog setBkgInterceptTouch(boolean bkgInterceptTouch) {
         this.bkgInterceptTouch = bkgInterceptTouch;
         return this;
     }
-    
+
     public OnBackgroundMaskClickListener<WaitDialog> getOnBackgroundMaskClickListener() {
         return onBackgroundMaskClickListener;
     }
-    
+
     public WaitDialog setOnBackgroundMaskClickListener(OnBackgroundMaskClickListener<WaitDialog> onBackgroundMaskClickListener) {
         this.onBackgroundMaskClickListener = onBackgroundMaskClickListener;
         return this;
     }
-    
+
     public WaitDialog setStyle(DialogXStyle style) {
         this.style = style;
         return this;
     }
-    
+
     public WaitDialog setTheme(DialogX.THEME theme) {
         this.theme = theme;
         return this;
     }
-    
+
     public TextInfo getMessageTextInfo() {
         return messageTextInfo;
     }
-    
+
     public WaitDialog setMessageTextInfo(TextInfo messageTextInfo) {
         this.messageTextInfo = messageTextInfo;
         refreshUI();
         return this;
     }
-    
+
     public WaitDialog setMessageContent(CharSequence message) {
         this.message = message;
         refreshUI();
         return this;
     }
-    
+
     public WaitDialog setMessageContent(int messageResId) {
         this.message = getString(messageResId);
         refreshUI();
         return this;
     }
-    
+
     public CharSequence getMessageContent() {
         return message;
     }
-    
+
     public WaitDialog setTipType(TYPE type) {
         showTip(type);
         return this;
     }
-    
+
     public WaitDialog setRadius(float radiusPx) {
         backgroundRadius = radiusPx;
         refreshUI();
         return this;
     }
-    
+
     public float getRadius() {
         return backgroundRadius;
     }
-    
+
     public DialogXAnimInterface<WaitDialog> getDialogXAnimImpl() {
         return dialogXAnimImpl;
     }
-    
+
     public WaitDialog setDialogXAnimImpl(DialogXAnimInterface<WaitDialog> dialogXAnimImpl) {
         this.dialogXAnimImpl = dialogXAnimImpl;
         return this;
     }
-    
+
     public WaitDialog setRootPadding(int padding) {
         this.screenPaddings = new int[]{padding, padding, padding, padding};
         refreshUI();
         return this;
     }
-    
+
     public WaitDialog setRootPadding(int paddingLeft, int paddingTop, int paddingRight, int paddingBottom) {
         this.screenPaddings = new int[]{paddingLeft, paddingTop, paddingRight, paddingBottom};
         refreshUI();

+ 0 - 1
DialogXIOSStyle/build.gradle

@@ -35,7 +35,6 @@ artifacts {
     archives sourcesJar
 }
 dependencies {
-    implementation fileTree(dir: "libs", include: ["*.jar"])
     implementation project(path: ':DialogX')
     compileOnly project(path: ':DialogXInterface')
 }

+ 0 - 1
DialogXKongzueStyle/build.gradle

@@ -34,7 +34,6 @@ artifacts {
     archives sourcesJar
 }
 dependencies {
-    implementation fileTree(dir: "libs", include: ["*.jar"])
     implementation project(path: ':DialogX')
     compileOnly project(path: ':DialogXInterface')
 }

+ 0 - 1
DialogXMIUIStyle/build.gradle

@@ -34,7 +34,6 @@ artifacts {
 }
 
 dependencies {
-    implementation fileTree(dir: "libs", include: ["*.jar"])
     implementation project(path: ':DialogX')
     compileOnly project(path: ':DialogXInterface')
 }

+ 2 - 2
README.md

@@ -133,7 +133,7 @@ DialogX 采用了主题分离结构,主框架仅包含 Material 设计风格
 
 <div>
 最新版本:
-<a href="https://github.com/kongzue/DialogX/releases"><img src="https://img.shields.io/badge/MavenCentral%20Release-0.0.47.beta13-green.svg" alt="DialogX Release"></a></div>
+<a href="https://github.com/kongzue/DialogX/releases"><img src="https://img.shields.io/badge/MavenCentral%20Release-0.0.47.beta14-green.svg" alt="DialogX Release"></a></div>
 
 1) 在 project 的 build.gradle 文件中找到 `allprojects{}` 代码块添加以下代码:
 
@@ -152,7 +152,7 @@ allprojects {
 2) 在 app 的 build.gradle 文件中找到 `dependencies{}` 代码块,并在其中加入以下语句:
 
 ```
-def dialogx_version = "0.0.47.beta13"
+def dialogx_version = "0.0.47.beta14"
 implementation "com.kongzue.dialogx:DialogX:${dialogx_version}"
 ```
 

+ 2 - 2
README_EN.md

@@ -136,7 +136,7 @@ Please choose one of the following two sources to bring in your project.
 
 <div>
 Latest version: 
-<a href="https://github.com/kongzue/DialogX/releases"><img src="https://img.shields.io/badge/MavenCentral%20Release-0.0.47.beta13-green.svg" alt="DialogX Release"></a></div>
+<a href="https://github.com/kongzue/DialogX/releases"><img src="https://img.shields.io/badge/MavenCentral%20Release-0.0.47.beta14-green.svg" alt="DialogX Release"></a></div>
 
 1) In the project's build.gradle file, find the `allprojects{}` block and add the following code.
 
@@ -155,7 +155,7 @@ allprojects {
 2) Find the `dependencies{}` code block in the app's build.gradle file and add the following statement to it.
 
 ```
-def dialogx_version = "0.0.47.beta13"
+def dialogx_version = "0.0.47.beta14"
 implementation "com.kongzue.dialogx:DialogX:${dialogx_version}"
 ```
 

+ 2 - 2
README_TC.md

@@ -133,7 +133,7 @@ DialogX 採用了主題分離結構,主框架僅包含 Material 設計風格
 
 <div>
 最新版本:
-<a href="https://github.com/kongzue/DialogX/releases"><img src="https://img.shields.io/badge/MavenCentral%20Release-0.0.47.beta13-green.svg" alt="DialogX Release"></a></div>
+<a href="https://github.com/kongzue/DialogX/releases"><img src="https://img.shields.io/badge/MavenCentral%20Release-0.0.47.beta14-green.svg" alt="DialogX Release"></a></div>
 
 1) 在 project 的 build.gradle 文件中找到 `allprojects{}` 代碼塊添加以下代碼:
 
@@ -152,7 +152,7 @@ allprojects {
 2) 在 app 的 build.gradle 文件中找到 `dependencies{}` 代碼塊,並在其中加入以下語句:
 
 ```
-def dialogx_version = "0.0.47.beta13"
+def dialogx_version = "0.0.47.beta14"
 implementation "com.kongzue.dialogx:DialogX:${dialogx_version}"
 ```
 

+ 3 - 8
app/build.gradle

@@ -21,15 +21,11 @@ android {
         }
     }
 }
-repositories {
-    flatDir {
-        dirs 'libs'
-    }
-}
 dependencies {
     implementation fileTree(dir: "libs", include: ["*.jar"])
     implementation 'androidx.appcompat:appcompat:1.3.0'
-    implementation 'com.github.kongzue:BaseFramework:6.8.6'
+    implementation "com.kongzue.baseframework:BaseFramework:6.8.8"
+    implementation 'com.kongzue.stacklabel:StackLabel:1.2.0'
 
 //    implementation 'com.github.kongzue.DialogX:DialogXIOSStyle:0.0.39.debug4'
 //    implementation 'com.github.kongzue.DialogX:DialogXKongzueStyle:0.0.39.debug4'
@@ -39,10 +35,9 @@ dependencies {
     implementation project(path: ':DialogXIOSStyle')
     implementation project(path: ':DialogXKongzueStyle')
     implementation project(path: ':DialogXMIUIStyle')
+    implementation project(path: ':DialogXMaterialYou')
 
     //implementation 'com.github.kongzue:DialogXStyle-Snackbar:1.0.6'
     implementation 'com.google.android.material:material:1.4.0'
     implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
-    implementation 'com.github.kongzue:StackLabel:1.1.8'
-    implementation project(path: ':DialogXMaterialYou')
 }

BIN
app/libs/DialogXIOSStyle-release.aar


BIN
app/libs/DialogXKongzueStyle-release.aar


BIN
app/libs/DialogXMIUIStyle-release.aar


+ 3 - 3
build.gradle

@@ -2,14 +2,14 @@
 buildscript {
     repositories {
         google()
-        jcenter()
         mavenCentral()
+        jcenter()
         maven{
             url 'https://jitpack.io'
         }
     }
     dependencies {
-        classpath 'com.android.tools.build:gradle:4.2.2'
+        classpath 'com.android.tools.build:gradle:7.0.4'
         classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
 
         // NOTE: Do not place your application dependencies here; they belong
@@ -20,8 +20,8 @@ buildscript {
 allprojects {
     repositories {
         google()
-        jcenter()
         mavenCentral()
+        jcenter()
         maven{
             url 'https://jitpack.io'
         }

+ 1 - 1
gradle.properties

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