11111
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/**
|
||||
* 用户面向指导员的数据类
|
||||
*/
|
||||
public class NoviceInstructorModel extends BaseModel {
|
||||
@SerializedName("sendFirstMessage")
|
||||
private String sendFirstMessage = "";
|
||||
|
||||
public String getSendFirstMessage() {
|
||||
return sendFirstMessage;
|
||||
}
|
||||
|
||||
public NoviceInstructorModel setSendFirstMessage(String sendFirstMessage) {
|
||||
this.sendFirstMessage = sendFirstMessage;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.yunbao.common.event;
|
||||
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
|
||||
/**
|
||||
* 指引用户与指导员交互的通讯数据类
|
||||
*/
|
||||
public class NoviceInstructorEvent extends BaseModel {
|
||||
//是否展示指引弹窗
|
||||
private boolean isShowHomeDialoh = false;
|
||||
//是否展示指引icon
|
||||
private boolean isShowHomeIcon = false;
|
||||
|
||||
public boolean isShowHomeDialoh() {
|
||||
return isShowHomeDialoh;
|
||||
}
|
||||
|
||||
public NoviceInstructorEvent setShowHomeDialoh(boolean showHomeDialoh) {
|
||||
isShowHomeDialoh = showHomeDialoh;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isShowHomeIcon() {
|
||||
return isShowHomeIcon;
|
||||
}
|
||||
|
||||
public NoviceInstructorEvent setShowHomeIcon(boolean showHomeIcon) {
|
||||
isShowHomeIcon = showHomeIcon;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
package com.yunbao.common.manager;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.yunbao.common.bean.NoviceInstructorModel;
|
||||
import com.yunbao.common.event.NoviceInstructorEvent;
|
||||
import com.yunbao.common.manager.base.BaseCacheManager;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
/***
|
||||
* 新手指导员管理引导
|
||||
*/
|
||||
public class NoviceInstructorManager extends BaseCacheManager {
|
||||
private NoviceInstructorModel model = null;
|
||||
private final static String KEY_NOVICE_INSTRUCTOR = "NoviceInstructor";
|
||||
private static NoviceInstructorManager manager;
|
||||
private Context context;
|
||||
//展示新手指导员福利
|
||||
private Handler netHandler = new Handler();
|
||||
|
||||
public NoviceInstructorManager(Context context) {
|
||||
super(context);
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取单利
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static NoviceInstructorManager get(Context context) {
|
||||
if (null == manager) {
|
||||
manager = new NoviceInstructorManager(context);
|
||||
}
|
||||
return manager;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新手指导员相关信息类
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public NoviceInstructorModel getNoviceInstructor() {
|
||||
if (null == model) {
|
||||
model = new Gson().fromJson(
|
||||
getString(KEY_NOVICE_INSTRUCTOR), NoviceInstructorModel.class);
|
||||
}
|
||||
return model;
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求接口,保存相应序列化数据
|
||||
*
|
||||
* @param model
|
||||
*/
|
||||
public void setNoviceInstructor(@NonNull NoviceInstructorModel model) {
|
||||
this.model = model;
|
||||
put(KEY_NOVICE_INSTRUCTOR, new Gson().toJson(model));
|
||||
}
|
||||
|
||||
/**
|
||||
* 清除相关信息
|
||||
*/
|
||||
public void removeNoviceInstructor() {
|
||||
deleteByKey(KEY_NOVICE_INSTRUCTOR);
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求接口获取是否展示
|
||||
*/
|
||||
public void getNetNoviceInstructor() {
|
||||
if (null != model) {
|
||||
netHandler.post(instructorOperationRunnable);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 指导员操作
|
||||
*/
|
||||
private Runnable instructorOperationRunnable = new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
//展示指引弹窗
|
||||
EventBus.getDefault().post(new NoviceInstructorEvent().setShowHomeIcon(true));
|
||||
}
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user