kongzue 4 ani în urmă
părinte
comite
8519055e66

+ 11 - 28
DialogX/src/main/java/com/kongzue/dialogx/dialogs/PopTip.java

@@ -55,8 +55,8 @@ public class PopTip extends BaseDialog {
     protected int exitAnimResId = R.anim.anim_dialogx_default_exit;
     private View dialogView;
     protected DialogXStyle.PopTipSettings.ALIGN align;
-    protected OnDialogButtonClickListener onButtonClickListener;
-    protected OnDialogButtonClickListener onPopTipClickListener;
+    protected OnDialogButtonClickListener<PopTip> onButtonClickListener;
+    protected OnDialogButtonClickListener<PopTip> onPopTipClickListener;
     protected boolean autoTintIconInLightOrDarkMode = true;
     
     protected int iconResId;
@@ -360,6 +360,9 @@ public class PopTip extends BaseDialog {
                         lp = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
                     }
                     boxCustom.addView(onBindView.getCustomView(), lp);
+                    boxCustom.setVisibility(View.VISIBLE);
+                }else{
+                    boxCustom.setVisibility(View.GONE);
                 }
             }
             
@@ -437,16 +440,6 @@ public class PopTip extends BaseDialog {
         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;
@@ -457,16 +450,6 @@ public class PopTip extends BaseDialog {
         return this;
     }
     
-    public boolean isCancelable() {
-        return cancelable;
-    }
-    
-    public PopTip setCancelable(boolean cancelable) {
-        this.cancelable = cancelable;
-        refreshUI();
-        return this;
-    }
-    
     public PopTip.DialogImpl getDialogImpl() {
         return dialogImpl;
     }
@@ -527,14 +510,14 @@ public class PopTip extends BaseDialog {
         return this;
     }
     
-    public PopTip setButton(CharSequence buttonText, OnDialogButtonClickListener onButtonClickListener) {
+    public PopTip setButton(CharSequence buttonText, OnDialogButtonClickListener<PopTip> onButtonClickListener) {
         this.buttonText = buttonText;
         this.onButtonClickListener = onButtonClickListener;
         refreshUI();
         return this;
     }
     
-    public PopTip setButton(OnDialogButtonClickListener onButtonClickListener) {
+    public PopTip setButton(OnDialogButtonClickListener<PopTip> onButtonClickListener) {
         this.onButtonClickListener = onButtonClickListener;
         return this;
     }
@@ -559,11 +542,11 @@ public class PopTip extends BaseDialog {
         return this;
     }
     
-    public OnDialogButtonClickListener getOnButtonClickListener() {
+    public OnDialogButtonClickListener<PopTip> getOnButtonClickListener() {
         return onButtonClickListener;
     }
     
-    public PopTip setOnButtonClickListener(OnDialogButtonClickListener onButtonClickListener) {
+    public PopTip setOnButtonClickListener(OnDialogButtonClickListener<PopTip> onButtonClickListener) {
         this.onButtonClickListener = onButtonClickListener;
         return this;
     }
@@ -578,11 +561,11 @@ public class PopTip extends BaseDialog {
         return this;
     }
     
-    public OnDialogButtonClickListener getOnPopTipClickListener() {
+    public OnDialogButtonClickListener<PopTip> getOnPopTipClickListener() {
         return onPopTipClickListener;
     }
     
-    public PopTip setOnPopTipClickListener(OnDialogButtonClickListener onPopTipClickListener) {
+    public PopTip setOnPopTipClickListener(OnDialogButtonClickListener<PopTip> onPopTipClickListener) {
         this.onPopTipClickListener = onPopTipClickListener;
         refreshUI();
         return this;

+ 1 - 1
README.md

@@ -87,7 +87,7 @@ DialogX 采用了主体分离结构,主框架仅包含 Material 设计风格
 
 # 开始使用DialogX
 
-🚧警告!此框架依然处于 Alpha 预览版本阶段,可能会存在问题或其它接口变动的可能,且文档还处于完善阶段,若需要正式稳定的Dialog组件暂时依然建议前往使用 [DialogV3](https://github.com/kongzue/DialogV3),若您在使用过程中遇到任何问题,请加群590498789讨论。
+🚧警告!此框架依然处于 Alpha 预览版本阶段,可能会存在问题或其它接口变动的可能,且文档还处于完善阶段,若需要正式稳定的Dialog组件暂时依然建议前往使用 [DialogV3](https://github.com/kongzue/DialogV3),若您在使用过程中遇到任何问题,请加群 590498789 讨论。
 
 
 

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

@@ -623,7 +623,13 @@ public class MainActivity extends BaseActivity {
                 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();
+                    PopTip.show(R.mipmap.img_mail_line_white, "邮件已发送", "撤回").showLong().setButton(new OnDialogButtonClickListener<PopTip>() {
+                        @Override
+                        public boolean onClick(PopTip popTip, View v) {
+                            //点击“撤回”按钮回调
+                            return false;
+                        }
+                    });
                 }
             }
         });