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;
import com.google.gson.Gson;
import com.google.gson.annotations.SerializedName;
/**
* 用户面向指导员的数据类
*/
public class NoviceInstructorModel extends BaseModel {
@SerializedName("sendFirstMessage")
private String sendFirstMessage = "";
@SerializedName("msg_zdy_send")
private String msgZdySend = "";
@SerializedName("msg_zdy_send_text")
private String msgZdySendText = "";
/**
* msg_zdy_send : 1
* msg_zdy_send_text : 您好
*/
@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() {
return msgZdySend;
@ -32,24 +46,4 @@ public class NoviceInstructorModel extends BaseModel {
this.msgZdySendText = msgZdySendText;
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.os.Handler;
import android.text.TextUtils;
import android.util.Log;
import androidx.annotation.NonNull;
import com.google.gson.Gson;
import com.google.gson.JsonSyntaxException;
import com.yunbao.common.bean.IMLoginModel;
import com.yunbao.common.bean.NoviceInstructorModel;
import com.yunbao.common.event.NoviceInstructorEvent;
@ -15,6 +18,9 @@ import com.yunbao.common.manager.base.BaseCacheManager;
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() {
if (null == model) {
model = new Gson().fromJson(getString(KEY_NOVICE_INSTRUCTOR), NoviceInstructorModel.class);
} else {
netHandler.post(instructorOperationRunnable);
}
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();
HttpClient.getInstance().get("Message.setZdyMsg", "setZdyMsg")
.params("uid", userInfo.getId())
.execute(new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
}
});
model = null;
deleteByKey(KEY_NOVICE_INSTRUCTOR);
EventBus.getDefault().post(new NoviceInstructorEvent().setShowHomeIcon(false));
}
});
}
}
/**
* 请求接口获取是否展示
*/
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);
setNoviceInstructor(model);
if (model != null) {
netHandler.post(instructorOperationRunnable);
}
} catch (JsonSyntaxException ignored) {
}
}
}
@ -102,7 +125,7 @@ public class NoviceInstructorManager extends BaseCacheManager {
@Override
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 = [
//
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",

View File

@ -22,7 +22,9 @@ import com.yunbao.common.activity.AbsActivity;
import com.yunbao.common.activity.SelectImageActivity;
import com.yunbao.common.bean.IMLoginModel;
import com.yunbao.common.bean.ImageEntity;
import com.yunbao.common.bean.NoviceInstructorModel;
import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.manager.NoviceInstructorManager;
import com.yunbao.common.manager.imrongcloud.MessageIMManager;
import com.yunbao.live.R;
import com.yunbao.live.bean.SearchUserBean;
@ -81,6 +83,10 @@ public class PDLiveConversationActivity extends AbsActivity implements View.OnCl
*/
private void initData() {
targetId = getIntent().getStringExtra("targetId");
NoviceInstructorModel model = NoviceInstructorManager.get(this).getNoviceInstructor();
if (model != null && !TextUtils.isEmpty(model.getMsgZdySendText())) {
inputPanel.setPresetInformation(model.getMsgZdySendText());
}
//绑定聊天用户id
inputPanel.setTargetId(targetId);
//获取用户信息
@ -122,14 +128,7 @@ public class PDLiveConversationActivity extends AbsActivity implements View.OnCl
titleView = findViewById(R.id.titleView);
imgMore = findViewById(R.id.img_more);
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);
imBack.setOnClickListener(this);

View File

@ -23,8 +23,6 @@ import com.yunbao.common.utils.ToastUtil;
import com.yunbao.live.R;
import com.yunbao.live.utils.FileSizeUtil;
import org.greenrobot.eventbus.EventBus;
import io.rong.imkit.IMCenter;
import io.rong.imlib.IRongCallback;
import io.rong.imlib.RongIMClient;
@ -47,7 +45,14 @@ public class InputPanelViewHolder extends LinearLayout implements View.OnClickLi
//是否可以发送消息
private boolean isSend = false;
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 {
ToastUtil.show("不可以发送空消息");
}
//发送以后删除相应标志
NoviceInstructorManager.get(getContext()).removeNoviceInstructor();
NoviceInstructorManager.get(getContext()).removeNoviceInstructor(targetId);
}
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) {
@ -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
android:id="@+id/rc_conversation_portrait_rl"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginStart="@dimen/rc_margin_size_12"
android:layout_marginTop="@dimen/rc_margin_size_12"
android:layout_width="54dp"
android:layout_height="54dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="@+id/rc_conversation_portrait"
android:layout_width="@dimen/rc_conversation_portrait_size"
android:layout_height="@dimen/rc_conversation_portrait_size"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop" />

View File

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

View File

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