浏览代码

add PopTip

kongzue 4 年之前
父节点
当前提交
fc59d88a9a
共有 30 个文件被更改,包括 1066 次插入33 次删除
  1. 二进制
      DialogX/libs/DialogXInterface.jar
  2. 1 0
      DialogX/src/main/java/com/kongzue/dialogx/DialogX.java
  3. 12 0
      DialogX/src/main/java/com/kongzue/dialogx/dialogs/CustomDialog.java
  4. 575 0
      DialogX/src/main/java/com/kongzue/dialogx/dialogs/PopTip.java
  5. 16 11
      DialogX/src/main/java/com/kongzue/dialogx/dialogs/WaitDialog.java
  6. 26 2
      DialogX/src/main/java/com/kongzue/dialogx/style/MaterialStyle.java
  7. 1 8
      DialogX/src/main/java/com/kongzue/dialogx/util/views/DialogXBaseRelativeLayout.java
  8. 10 0
      DialogX/src/main/res/drawable/rect_dialogx_material_poptip_bkg.xml
  9. 10 0
      DialogX/src/main/res/drawable/rect_dialogx_material_poptip_bkg_night.xml
  10. 64 0
      DialogX/src/main/res/layout/layout_dialogx_poptip_material.xml
  11. 64 0
      DialogX/src/main/res/layout/layout_dialogx_poptip_material_dark.xml
  12. 3 0
      DialogX/src/main/res/values/colors.xml
  13. 二进制
      DialogXIOSStyle/libs/DialogXInterface.jar
  14. 25 2
      DialogXIOSStyle/src/main/java/com/kongzue/dialogx/style/IOSStyle.java
  15. 7 0
      DialogXIOSStyle/src/main/res/anim/anim_dialogx_ios_top_enter.xml
  16. 7 0
      DialogXIOSStyle/src/main/res/anim/anim_dialogx_top_ios_exit.xml
  17. 10 0
      DialogXIOSStyle/src/main/res/drawable/rect_dialogx_ios_poptip_bkg.xml
  18. 10 0
      DialogXIOSStyle/src/main/res/drawable/rect_dialogx_ios_poptip_bkg_night.xml
  19. 64 0
      DialogXIOSStyle/src/main/res/layout/layout_dialogx_poptip_ios.xml
  20. 63 0
      DialogXIOSStyle/src/main/res/layout/layout_dialogx_poptip_ios_dark.xml
  21. 1 0
      DialogXIOSStyle/src/main/res/values/colors.xml
  22. 21 0
      DialogXInterface/src/main/java/com/kongzue/dialogx/interfaces/DialogXStyle.java
  23. 二进制
      DialogXKongzueStyle/libs/DialogXInterface.jar
  24. 5 0
      DialogXKongzueStyle/src/main/java/com/kongzue/dialogx/style/KongzueStyle.java
  25. 二进制
      DialogXMIUIStyle/libs/DialogXInterface.jar
  26. 5 0
      DialogXMIUIStyle/src/main/java/com/kongzue/dialogx/style/MIUIStyle.java
  27. 29 6
      app/src/main/java/com/kongzue/dialogxdemo/MainActivity.java
  28. 37 4
      app/src/main/res/layout/activity_main.xml
  29. 二进制
      app/src/main/res/mipmap-xxhdpi/img_air_pods_pro.png
  30. 二进制
      app/src/main/res/mipmap-xxhdpi/img_mail_line_white.png

二进制
DialogX/libs/DialogXInterface.jar


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

