This commit is contained in:
18401019693 2022-07-26 18:28:47 +08:00
parent a4153da415
commit f00fcac663
8 changed files with 91 additions and 68 deletions

View File

@ -1,19 +1,33 @@
package com.yunbao.common.bean; package com.yunbao.common.bean;
import com.google.gson.Gson;
import com.google.gson.annotations.SerializedName; import com.google.gson.annotations.SerializedName;
/** /**
* 用户面向指导员的数据类 * 用户面向指导员的数据类
*/ */
public class NoviceInstructorModel extends BaseModel { public class NoviceInstructorModel extends BaseModel {
@SerializedName("sendFirstMessage")
private String sendFirstMessage = "";
@SerializedName("msg_zdy_send") /**
private String msgZdySend = ""; * msg_zdy_send : 1
@SerializedName("msg_zdy_send_text") * msg_zdy_send_text : 您好
private String msgZdySendText = ""; */
@SerializedName("home_zdy_pop") @SerializedName("home_zdy_pop")
private String homeZdyPop = ""; private int homeZdyPop;
@SerializedName("msg_zdy_send")
private String msgZdySend;
@SerializedName("msg_zdy_send_text")
private String msgZdySendText;
public int getHomeZdyPop() {
return homeZdyPop;
}
public NoviceInstructorModel setHomeZdyPop(int homeZdyPop) {
this.homeZdyPop = homeZdyPop;
return this;
}
public String getMsgZdySend() { public String getMsgZdySend() {
return msgZdySend; return msgZdySend;
@ -32,24 +46,4 @@ public class NoviceInstructorModel extends BaseModel {
this.msgZdySendText = msgZdySendText; this.msgZdySendText = msgZdySendText;
return this; return this;
} }
public String getHomeZdyPop() {
return homeZdyPop;
}
public NoviceInstructorModel setHomeZdyPop(String homeZdyPop) {
this.homeZdyPop = homeZdyPop;
return this;
}
public String getSendFirstMessage() {
return sendFirstMessage;
}
public NoviceInstructorModel setSendFirstMessage(String sendFirstMessage) {
this.sendFirstMessage = sendFirstMessage;
return this;
}
} }

View File

@ -2,10 +2,13 @@ package com.yunbao.common.manager;
import android.content.Context; import android.content.Context;
import android.os.Handler; import android.os.Handler;
import android.text.TextUtils;
import android.util.Log;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.JsonSyntaxException;
import com.yunbao.common.bean.IMLoginModel; import com.yunbao.common.bean.IMLoginModel;
import com.yunbao.common.bean.NoviceInstructorModel; import com.yunbao.common.bean.NoviceInstructorModel;
import com.yunbao.common.event.NoviceInstructorEvent; import com.yunbao.common.event.NoviceInstructorEvent;
@ -15,6 +18,9 @@ import com.yunbao.common.manager.base.BaseCacheManager;
import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.EventBus;
import io.rong.imkit.userinfo.RongUserInfoManager;
import io.rong.imlib.model.UserInfo;
/*** /***
* 新手指导员管理引导 * 新手指导员管理引导
*/ */
@ -52,6 +58,8 @@ public class NoviceInstructorManager extends BaseCacheManager {
public NoviceInstructorModel getNoviceInstructor() { public NoviceInstructorModel getNoviceInstructor() {
if (null == model) { if (null == model) {
model = new Gson().fromJson(getString(KEY_NOVICE_INSTRUCTOR), NoviceInstructorModel.class); model = new Gson().fromJson(getString(KEY_NOVICE_INSTRUCTOR), NoviceInstructorModel.class);
} else {
netHandler.post(instructorOperationRunnable); netHandler.post(instructorOperationRunnable);
} }
return model; return model;
@ -70,27 +78,42 @@ public class NoviceInstructorManager extends BaseCacheManager {
/** /**
* 清除相关信息 * 清除相关信息
*/ */
public void removeNoviceInstructor() { public void removeNoviceInstructor(String targetId) {
//只有和指导员对话才可以清除信息
UserInfo model1 = RongUserInfoManager.getInstance().getUserInfo(targetId);
IMLoginModel userModel = new Gson().fromJson(model1.getExtra(), IMLoginModel.class);
if (TextUtils.equals(userModel.getIsAdmin(), "1")) {
IMLoginModel userInfo = IMLoginManager.get(context).getUserInfo(); IMLoginModel userInfo = IMLoginManager.get(context).getUserInfo();
HttpClient.getInstance().get("Message.setZdyMsg", "setZdyMsg") HttpClient.getInstance().get("Message.setZdyMsg", "setZdyMsg")
.params("uid", userInfo.getId()) .params("uid", userInfo.getId())
.execute(new HttpCallback() { .execute(new HttpCallback() {
@Override @Override
public void onSuccess(int code, String msg, String[] info) { public void onSuccess(int code, String msg, String[] info) {
}
});
model = null; model = null;
deleteByKey(KEY_NOVICE_INSTRUCTOR); deleteByKey(KEY_NOVICE_INSTRUCTOR);
EventBus.getDefault().post(new NoviceInstructorEvent().setShowHomeIcon(false)); EventBus.getDefault().post(new NoviceInstructorEvent().setShowHomeIcon(false));
} }
});
}
}
/** /**
* 请求接口获取是否展示 * 请求接口获取是否展示
*/ */
public void getNetNoviceInstructor(String info) { public void getNetNoviceInstructor(String info) {
IMLoginModel userInfo = IMLoginManager.get(context).getUserInfo();
//非指导员用户才启用该逻辑
if (!TextUtils.equals(userInfo.getIsAdmin(), "1")) {
try {
Log.e("MainActivity", "getNetNoviceInstructor:" + info);
model = new Gson().fromJson(info, NoviceInstructorModel.class); model = new Gson().fromJson(info, NoviceInstructorModel.class);
setNoviceInstructor(model); setNoviceInstructor(model);
if (model != null) {
netHandler.post(instructorOperationRunnable);
}
} catch (JsonSyntaxException ignored) {
}
}
} }
@ -102,7 +125,7 @@ public class NoviceInstructorManager extends BaseCacheManager {
@Override @Override
public void run() { public void run() {
//展示指引弹窗 //展示指引弹窗
EventBus.getDefault().post(new NoviceInstructorEvent().setShowHomeIcon(true)); EventBus.getDefault().post(new NoviceInstructorEvent().setShowHomeIcon(TextUtils.equals(model.getMsgZdySend(), "1")));
} }
}; };
} }

View File

@ -9,9 +9,9 @@ ext {
] ]
manifestPlaceholders = [ manifestPlaceholders = [
// //
serverHost : "https://napi.yaoulive.com", // serverHost : "https://napi.yaoulive.com",
// //
// serverHost : "https://ceshi.yaoulive.com", serverHost : "https://ceshi.yaoulive.com",
// //
txMapAppKey : "EOZBZ-ASLCU-4XPV3-BDCHZ-4E3Q7-H4BWB", txMapAppKey : "EOZBZ-ASLCU-4XPV3-BDCHZ-4E3Q7-H4BWB",

View File

@ -22,7 +22,9 @@ import com.yunbao.common.activity.AbsActivity;
import com.yunbao.common.activity.SelectImageActivity; import com.yunbao.common.activity.SelectImageActivity;
import com.yunbao.common.bean.IMLoginModel; import com.yunbao.common.bean.IMLoginModel;
import com.yunbao.common.bean.ImageEntity; import com.yunbao.common.bean.ImageEntity;
import com.yunbao.common.bean.NoviceInstructorModel;
import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.manager.NoviceInstructorManager;
import com.yunbao.common.manager.imrongcloud.MessageIMManager; import com.yunbao.common.manager.imrongcloud.MessageIMManager;
import com.yunbao.live.R; import com.yunbao.live.R;
import com.yunbao.live.bean.SearchUserBean; import com.yunbao.live.bean.SearchUserBean;
@ -81,11 +83,15 @@ public class PDLiveConversationActivity extends AbsActivity implements View.OnCl
*/ */
private void initData() { private void initData() {
targetId = getIntent().getStringExtra("targetId"); targetId = getIntent().getStringExtra("targetId");
NoviceInstructorModel model = NoviceInstructorManager.get(this).getNoviceInstructor();
if (model != null && !TextUtils.isEmpty(model.getMsgZdySendText())) {
inputPanel.setPresetInformation(model.getMsgZdySendText());
}
//绑定聊天用户id //绑定聊天用户id
inputPanel.setTargetId(targetId); inputPanel.setTargetId(targetId);
//获取用户信息 //获取用户信息
UserInfo userInfo = RongUserInfoManager.getInstance().getUserInfo(targetId); UserInfo userInfo = RongUserInfoManager.getInstance().getUserInfo(targetId);
if (null!=userInfo){ if (null != userInfo) {
titleView.setText(userInfo.getName()); titleView.setText(userInfo.getName());
if (!TextUtils.isEmpty(userInfo.getExtra())) { if (!TextUtils.isEmpty(userInfo.getExtra())) {
SearchUserBean userBean = GsonUtils.fromJson(userInfo.getExtra(), SearchUserBean.class); SearchUserBean userBean = GsonUtils.fromJson(userInfo.getExtra(), SearchUserBean.class);
@ -99,7 +105,7 @@ public class PDLiveConversationActivity extends AbsActivity implements View.OnCl
} }
Log.e("PDLiveConversation", userInfo.getExtra()); Log.e("PDLiveConversation", userInfo.getExtra());
} }
}else { } else {
titleView.setText("系統消息"); titleView.setText("系統消息");
inputPanel.setVisibility(View.GONE); inputPanel.setVisibility(View.GONE);
} }
@ -122,14 +128,7 @@ public class PDLiveConversationActivity extends AbsActivity implements View.OnCl
titleView = findViewById(R.id.titleView); titleView = findViewById(R.id.titleView);
imgMore = findViewById(R.id.img_more); imgMore = findViewById(R.id.img_more);
imBack = findViewById(R.id.btn_back); imBack = findViewById(R.id.btn_back);
findViewById(R.id.root_layout).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
InputMethodManager imm = (InputMethodManager)
getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
}
});
imgMore.setOnClickListener(this); imgMore.setOnClickListener(this);
imBack.setOnClickListener(this); imBack.setOnClickListener(this);

