add[打招呼弹窗是否取消可配置,后台新增配置开关。]

This commit is contained in:
zlzw 2024-06-12 14:52:30 +08:00
parent 7b6eb7bbed
commit 7a5d2b90d8
3 changed files with 53 additions and 22 deletions

View File

@ -6,6 +6,21 @@ public class MessageSayHiStartBean extends BaseModel{
@SerializedName("time") @SerializedName("time")
private int nextTime; private int nextTime;
private int status; private int status;
@SerializedName("open_off")
private int open_off;
public int getOpen_off() {
return open_off;
}
public boolean isCancelDialog(){
return open_off == 0;
}
public void setOpen_off(int open_off) {
this.open_off = open_off;
}
public int getNextTime() { public int getNextTime() {
return nextTime; return nextTime;
} }

View File

@ -1,5 +1,6 @@
package com.yunbao.common.dialog; package com.yunbao.common.dialog;
import android.app.Dialog;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.os.Handler; import android.os.Handler;
@ -43,6 +44,8 @@ public class MessageSayHiNotifyDialog extends AbsDialogCenterPopupWindow {
private TextView anchorName; private TextView anchorName;
private RatioRoundImageView avatar; private RatioRoundImageView avatar;
private boolean cancelable = true;
public MessageSayHiNotifyDialog(@NonNull Context context) { public MessageSayHiNotifyDialog(@NonNull Context context) {
super(context); super(context);
@ -58,9 +61,18 @@ public class MessageSayHiNotifyDialog extends AbsDialogCenterPopupWindow {
return this; return this;
} }
/**
* 设置是否点击其他位置可以关闭弹窗
*/
public MessageSayHiNotifyDialog setCancelable(boolean cancelable) {
this.cancelable = cancelable;
return this;
}
@Override @Override
public void buildDialog(XPopup.Builder builder) { public void buildDialog(XPopup.Builder builder) {
builder.dismissOnTouchOutside(cancelable);
builder.dismissOnBackPressed(cancelable);
} }
@Override @Override

View File

@ -28,6 +28,7 @@ public class MessageSayHiNotifyManager {
private boolean isStopShow = false; private boolean isStopShow = false;
private boolean isShowDialog = false; private boolean isShowDialog = false;
private boolean isRun = false; private boolean isRun = false;
private boolean isCancelDialog = true;
private MessageSayHiBean hiBean; private MessageSayHiBean hiBean;
private List<MessageUserInfoBean> startListNotifyList = new ArrayList<>(); private List<MessageUserInfoBean> startListNotifyList = new ArrayList<>();
private String lastActivity; private String lastActivity;
@ -51,6 +52,7 @@ public class MessageSayHiNotifyManager {
Log.i(TAG, "onSuccess: 初始化定时器,定时器关:" + data.toString()); Log.i(TAG, "onSuccess: 初始化定时器,定时器关:" + data.toString());
return; return;
} }
isCancelDialog = data.isCancelDialog();
timer = new Timer(); timer = new Timer();
timer.schedule(createTask(), data.getNextTime() * 1000L); timer.schedule(createTask(), data.getNextTime() * 1000L);
hiBean = new MessageSayHiBean(); hiBean = new MessageSayHiBean();
@ -135,7 +137,8 @@ public class MessageSayHiNotifyManager {
Log.i(TAG, "onSuccess: 启动定时器,下一轮时间:" + bean.getNextTime() + ""); Log.i(TAG, "onSuccess: 启动定时器,下一轮时间:" + bean.getNextTime() + "");
timer = new Timer(); timer = new Timer();
timer.schedule(createTask(), bean.getNextTime() * 1000L); timer.schedule(createTask(), bean.getNextTime() * 1000L);
}).showDialog(); }).setCancelable(isCancelDialog)
.showDialog();
} }
}); });
} }
@ -211,7 +214,8 @@ public class MessageSayHiNotifyManager {
if (startListNotifyList.iterator().hasNext()) { if (startListNotifyList.iterator().hasNext()) {
notifyLiveFlot(mContext); notifyLiveFlot(mContext);
} }
}).showDialog(); }).setCancelable(isCancelDialog)
.showDialog();
} else { } else {
ToastUtil.showDebug("Not Message"); ToastUtil.showDebug("Not Message");
} }