@@ -22,6 +22,7 @@ public class DialogX {
     public static DialogX.THEME globalTheme = DialogX.THEME.LIGHT;
     public static int dialogMaxWidth;
     public static boolean autoShowInputKeyboard = true;
+    public static boolean onlyOnePopTip = true;
     
     public enum THEME {
         LIGHT, DARK

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

@@ -36,6 +36,7 @@ public class CustomDialog extends BaseDialog {
     protected int enterAnimResId = R.anim.anim_dialogx_default_enter;
     protected int exitAnimResId = R.anim.anim_dialogx_default_exit;
     protected ALIGN align = ALIGN.CENTER;
+    protected boolean autoUnsafePlacePadding = true;
     private View dialogView;
     
     public enum ALIGN {
@@ -90,6 +91,8 @@ public class CustomDialog extends BaseDialog {
         
         @Override
         public void init() {
+            boxRoot.setAutoUnsafePlacePadding(autoUnsafePlacePadding);
+            
             boxRoot.setOnLifecycleCallBack(new DialogXBaseRelativeLayout.OnLifecycleCallBack() {
                 @Override
                 public void onShow() {
@@ -316,4 +319,13 @@ public class CustomDialog extends BaseDialog {
         this.align = align;
         return this;
     }
+    
+    public boolean isAutoUnsafePlacePadding() {
+        return autoUnsafePlacePadding;
+    }
+    
+    public CustomDialog setAutoUnsafePlacePadding(boolean autoUnsafePlacePadding) {
+        this.autoUnsafePlacePadding = autoUnsafePlacePadding;
+        return this;
+    }
 }

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

@@ -0,0 +1,575 @@
+package com.kongzue.dialogx.dialogs;
+
+import android.animation.Animator;
+import android.graphics.Rect;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.animation.AccelerateInterpolator;
+import android.view.animation.Animation;
+import android.view.animation.AnimationUtils;
+import android.view.animation.DecelerateInterpolator;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.RelativeLayout;
+import android.widget.TextView;
+
+import androidx.annotation.ColorInt;
+import androidx.annotation.IdRes;
+
+import com.kongzue.dialogx.DialogX;
+import com.kongzue.dialogx.R;
+import com.kongzue.dialogx.impl.AnimatorListenerEndCallBack;
+import com.kongzue.dialogx.interfaces.BaseDialog;
+import com.kongzue.dialogx.interfaces.DialogConvertViewInterface;
+import com.kongzue.dialogx.interfaces.DialogLifecycleCallback;
+import com.kongzue.dialogx.interfaces.DialogXStyle;
+import com.kongzue.dialogx.interfaces.OnBackPressedListener;
+import com.kongzue.dialogx.interfaces.OnBindView;
+import com.kongzue.dialogx.interfaces.OnDialogButtonClickListener;
+import com.kongzue.dialogx.interfaces.OnSafeInsetsChangeListener;
+import com.kongzue.dialogx.style.MaterialStyle;
+import com.kongzue.dialogx.util.TextInfo;
+import com.kongzue.dialogx.util.views.DialogXBaseRelativeLayout;
+
+import java.lang.ref.WeakReference;
+import java.util.Timer;
+import java.util.TimerTask;
+
+/**
+ * @author: Kongzue
+ * @github: https://github.com/kongzue/
+ * @homepage: http://kongzue.com/
+ * @mail: myzcxhh@live.cn
+ * @createTime: 2020/10/20 11:59
+ */
+public class PopTip extends BaseDialog {
+    
+    public static final int TIME_NO_AUTO_DISMISS_DELAY = -1;
+    
+    protected static WeakReference<PopTip> oldInstance;
+    protected OnBindView<PopTip> onBindView;
+    protected DialogLifecycleCallback<PopTip> dialogLifecycleCallback;
+    protected PopTip me = this;
+    protected DialogImpl dialogImpl;
+    protected int enterAnimResId = R.anim.anim_dialogx_default_enter;
+    protected int exitAnimResId = R.anim.anim_dialogx_default_exit;
+    private View dialogView;
+    protected DialogXStyle.PopTipSettings.ALIGN align;
+    protected OnDialogButtonClickListener onButtonClickListener;
+    protected boolean autoTintIconInLightOrDarkMode = true;
+    
+    protected int iconResId;
+    protected CharSequence message;
+    protected CharSequence buttonText;
+    
+    protected TextInfo messageTextInfo;
+    protected TextInfo buttonTextInfo = new TextInfo().setBold(true);
+    
+    protected PopTip() {
+        super();
+    }
+    
+    public static PopTip build() {
+        return new PopTip();
+    }
+    
+    public PopTip(OnBindView<PopTip> onBindView) {
+        super();
+        this.onBindView = onBindView;
+    }
+    
+    public PopTip(CharSequence message) {
+        super();
+        this.message = message;
+    }
+    
+    public PopTip(int iconResId, CharSequence message) {
+        super();
+        this.iconResId = iconResId;
+        this.message = message;
+    }
+    
+    public PopTip(int iconResId, CharSequence message, CharSequence buttonText) {
+        super();
+        this.iconResId = iconResId;
+        this.message = message;
+        this.buttonText = buttonText;
+    }
+    
+    public PopTip(CharSequence message, CharSequence buttonText) {
+        super();
+        this.message = message;
+        this.buttonText = buttonText;
+    }
+    
+    public PopTip(CharSequence message, OnBindView<PopTip> onBindView) {
+        super();
+        this.message = message;
+        this.onBindView = onBindView;
+    }
+    
+    public PopTip(int iconResId, CharSequence message, OnBindView<PopTip> onBindView) {
+        super();
+        this.iconResId = iconResId;
+        this.message = message;
+        this.onBindView = onBindView;
+    }
+    
+    public PopTip(int iconResId, CharSequence message, CharSequence buttonText, OnBindView<PopTip> onBindView) {
+        super();
+        this.iconResId = iconResId;
+        this.message = message;
+        this.buttonText = buttonText;
+        this.onBindView = onBindView;
+    }
+    
+    public PopTip(CharSequence message, CharSequence buttonText, OnBindView<PopTip> onBindView) {
+        super();
+        this.message = message;
+        this.buttonText = buttonText;
+        this.onBindView = onBindView;
+    }
+    
+    public static PopTip show(OnBindView<PopTip> onBindView) {
+        PopTip popTip = new PopTip(onBindView);
+        popTip.show();
+        return popTip;
+    }
+    
+    public static PopTip show(CharSequence message) {
+        PopTip popTip = new PopTip(message);
+        popTip.show();
+        return popTip;
+    }
+    
+    public static PopTip show(CharSequence message, OnBindView<PopTip> onBindView) {
+        PopTip popTip = new PopTip(message, onBindView);
+        popTip.show();
+        return popTip;
+    }
+    
+    public static PopTip show(CharSequence message, CharSequence buttonText) {
+        PopTip popTip = new PopTip(message, buttonText);
+        popTip.show();
+        return popTip;
+    }
+    
+    public static PopTip show(int iconResId, CharSequence message, OnBindView<PopTip> onBindView) {
+        PopTip popTip = new PopTip(iconResId, message, onBindView);
+        popTip.show();
+        return popTip;
+    }
+    
+    public static PopTip show(int iconResId, CharSequence message) {
+        PopTip popTip = new PopTip(iconResId, message);
+        popTip.show();
+        return popTip;
+    }
+    
+    public static PopTip show(int iconResId, CharSequence message, CharSequence buttonText) {
+        PopTip popTip = new PopTip(iconResId, message, buttonText);
+        popTip.show();
+        return popTip;
+    }
+    
+    public static PopTip show(int iconResId, CharSequence message, CharSequence buttonText, OnBindView<PopTip> onBindView) {
+        PopTip popTip = new PopTip(iconResId, message, buttonText, onBindView);
+        popTip.show();
+        return popTip;
+    }
+    
+    public static PopTip show(CharSequence message, CharSequence buttonText, OnBindView<PopTip> onBindView) {
+        PopTip popTip = new PopTip(message, buttonText, onBindView);
+        popTip.show();
+        return popTip;
+    }
+    
+    public void show() {
+        if (DialogX.onlyOnePopTip) {
+            if (oldInstance != null && oldInstance.get() != null) {
+                oldInstance.get().dismiss();
+            }
+        }
+        oldInstance = new WeakReference<>(this);
+        int layoutResId = isLightTheme() ? R.layout.layout_dialogx_poptip_material : R.layout.layout_dialogx_poptip_material_dark;
+        if (style.popTipSettings() != null) {
+            if (style.popTipSettings().layout(isLightTheme()) != 0) {
+                layoutResId = style.popTipSettings().layout(isLightTheme());
+            }
+            align = style.popTipSettings().align();
+            if (align == null) align = DialogXStyle.PopTipSettings.ALIGN.BOTTOM;
+            enterAnimResId = style.popTipSettings().enterAnimResId(isLightTheme()) != 0 ? style.popTipSettings().enterAnimResId(isLightTheme()) : R.anim.anim_dialogx_default_enter;
+            exitAnimResId = style.popTipSettings().exitAnimResId(isLightTheme()) != 0 ? style.popTipSettings().exitAnimResId(isLightTheme()) : R.anim.anim_dialogx_default_exit;
+        }
+        dialogView = createView(layoutResId);
+        dialogImpl = new DialogImpl(dialogView);
+        show(dialogView);
+    }
+    
+    protected Timer autoDismissTimer;
+    
+    public PopTip autoDismiss(long delay) {
+        if (autoDismissTimer != null) {
+            autoDismissTimer.cancel();
+        }
+        if (delay < 0) return this;
+        autoDismissTimer = new Timer();
+        autoDismissTimer.schedule(new TimerTask() {
+            @Override
+            public void run() {
+                dismiss();
+            }
+        }, delay);
+        return this;
+    }
+    
+    public PopTip showShort() {
+        autoDismiss(2000);
+        return this;
+    }
+    
+    public PopTip showLong() {
+        autoDismiss(3500);
+        return this;
+    }
+    
+    public PopTip noAutoDismiss() {
+        autoDismiss(TIME_NO_AUTO_DISMISS_DELAY);
+        return this;
+    }
+    
+    public class DialogImpl implements DialogConvertViewInterface {
+        
+        DialogXBaseRelativeLayout boxRoot;
+        LinearLayout boxBody;
+        ImageView imgDialogxPopIcon;
+        TextView txtDialogxPopText;
+        RelativeLayout boxCustom;
+        TextView txtDialogxButton;
+        
+        public DialogImpl(View convertView) {
+            boxRoot = convertView.findViewById(R.id.box_root);
+            boxBody = convertView.findViewById(R.id.box_body);
+            imgDialogxPopIcon = convertView.findViewById(R.id.img_dialogx_pop_icon);
+            txtDialogxPopText = convertView.findViewById(R.id.txt_dialogx_pop_text);
+            boxCustom = convertView.findViewById(R.id.box_custom);
+            txtDialogxButton = convertView.findViewById(R.id.txt_dialogx_button);
+            
+            init();
+            refreshView();
+        }
+        
+        @Override
+        public void init() {
+            boxRoot.setFocusable(false);
+            boxRoot.setFocusableInTouchMode(false);
+            boxRoot.setAutoUnsafePlacePadding(false);
+            
+            boxRoot.setOnLifecycleCallBack(new DialogXBaseRelativeLayout.OnLifecycleCallBack() {
+                @Override
+                public void onShow() {
+                    isShow = true;
+                    boxRoot.setAlpha(0f);
+                    
+                    getDialogLifecycleCallback().onShow(me);
+                    
+                    if (onBindView != null) onBindView.onBind(me, onBindView.getCustomView());
+                    
+                    if (autoDismissTimer == null) {
+                        showShort();
+                    }
+                }
+                
+                @Override
+                public void onDismiss() {
+                    isShow = false;
+                    if (oldInstance.get() == me) oldInstance.clear();
+                    getDialogLifecycleCallback().onDismiss(me);
+                }
+            });
+            
+            RelativeLayout.LayoutParams rlp;
+            rlp = ((RelativeLayout.LayoutParams) boxBody.getLayoutParams());
+            if (align == null) align = DialogXStyle.PopTipSettings.ALIGN.BOTTOM;
+            switch (align) {
+                case TOP:
+                    rlp.removeRule(RelativeLayout.CENTER_IN_PARENT);
+                    rlp.addRule(RelativeLayout.ALIGN_PARENT_TOP);
+                    break;
+                case BOTTOM:
+                    rlp.removeRule(RelativeLayout.CENTER_IN_PARENT);
+                    rlp.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
+                    break;
+                case CENTER:
+                    rlp.removeRule(RelativeLayout.ALIGN_PARENT_TOP);
+                    rlp.removeRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
+                    rlp.addRule(RelativeLayout.CENTER_IN_PARENT);
+                    break;
+            }
+            boxBody.setLayoutParams(rlp);
+            
+            boxRoot.setOnSafeInsetsChangeListener(new OnSafeInsetsChangeListener() {
+                @Override
+                public void onChange(Rect unsafeRect) {
+                    if (align == DialogXStyle.PopTipSettings.ALIGN.TOP) {
+                        boxBody.setY(unsafeRect.top);
+                    }
+                }
+            });
+            
+            boxRoot.post(new Runnable() {
+                @Override
+                public void run() {
+                    
+                    Animation enterAnim = AnimationUtils.loadAnimation(getContext(), enterAnimResId);
+                    enterAnim.setInterpolator(new DecelerateInterpolator(2f));
+                    boxBody.startAnimation(enterAnim);
+                    
+                    boxRoot.animate().setDuration(enterAnim.getDuration()).alpha(1f).setInterpolator(new DecelerateInterpolator()).setListener(null);
+                }
+            });
+            
+            txtDialogxButton.setOnClickListener(new View.OnClickListener() {
+                @Override
+                public void onClick(View v) {
+                    if (onButtonClickListener != null) {
+                        if (!onButtonClickListener.onClick(me, v)) {
+                            doDismiss(v);
+                        }
+                    } else {
+                        doDismiss(v);
+                    }
+                }
+            });
+        }
+        
+        @Override
+        public void refreshView() {
+            if (backgroundColor != -1) {
+                tintColor(boxBody, backgroundColor);
+            }
+            
+            if (onBindView != null) {
+                if (onBindView.getCustomView() != null) {
+                    if (onBindView.getCustomView().isAttachedToWindow()) {
+                        boxCustom.removeView(onBindView.getCustomView());
+                    }
+                    ViewGroup.LayoutParams lp = onBindView.getCustomView().getLayoutParams();
+                    if (lp == null) {
+                        lp = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
+                    }
+                    boxCustom.addView(onBindView.getCustomView(), lp);
+                }
+            }
+            
+            showText(txtDialogxPopText, message);
+            showText(txtDialogxButton, buttonText);
+            
+            useTextInfo(txtDialogxPopText, messageTextInfo);
+            useTextInfo(txtDialogxButton, buttonTextInfo);
+            
+            if (iconResId != 0) {
+                imgDialogxPopIcon.setVisibility(View.VISIBLE);
+                imgDialogxPopIcon.setImageResource(iconResId);
+                if (autoTintIconInLightOrDarkMode) {
+                    imgDialogxPopIcon.setImageTintList(txtDialogxPopText.getTextColors());
+                } else {
+                    imgDialogxPopIcon.setImageTintList(null);
+                }
+            } else {
+                imgDialogxPopIcon.setVisibility(View.GONE);
+            }
+        }
+        
+        @Override
+        public void doDismiss(final View v) {
+            boxRoot.post(new Runnable() {
+                @Override
+                public void run() {
+                    if (v != null) v.setEnabled(false);
+                    
+                    Animation exitAnim = AnimationUtils.loadAnimation(getContext(), exitAnimResId);
+                    boxBody.startAnimation(exitAnim);
+                    
+                    boxRoot.animate().alpha(0f).setInterpolator(new AccelerateInterpolator()).setDuration(exitAnim.getDuration()).setListener(new AnimatorListenerEndCallBack() {
+                        @Override
+                        public void onAnimationEnd(Animator animation) {
+                            dismiss(dialogView);
+                        }
+                    });
+                }
+            });
+        }
+    }
+    
+    public void refreshUI() {
+        if (dialogImpl == null) return;
+        dialogImpl.refreshView();
+    }
+    
+    public void dismiss() {
+        if (dialogImpl == null) return;
+        dialogImpl.doDismiss(null);
+    }
+    
+    public DialogLifecycleCallback<PopTip> getDialogLifecycleCallback() {
+        return dialogLifecycleCallback == null ? new DialogLifecycleCallback<PopTip>() {
+        } : dialogLifecycleCallback;
+    }
+    
+    public PopTip setDialogLifecycleCallback(DialogLifecycleCallback<PopTip> dialogLifecycleCallback) {
+        this.dialogLifecycleCallback = dialogLifecycleCallback;
+        return this;
+    }
+    
+    public OnBackPressedListener getOnBackPressedListener() {
+        return onBackPressedListener;
+    }
+    
+    public PopTip setOnBackPressedListener(OnBackPressedListener onBackPressedListener) {
+        this.onBackPressedListener = onBackPressedListener;
+        refreshUI();
+        return this;
+    }
+    
+    public PopTip setStyle(DialogXStyle style) {
+        this.style = style;
+        return this;
+    }
+    
+    public PopTip setTheme(DialogX.THEME theme) {
+        this.theme = theme;
+        return this;
+    }
+    
+    public boolean isCancelable() {
+        return cancelable;
+    }
+    
+    public PopTip setCancelable(boolean cancelable) {
+        this.cancelable = cancelable;
+        refreshUI();
+        return this;
+    }
+    
+    public PopTip.DialogImpl getDialogImpl() {
+        return dialogImpl;
+    }
+    
+    public PopTip setCustomView(OnBindView<PopTip> onBindView) {
+        this.onBindView = onBindView;
+        refreshUI();
+        return this;
+    }
+    
+    public View getCustomView() {
+        if (onBindView == null) return null;
+        return onBindView.getCustomView();
+    }
+    
+    public PopTip removeCustomView() {
+        this.onBindView.clean();
+        refreshUI();
+        return this;
+    }
+    
+    public DialogXStyle.PopTipSettings.ALIGN getAlign() {
+        return align;
+    }
+    
+    public PopTip setAlign(DialogXStyle.PopTipSettings.ALIGN align) {
+        this.align = align;
+        return this;
+    }
+    
+    public int getIconResId() {
+        return iconResId;
+    }
+    
+    public PopTip setIconResId(int iconResId) {
+        this.iconResId = iconResId;
+        refreshUI();
+        return this;
+    }
+    
+    public CharSequence getMessage() {
+        return message;
+    }
+    
+    public PopTip setMessage(CharSequence message) {
+        this.message = message;
+        refreshUI();
+        return this;
+    }
+    
+    public CharSequence getButtonText() {
+        return buttonText;
+    }
+    
+    public PopTip setButton(CharSequence buttonText) {
+        this.buttonText = buttonText;
+        refreshUI();
+        return this;
+    }
+    
+    public PopTip setButton(CharSequence buttonText, OnDialogButtonClickListener onButtonClickListener) {
+        this.buttonText = buttonText;
+        this.onButtonClickListener = onButtonClickListener;
+        refreshUI();
+        return this;
+    }
+    
+    public PopTip setButton(OnDialogButtonClickListener onButtonClickListener) {
+        this.onButtonClickListener = onButtonClickListener;
+        return this;
+    }
+    
+    public TextInfo getMessageTextInfo() {
+        return messageTextInfo;
+    }
+    
+    public PopTip setMessageTextInfo(TextInfo messageTextInfo) {
+        this.messageTextInfo = messageTextInfo;
+        refreshUI();
+        return this;
+    }
+    
+    public TextInfo getButtonTextInfo() {
+        return buttonTextInfo;
+    }
+    
+    public PopTip setButtonTextInfo(TextInfo buttonTextInfo) {
+        this.buttonTextInfo = buttonTextInfo;
+        refreshUI();
+        return this;
+    }
+    
+    public OnDialogButtonClickListener getOnButtonClickListener() {
+        return onButtonClickListener;
+    }
+    
+    public PopTip setOnButtonClickListener(OnDialogButtonClickListener onButtonClickListener) {
+        this.onButtonClickListener = onButtonClickListener;
+        return this;
+    }
+    
+    public boolean isAutoTintIconInLightOrDarkMode() {
+        return autoTintIconInLightOrDarkMode;
+    }
+    
+    public PopTip setAutoTintIconInLightOrDarkMode(boolean autoTintIconInLightOrDarkMode) {
+        this.autoTintIconInLightOrDarkMode = autoTintIconInLightOrDarkMode;
+        refreshUI();
+        return this;
+    }
+    
+    public int getBackgroundColor() {
+        return backgroundColor;
+    }
+    
+    public PopTip setBackgroundColor(@ColorInt int backgroundColor) {
+        this.backgroundColor = backgroundColor;
+        refreshUI();
+        return this;
+    }
+}

+ 16 - 11
DialogX/src/main/java/com/kongzue/dialogx/dialogs/WaitDialog.java

@@ -256,18 +256,23 @@ public class WaitDialog extends BaseDialog {
             }
         }
         
-        public void doDismiss(View v) {
-            if (v != null) v.setEnabled(false);
-            
-            int exitAnimResId = R.anim.anim_dialogx_default_exit;
-            Animation enterAnim = AnimationUtils.loadAnimation(getContext(), exitAnimResId);
-            enterAnim.setInterpolator(new AccelerateInterpolator());
-            bkg.startAnimation(enterAnim);
-            
-            boxRoot.animate().setDuration(300).alpha(0f).setInterpolator(new AccelerateInterpolator()).setDuration(enterAnim.getDuration()).setListener(new AnimatorListenerEndCallBack() {
+        public void doDismiss(final View v) {
+            boxRoot.post(new Runnable() {
                 @Override
-                public void onAnimationEnd(Animator animation) {
-                    dismiss(dialogView);
+                public void run() {
+                    if (v != null) v.setEnabled(false);
+    
+                    int exitAnimResId = R.anim.anim_dialogx_default_exit;
+                    Animation enterAnim = AnimationUtils.loadAnimation(getContext(), exitAnimResId);
+                    enterAnim.setInterpolator(new AccelerateInterpolator());
+                    bkg.startAnimation(enterAnim);
+    
+                    boxRoot.animate().setDuration(300).alpha(0f).setInterpolator(new AccelerateInterpolator()).setDuration(enterAnim.getDuration()).setListener(new AnimatorListenerEndCallBack() {
+                        @Override
+                        public void onAnimationEnd(Animator animation) {
+                            dismiss(dialogView);
+                        }
+                    });
                 }
             });
         }

+ 26 - 2
DialogX/src/main/java/com/kongzue/dialogx/style/MaterialStyle.java

@@ -1,7 +1,5 @@
 package com.kongzue.dialogx.style;
 
-import android.content.res.Resources;
-
 import com.kongzue.dialogx.R;
 import com.kongzue.dialogx.interfaces.DialogXStyle;
 
@@ -162,4 +160,30 @@ public class MaterialStyle implements DialogXStyle {
     
         };
     }
+    
+    @Override
+    public PopTipSettings popTipSettings() {
+        return new PopTipSettings() {
+            @Override
+            public int layout(boolean light) {
+                return light?R.layout.layout_dialogx_poptip_material :R.layout.layout_dialogx_poptip_material_dark;
+            }
+
+            @Override
+            public ALIGN align() {
+                return ALIGN.BOTTOM;
+            }
+
+            @Override
+            public int enterAnimResId(boolean b) {
+                return R.anim.anim_dialogx_default_enter;
+            }
+
+            @Override
+            public int exitAnimResId(boolean b) {
+                return R.anim.anim_dialogx_default_exit;
+            }
+        };
+    }
+    
 }

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

@@ -1,14 +1,10 @@
 package com.kongzue.dialogx.util.views;
 
-import android.annotation.TargetApi;
 import android.app.Activity;
 import android.content.Context;
-import android.graphics.Canvas;
 import android.graphics.Rect;
-import android.graphics.RectF;
 import android.os.Build;
 import android.util.AttributeSet;
-import android.util.Log;
 import android.view.KeyEvent;
 import android.view.MotionEvent;
 import android.view.View;
@@ -25,9 +21,6 @@ import com.kongzue.dialogx.interfaces.BaseDialog;
 import com.kongzue.dialogx.interfaces.OnBackPressedListener;
 import com.kongzue.dialogx.interfaces.OnSafeInsetsChangeListener;
 
-import java.util.Arrays;
-import java.util.List;
-
 /**
  * @author: Kongzue
  * @github: https://github.com/kongzue/
@@ -139,7 +132,7 @@ public class DialogXBaseRelativeLayout extends RelativeLayout {
     
     @Override
     protected void onDetachedFromWindow() {
-        if (decorViewLayoutListener != null) {
+        if (decorViewLayoutListener != null && ((Activity) BaseDialog.getContext())!=null) {
             ((Activity) BaseDialog.getContext()).getWindow().getDecorView().getViewTreeObserver().removeOnGlobalLayoutListener(decorViewLayoutListener);
         }
         if (onLifecycleCallBack != null) {

+ 10 - 0
DialogX/src/main/res/drawable/rect_dialogx_material_poptip_bkg.xml

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="rectangle">
+    <!--left to right-->
+    <solid
+        android:color="@color/white"/>
+
+    <corners
+        android:radius="5dp"/>
+</shape>

+ 10 - 0
DialogX/src/main/res/drawable/rect_dialogx_material_poptip_bkg_night.xml

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="rectangle">
+    <!--left to right-->
+    <solid
+        android:color="@color/dialogxMaterialDarkDialogBkgColor"/>
+
+    <corners
+        android:radius="5dp"/>
+</shape>

+ 64 - 0
DialogX/src/main/res/layout/layout_dialogx_poptip_material.xml

@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="utf-8"?>
+<com.kongzue.dialogx.util.views.DialogXBaseRelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    android:id="@+id/box_root"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="vertical">
+
+    <LinearLayout
+        android:id="@+id/box_body"
+        android:layout_width="wrap_content"
+        android:layout_height="50dp"
+        android:layout_alignParentBottom="true"
+        android:layout_centerHorizontal="true"
+        android:layout_marginHorizontal="35dp"
+        android:layout_marginBottom="100dp"
+        android:background="@drawable/rect_dialogx_material_poptip_bkg"
+        android:elevation="20dp"
+        android:gravity="center_vertical">
+
+        <ImageView
+            android:id="@+id/img_dialogx_pop_icon"
+            android:layout_width="26dp"
+            android:layout_height="26dp"
+            android:layout_marginLeft="15dp"
+            android:layout_marginRight="-5dp"
+            android:visibility="gone" />
+
+        <TextView
+            android:id="@+id/txt_dialogx_pop_text"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginLeft="15dp"
+            android:layout_marginRight="15dp"
+            android:gravity="left|center_vertical"
+            android:singleLine="true"
+            android:text="Sure?"
+            android:textColor="@color/black"
+            android:textSize="14dp" />
+
+        <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_marginHorizontal="5dp"
+            android:layout_marginVertical="5dp"
+            android:background="@drawable/button_dialogx_material_light"
+            android:gravity="left|center_vertical"
+            android:paddingHorizontal="10dp"
+            android:singleLine="true"
+            android:text="Dismiss"
+            android:textColor="@color/dialogxColorBlue"
+            android:textSize="14dp"
+            android:visibility="gone" />
+
+    </LinearLayout>
+
+</com.kongzue.dialogx.util.views.DialogXBaseRelativeLayout>

+ 64 - 0
DialogX/src/main/res/layout/layout_dialogx_poptip_material_dark.xml

@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="utf-8"?>
+<com.kongzue.dialogx.util.views.DialogXBaseRelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    android:id="@+id/box_root"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="vertical">
+
+    <LinearLayout
+        android:id="@+id/box_body"
+        android:layout_width="wrap_content"
+        android:layout_height="50dp"
+        android:layout_alignParentBottom="true"
+        android:layout_centerHorizontal="true"
+        android:layout_marginHorizontal="35dp"
+        android:layout_marginBottom="100dp"
+        android:background="@drawable/rect_dialogx_material_poptip_bkg_night"
+        android:elevation="10dp"
+        android:gravity="center_vertical">
+
+        <ImageView
+            android:id="@+id/img_dialogx_pop_icon"
+            android:layout_width="26dp"
+            android:layout_height="26dp"
+            android:layout_marginLeft="15dp"
+            android:layout_marginRight="-5dp"
+            android:visibility="gone" />
+
+        <TextView
+            android:id="@+id/txt_dialogx_pop_text"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginLeft="15dp"
+            android:layout_marginRight="15dp"
+            android:gravity="left|center_vertical"
+            android:singleLine="true"
+            android:text="Sure?"
+            android:textColor="@color/white"
+            android:textSize="14dp" />
+
+        <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_marginHorizontal="5dp"
+            android:layout_marginVertical="5dp"
+            android:background="@drawable/button_dialogx_material_night"
+            android:gravity="left|center_vertical"
+            android:paddingHorizontal="10dp"
+            android:singleLine="true"
+            android:text="Dismiss"
+            android:textColor="@color/dialogxPopButtonBlueDark"
+            android:textSize="14dp"
+            android:visibility="gone" />
+
+    </LinearLayout>
+
+</com.kongzue.dialogx.util.views.DialogXBaseRelativeLayout>

+ 3 - 0
DialogX/src/main/res/values/colors.xml

@@ -30,8 +30,11 @@
     <color name="white20">#33ffffff</color>
     <color name="white10">#1Affffff</color>
 
+    <color name="dialogxColorBlue">#2196F3</color>
+
     <color name="dialogxMaterialDarkDialogBkgColor">#343434</color>
     <color name="dialogxWaitBkgLight">#CCF4F5F6</color>
     <color name="dialogxWaitBkgDark">#D1161616</color>
 
+    <color name="dialogxPopButtonBlueDark">#86B3D6</color>
 </resources>

二进制
DialogXIOSStyle/libs/DialogXInterface.jar


+ 25 - 2
DialogXIOSStyle/src/main/java/com/kongzue/dialogx/style/IOSStyle.java

@@ -5,8 +5,6 @@ import android.content.res.Resources;
 import com.kongzue.dialogx.interfaces.DialogXStyle;
 import com.kongzue.dialogx.iostheme.R;
 
-import java.util.HashMap;
-
 /**
  * @author: Kongzue
  * @github: https://github.com/kongzue/
@@ -205,4 +203,29 @@ public class IOSStyle implements DialogXStyle {
             
         };
     }
+    
+    @Override
+    public PopTipSettings popTipSettings() {
+        return new PopTipSettings() {
+            @Override
+            public int layout(boolean light) {
+                return light?R.layout.layout_dialogx_poptip_ios :R.layout.layout_dialogx_poptip_ios_dark;
+            }
+            
+            @Override
+            public ALIGN align() {
+                return ALIGN.TOP;
+            }
+            
+            @Override
+            public int enterAnimResId(boolean b) {
+                return R.anim.anim_dialogx_ios_top_enter;
+            }
+            
+            @Override
+            public int exitAnimResId(boolean b) {
+                return R.anim.anim_dialogx_top_ios_exit;
+            }
+        };
+    }
 }

+ 7 - 0
DialogXIOSStyle/src/main/res/anim/anim_dialogx_ios_top_enter.xml

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<set xmlns:android="http://schemas.android.com/apk/res/android">
+    <translate
+        android:duration="500"
+        android:fromYDelta="-100%p"
+        android:toYDelta="0" />
+</set>

+ 7 - 0
DialogXIOSStyle/src/main/res/anim/anim_dialogx_top_ios_exit.xml

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<set xmlns:android="http://schemas.android.com/apk/res/android">
+    <translate
+        android:duration="500"
+        android:fromYDelta="0"
+        android:toYDelta="-100%p"/>
+</set>

+ 10 - 0
DialogXIOSStyle/src/main/res/drawable/rect_dialogx_ios_poptip_bkg.xml

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="rectangle">
+    <!--left to right-->
+    <solid
+        android:color="@color/white"/>
+
+    <corners
+        android:radius="99dp"/>
+</shape>

+ 10 - 0
DialogXIOSStyle/src/main/res/drawable/rect_dialogx_ios_poptip_bkg_night.xml

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="rectangle">
+    <!--left to right-->
+    <solid
+        android:color="@color/dialogxIOSDarkDialogBkgColor"/>
+
+    <corners
+        android:radius="99dp"/>
+</shape>

+ 64 - 0
DialogXIOSStyle/src/main/res/layout/layout_dialogx_poptip_ios.xml

@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="utf-8"?>
+<com.kongzue.dialogx.util.views.DialogXBaseRelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    android:id="@+id/box_root"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="vertical">
+
+    <LinearLayout
+        android:id="@+id/box_body"
+        android:layout_width="wrap_content"
+        android:layout_height="50dp"
+        android:layout_marginTop="10dp"
+        android:layout_centerHorizontal="true"
+        android:layout_marginBottom="100dp"
+        android:layout_marginHorizontal="35dp"
+        android:paddingHorizontal="10dp"
+        android:background="@drawable/rect_dialogx_ios_poptip_bkg"
+        android:elevation="200dp"
+        android:gravity="center_vertical">
+
+        <ImageView
+            android:id="@+id/img_dialogx_pop_icon"
+            android:layout_width="26dp"
+            android:layout_height="26dp"
+            android:layout_marginLeft="5dp"
+            android:visibility="gone"
+            android:layout_marginRight="-5dp" />
+
+        <TextView
+            android:id="@+id/txt_dialogx_pop_text"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginLeft="15dp"
+            android:layout_marginRight="15dp"
+            android:gravity="left|center_vertical"
+            android:singleLine="true"
+            android:text="Sure?"
+            android:textColor="@color/black"
+            android:textSize="14dp" />
+
+        <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_marginHorizontal="5dp"
+            android:layout_marginVertical="5dp"
+            android:gravity="left|center_vertical"
+            android:paddingHorizontal="10dp"
+            android:singleLine="true"
+            android:text="Dismiss"
+            android:textColor="@color/dialogxColorBlue"
+            android:textSize="14dp"
+            android:visibility="gone" />
+
+    </LinearLayout>
+
+</com.kongzue.dialogx.util.views.DialogXBaseRelativeLayout>

+ 63 - 0
DialogXIOSStyle/src/main/res/layout/layout_dialogx_poptip_ios_dark.xml

@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="utf-8"?>
+<com.kongzue.dialogx.util.views.DialogXBaseRelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    android:id="@+id/box_root"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="vertical">
+
+    <LinearLayout
+        android:id="@+id/box_body"
+        android:layout_width="wrap_content"
+        android:layout_height="50dp"
+        android:layout_marginTop="10dp"
+        android:layout_centerHorizontal="true"
+        android:layout_marginHorizontal="35dp"
+        android:paddingHorizontal="10dp"
+        android:background="@drawable/rect_dialogx_ios_poptip_bkg_night"
+        android:elevation="100dp"
+        android:gravity="center_vertical">
+
+        <ImageView
+            android:id="@+id/img_dialogx_pop_icon"
+            android:layout_width="26dp"
+            android:layout_height="26dp"
+            android:layout_marginLeft="5dp"
+            android:layout_marginRight="-5dp"
+            android:visibility="gone" />
+
+        <TextView
+            android:id="@+id/txt_dialogx_pop_text"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginLeft="15dp"
+            android:layout_marginRight="15dp"
+            android:gravity="left|center_vertical"
+            android:singleLine="true"
+            android:text="Sure?"
+            android:textColor="@color/white"
+            android:textSize="14dp" />
+
+        <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_marginHorizontal="5dp"
+            android:layout_marginVertical="5dp"
+            android:gravity="left|center_vertical"
+            android:paddingHorizontal="10dp"
+            android:singleLine="true"
+            android:text="Dismiss"
+            android:textColor="@color/dialogxIOSBlueDark"
+            android:textSize="14dp"
+            android:visibility="gone" />
+
+    </LinearLayout>
+
+</com.kongzue.dialogx.util.views.DialogXBaseRelativeLayout>

+ 1 - 0
DialogXIOSStyle/src/main/res/values/colors.xml

@@ -42,4 +42,5 @@
     <color name="dialogxIOSTipTextLight">#8f8f8f</color>
     <color name="dialogxIOSTipTextDark">#9AA8B9</color>
     <color name="dialogxIOSBlueDark">#8AB4F8</color>
+    <color name="dialogxIOSDarkDialogBkgColor">#262727</color>
 </resources>

+ 21 - 0
DialogXInterface/src/main/java/com/kongzue/dialogx/interfaces/DialogXStyle.java

@@ -34,6 +34,8 @@ public interface DialogXStyle {
     
     BottomDialogRes overrideBottomDialogRes();
     
+    PopTipSettings popTipSettings();
+    
     interface BlurBackgroundSetting {
         
         boolean blurBackground();
@@ -86,4 +88,23 @@ public interface DialogXStyle {
         
         int overrideMenuItemLayout(boolean light, int index, int count, boolean isContentVisibility);
     }
+    
+    interface PopTipSettings {
+        
+        int layout(boolean light);
+    
+        ALIGN align();
+    
+        enum ALIGN {
+            CENTER,
+            TOP,
+            BOTTOM,
+            TOP_INSIDE,
+            BOTTOM_INSIDE
+        }
+        
+        int enterAnimResId(boolean light);
+    
+        int exitAnimResId(boolean light);
+    }
 }

二进制
DialogXKongzueStyle/libs/DialogXInterface.jar


+ 5 - 0
DialogXKongzueStyle/src/main/java/com/kongzue/dialogx/style/KongzueStyle.java

@@ -129,4 +129,9 @@ public class KongzueStyle implements DialogXStyle {
             }
         };
     }
+    
+    @Override
+    public PopTipSettings popTipSettings() {
+        return null;
+    }
 }

二进制
DialogXMIUIStyle/libs/DialogXInterface.jar


+ 5 - 0
DialogXMIUIStyle/src/main/java/com/kongzue/dialogx/style/MIUIStyle.java

@@ -144,4 +144,9 @@ public class MIUIStyle implements DialogXStyle {
             }
         };
     }
+    
+    @Override
+    public PopTipSettings popTipSettings() {
+        return null;
+    }
 }

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

@@ -32,6 +32,7 @@ import com.kongzue.dialogx.dialogs.CustomDialog;
 import com.kongzue.dialogx.dialogs.FullScreenDialog;
 import com.kongzue.dialogx.dialogs.InputDialog;
 import com.kongzue.dialogx.dialogs.MessageDialog;
+import com.kongzue.dialogx.dialogs.PopTip;
 import com.kongzue.dialogx.dialogs.TipDialog;
 import com.kongzue.dialogx.dialogs.WaitDialog;
 import com.kongzue.dialogx.interfaces.BaseDialog;
@@ -78,6 +79,8 @@ public class MainActivity extends BaseActivity {
     private TextView btnTipWarning;
     private TextView btnTipError;
     private TextView btnTipProgress;
+    private TextView btnPoptip;
+    private TextView btnPoptipBigMessage;
     private TextView btnBottomDialog;
     private TextView btnBottomMenu;
     private TextView btnBottomReply;
@@ -114,6 +117,8 @@ public class MainActivity extends BaseActivity {
         btnTipWarning = findViewById(R.id.btn_tipWarning);
         btnTipError = findViewById(R.id.btn_tipError);
         btnTipProgress = findViewById(R.id.btn_tipProgress);
+        btnPoptip = findViewById(R.id.btn_poptip);
+        btnPoptipBigMessage = findViewById(R.id.btn_poptip_bigMessage);
         btnBottomDialog = findViewById(R.id.btn_bottom_dialog);
         btnBottomMenu = findViewById(R.id.btn_bottom_menu);
         btnBottomReply = findViewById(R.id.btn_bottom_reply);
@@ -128,7 +133,7 @@ public class MainActivity extends BaseActivity {
     
     @Override
     public void initDatas(JumpParameter parameter) {
-        DialogX.globalStyle = IOSStyle.style();
+        DialogX.globalStyle = MaterialStyle.style();
         
         boolean showBreak = parameter.getBoolean("showBreak");
         if (showBreak) {
@@ -532,14 +537,14 @@ public class MainActivity extends BaseActivity {
                     public void onBind(final FullScreenDialog dialog, View v) {
                         btnClose = v.findViewById(R.id.btn_close);
                         webView = v.findViewById(R.id.webView);
-    
+                        
                         btnClose.setOnClickListener(new View.OnClickListener() {
                             @Override
                             public void onClick(View v) {
                                 dialog.dismiss();
                             }
                         });
-    
+                        
                         WebSettings webSettings = webView.getSettings();
                         webSettings.setJavaScriptEnabled(true);
                         webSettings.setLoadWithOverviewMode(true);
@@ -549,7 +554,7 @@ public class MainActivity extends BaseActivity {
                         webSettings.setJavaScriptCanOpenWindowsAutomatically(true);
                         webSettings.setLoadsImagesAutomatically(true);
                         webSettings.setDefaultTextEncodingName("utf-8");
-    
+                        
                         webView.setWebViewClient(new WebViewClient() {
                             @Override
                             public boolean shouldOverrideUrlLoading(WebView view, String url) {
@@ -561,13 +566,13 @@ public class MainActivity extends BaseActivity {
                                 }
                                 return true;
                             }
-        
+                            
                             @Override
                             public void onPageFinished(WebView view, String url) {
                                 super.onPageFinished(view, url);
                             }
                         });
-    
+                        
                         webView.loadUrl("https://github.com/kongzue/DialogV3/");
                     }
                 });
@@ -592,6 +597,24 @@ public class MainActivity extends BaseActivity {
                 });
             }
         });
+        
+        btnPoptip.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                PopTip.show("这是一个提示");
+            }
+        });
+        
+        btnPoptipBigMessage.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                if (rdoIos.isChecked()) {
+                    PopTip.show(R.mipmap.img_air_pods_pro, "AirPods Pro 已连接").setAutoTintIconInLightOrDarkMode(false).showLong();
+                } else {
+                    PopTip.show(R.mipmap.img_mail_line_white, "邮件已发送", "撤回").showLong();
+                }
+            }
+        });
     }
     
     private void initFullScreenLoginDemo(final FullScreenDialog fullScreenDialog) {

+ 37 - 4
app/src/main/res/layout/activity_main.xml

@@ -126,21 +126,21 @@
                     android:orientation="horizontal">
 
                     <RadioButton
-                        android:id="@+id/rdo_ios"
+                        android:id="@+id/rdo_material"
                         android:layout_width="wrap_content"
                         android:layout_height="wrap_content"
                         android:checked="true"
                         android:padding="10dp"
-                        android:text="iOS"
+                        android:text="Material"
                         android:textColor="#7b000000"
                         android:textSize="12dp" />
 
                     <RadioButton
-                        android:id="@+id/rdo_material"
+                        android:id="@+id/rdo_ios"
                         android:layout_width="wrap_content"
                         android:layout_height="wrap_content"
                         android:padding="10dp"
-                        android:text="Material"
+                        android:text="iOS"
                         android:textColor="#7b000000"
                         android:textSize="12dp" />
 
@@ -359,6 +359,39 @@
 
                 </LinearLayout>
 
+                <LinearLayout
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:orientation="horizontal">
+
+                    <TextView
+                        android:id="@+id/btn_poptip"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:layout_margin="5dp"
+                        android:background="@drawable/rect_button"
+                        android:paddingHorizontal="15dp"
+                        android:paddingVertical="10dp"
+                        android:text="轻量消息提示"
+                        android:textColor="@color/white"
+                        android:textSize="13dp"
+                        android:textStyle="bold" />
+
+                    <TextView
+                        android:id="@+id/btn_poptip_bigMessage"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:layout_margin="5dp"
+                        android:background="@drawable/rect_button"
+                        android:paddingHorizontal="15dp"
+                        android:paddingVertical="10dp"
+                        android:text="复杂消息提示"
+                        android:textColor="@color/white"
+                        android:textSize="13dp"
+                        android:textStyle="bold" />
+
+                </LinearLayout>
+
                 <TextView
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"

二进制
app/src/main/res/mipmap-xxhdpi/img_air_pods_pro.png


二进制
app/src/main/res/mipmap-xxhdpi/img_mail_line_white.png