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")
private int nextTime;
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() {
return nextTime;
}

View File

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

View File

@ -28,6 +28,7 @@ public class MessageSayHiNotifyManager {
private boolean isStopShow = false;
private boolean isShowDialog = false;
private boolean isRun = false;
private boolean isCancelDialog = true;
private MessageSayHiBean hiBean;
private List<MessageUserInfoBean> startListNotifyList = new ArrayList<>();
private String lastActivity;
@ -51,6 +52,7 @@ public class MessageSayHiNotifyManager {
Log.i(TAG, "onSuccess: 初始化定时器,定时器关:" + data.toString());
return;
}
isCancelDialog = data.isCancelDialog();
timer = new Timer();
timer.schedule(createTask(), data.getNextTime() * 1000L);
hiBean = new MessageSayHiBean();
@ -116,26 +118,27 @@ public class MessageSayHiNotifyManager {
Log.i(TAG, "showDialog: 打开本轮打招呼弹框 " + bean);
lastActivity = AppManager.getInstance().getLastActivity().getClass().getSimpleName();
new MessageSayHiNotifyDialog(AppManager.getInstance().getLastActivity(), bean.getUser()).setOnDismissListener((userId, position) ->
{
Log.i(TAG, "showDialog: 关闭打招呼弹窗,uid:" + userId + ",是否点击打招呼:" + (position == 2));
isShowDialog = false;
LiveNetManager.get(AppManager.getInstance().getLastActivity())
.callBackMessageSayHiTimer(userId, position, new HttpCallback<List<BaseModel>>() {
@Override
public void onSuccess(List<BaseModel> data) {
{
Log.i(TAG, "showDialog: 关闭打招呼弹窗,uid:" + userId + ",是否点击打招呼:" + (position == 2));
isShowDialog = false;
LiveNetManager.get(AppManager.getInstance().getLastActivity())
.callBackMessageSayHiTimer(userId, position, new HttpCallback<List<BaseModel>>() {
@Override
public void onSuccess(List<BaseModel> data) {
}
}
@Override
public void onError(String error) {
@Override
public void onError(String error) {
}
});
}
});
Log.i(TAG, "onSuccess: 启动定时器,下一轮时间:" + bean.getNextTime() + "");
timer = new Timer();
timer.schedule(createTask(), bean.getNextTime() * 1000L);
}).showDialog();
Log.i(TAG, "onSuccess: 启动定时器,下一轮时间:" + bean.getNextTime() + "");
timer = new Timer();
timer.schedule(createTask(), bean.getNextTime() * 1000L);
}).setCancelable(isCancelDialog)
.showDialog();
}
});
}
@ -207,11 +210,12 @@ public class MessageSayHiNotifyManager {
if (startListNotifyList.iterator().hasNext()) {
MessageUserInfoBean bean = startListNotifyList.iterator().next();
new MessageSayHiNotifyDialog(AppManager.getInstance().getLastActivity(), bean).setOnDismissListener((bean1, position) -> {
startListNotifyList.remove(bean);
if (startListNotifyList.iterator().hasNext()) {
notifyLiveFlot(mContext);
}
}).showDialog();
startListNotifyList.remove(bean);
if (startListNotifyList.iterator().hasNext()) {
notifyLiveFlot(mContext);
}
}).setCancelable(isCancelDialog)
.showDialog();
} else {
ToastUtil.showDebug("Not Message");
}