View File

@ -23,8 +23,6 @@ import com.yunbao.common.utils.ToastUtil;
import com.yunbao.live.R; import com.yunbao.live.R;
import com.yunbao.live.utils.FileSizeUtil; import com.yunbao.live.utils.FileSizeUtil;
import org.greenrobot.eventbus.EventBus;
import io.rong.imkit.IMCenter; import io.rong.imkit.IMCenter;
import io.rong.imlib.IRongCallback; import io.rong.imlib.IRongCallback;
import io.rong.imlib.RongIMClient; import io.rong.imlib.RongIMClient;
@ -47,7 +45,14 @@ public class InputPanelViewHolder extends LinearLayout implements View.OnClickLi
//是否可以发送消息 //是否可以发送消息
private boolean isSend = false; private boolean isSend = false;
private LinearLayout pluginList; private LinearLayout pluginList;
//接口返回预置信息
private String presetInformation = "";
public InputPanelViewHolder setPresetInformation(String presetInformation) {
this.presetInformation = presetInformation;
editBtn.setText(presetInformation);
return this;
}
/** /**
* 必传字段 * 必传字段
@ -163,8 +168,9 @@ public class InputPanelViewHolder extends LinearLayout implements View.OnClickLi
} else { } else {
ToastUtil.show("不可以发送空消息"); ToastUtil.show("不可以发送空消息");
} }
//发送以后删除相应标志 //发送以后删除相应标志
NoviceInstructorManager.get(getContext()).removeNoviceInstructor(); NoviceInstructorManager.get(getContext()).removeNoviceInstructor(targetId);
} }
private TextWatcher mEditTextWatcher = new TextWatcher() { private TextWatcher mEditTextWatcher = new TextWatcher() {
@ -240,7 +246,7 @@ public class InputPanelViewHolder extends LinearLayout implements View.OnClickLi
} }
}); });
//发送以后删除相应标志 //发送以后删除相应标志
NoviceInstructorManager.get(getContext()).removeNoviceInstructor(); NoviceInstructorManager.get(getContext()).removeNoviceInstructor(targetId);
} }
public void sendVideoFile(String filePath) { public void sendVideoFile(String filePath) {
@ -300,7 +306,7 @@ public class InputPanelViewHolder extends LinearLayout implements View.OnClickLi
} }
});// });//
//发送以后删除相应标志 //发送以后删除相应标志
NoviceInstructorManager.get(getContext()).removeNoviceInstructor(); NoviceInstructorManager.get(getContext()).removeNoviceInstructor(targetId);
} }
/** /**
@ -346,7 +352,7 @@ public class InputPanelViewHolder extends LinearLayout implements View.OnClickLi
} }
}); });
//发送以后删除相应标志 //发送以后删除相应标志
NoviceInstructorManager.get(getContext()).removeNoviceInstructor(); NoviceInstructorManager.get(getContext()).removeNoviceInstructor(targetId);
} }
/** /**

View File

@ -11,18 +11,18 @@
<RelativeLayout <RelativeLayout
android:id="@+id/rc_conversation_portrait_rl" android:id="@+id/rc_conversation_portrait_rl"
android:layout_width="48dp" android:layout_width="54dp"
android:layout_height="48dp" android:layout_height="54dp"
android:layout_marginStart="@dimen/rc_margin_size_12" android:layout_marginLeft="15dp"
android:layout_marginTop="@dimen/rc_margin_size_12" android:layout_marginRight="15dp"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"> app:layout_constraintTop_toTopOf="parent">
<ImageView <ImageView
android:id="@+id/rc_conversation_portrait" android:id="@+id/rc_conversation_portrait"
android:layout_width="@dimen/rc_conversation_portrait_size" android:layout_width="match_parent"
android:layout_height="@dimen/rc_conversation_portrait_size" android:layout_height="match_parent"
android:scaleType="centerCrop" /> android:scaleType="centerCrop" />

View File

@ -558,6 +558,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
fragment.show(getSupportFragmentManager(), "SigninDialog"); fragment.show(getSupportFragmentManager(), "SigninDialog");
} }
if (obj.containsKey("msg_zdy_send") && obj.containsKey("msg_zdy_send_text")) { if (obj.containsKey("msg_zdy_send") && obj.containsKey("msg_zdy_send_text")) {
Log.e("MainActivity333", info[0]);
NoviceInstructorManager.get(mContext).getNetNoviceInstructor(info[0]); NoviceInstructorManager.get(mContext).getNetNoviceInstructor(info[0]);
} }
} }

View File

@ -60,7 +60,7 @@
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_marginTop="5dp" android:layout_marginTop="5dp"
android:layout_marginRight="10dp" android:layout_marginRight="10dp"
android:background="@drawable/background_ff50715" android:background="@drawable/rc_unread_count_bg_normal"
android:gravity="center" android:gravity="center"
android:includeFontPadding="false" android:includeFontPadding="false"
android:minWidth="14dp" android:minWidth="14dp"