add[打招呼弹窗是否取消可配置,后台新增配置开关。]
This commit is contained in:
parent
7b6eb7bbed
commit
7a5d2b90d8
@ -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;
|
||||||
}
|
}
|
||||||
|
@ -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
|
||||||
|
@ -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();
|
||||||
@ -116,26 +118,27 @@ public class MessageSayHiNotifyManager {
|
|||||||
Log.i(TAG, "showDialog: 打开本轮打招呼弹框 " + bean);
|
Log.i(TAG, "showDialog: 打开本轮打招呼弹框 " + bean);
|
||||||
lastActivity = AppManager.getInstance().getLastActivity().getClass().getSimpleName();
|
lastActivity = AppManager.getInstance().getLastActivity().getClass().getSimpleName();
|
||||||
new MessageSayHiNotifyDialog(AppManager.getInstance().getLastActivity(), bean.getUser()).setOnDismissListener((userId, position) ->
|
new MessageSayHiNotifyDialog(AppManager.getInstance().getLastActivity(), bean.getUser()).setOnDismissListener((userId, position) ->
|
||||||
{
|
{
|
||||||
Log.i(TAG, "showDialog: 关闭打招呼弹窗,uid:" + userId + ",是否点击打招呼:" + (position == 2));
|
Log.i(TAG, "showDialog: 关闭打招呼弹窗,uid:" + userId + ",是否点击打招呼:" + (position == 2));
|
||||||
isShowDialog = false;
|
isShowDialog = false;
|
||||||
LiveNetManager.get(AppManager.getInstance().getLastActivity())
|
LiveNetManager.get(AppManager.getInstance().getLastActivity())
|
||||||
.callBackMessageSayHiTimer(userId, position, new HttpCallback<List<BaseModel>>() {
|
.callBackMessageSayHiTimer(userId, position, new HttpCallback<List<BaseModel>>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(List<BaseModel> data) {
|
public void onSuccess(List<BaseModel> data) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(String error) {
|
public void onError(String error) {
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
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();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -207,11 +210,12 @@ public class MessageSayHiNotifyManager {
|
|||||||
if (startListNotifyList.iterator().hasNext()) {
|
if (startListNotifyList.iterator().hasNext()) {
|
||||||
MessageUserInfoBean bean = startListNotifyList.iterator().next();
|
MessageUserInfoBean bean = startListNotifyList.iterator().next();
|
||||||
new MessageSayHiNotifyDialog(AppManager.getInstance().getLastActivity(), bean).setOnDismissListener((bean1, position) -> {
|
new MessageSayHiNotifyDialog(AppManager.getInstance().getLastActivity(), bean).setOnDismissListener((bean1, position) -> {
|
||||||
startListNotifyList.remove(bean);
|
startListNotifyList.remove(bean);
|
||||||
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");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user