消息中心修改

This commit is contained in:
18401019693 2022-09-03 16:49:01 +08:00
parent b5cfb5abc1
commit f1d49653b5
17 changed files with 538 additions and 86 deletions

View File

@ -32,9 +32,9 @@ import static com.yunbao.common.CommonAppContext.isReady;
*/
public class RongcloudIMManager {
//融云开发者平台注册app唯一识别符
public static final String RONG_IM_KEY = "uwd1c0sxu1p71";
// public static final String RONG_IM_KEY = "uwd1c0sxu1p71";
//测试环境
// public static final String RONG_IM_KEY = "pvxdm17jpd3hr";
public static final String RONG_IM_KEY = "pvxdm17jpd3hr";
private static final String CLASSNAME = "RongcloudIMManager";

View File

@ -883,4 +883,6 @@
<string name="shield_gift_effect">屏蔽禮物特效</string>
<string name="shield_mount_effect">屏蔽座駕特效</string>
<string name="current_live_room">您已在當前直播間</string>
<string name="clear_unread_messages">是否清空未讀消息</string>
</resources>

View File

@ -10,9 +10,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

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="95dp" />
<solid android:color="@color/red" />
<stroke
android:width="1dp"
android:color="@color/white" />
<padding
android:bottom="5dp"
android:left="10dp"
android:right="10dp"
android:top="5dp" />
</shape>

View File

@ -1,23 +1,147 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/rc_conversation_item"
android:layout_width="match_parent"
android:layout_height="@dimen/rc_conversation_item_height">
android:layout_height="123dp">
<androidx.constraintlayout.widget.ConstraintLayout
<RelativeLayout
android:id="@+id/administrator_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:layout_marginStart="8dp"
android:visibility="gone"
android:layout_marginTop="5dp"
android:layout_marginEnd="8dp">
<RelativeLayout
android:id="@+id/img_administrator_layout"
android:layout_width="54dp"
android:layout_height="54dp"
android:layout_marginStart="34dp"
android:layout_marginTop="39dp"
android:layout_marginEnd="15dp">
<com.yunbao.common.views.weight.ClipPathCircleImage
android:id="@+id/img_administrator"
android:layout_width="54dp"
android:layout_height="54dp"
android:scaleType="centerCrop"
android:src="@mipmap/beauty_jingbai" />
<ImageView
android:id="@+id/img_administrator_logo"
android:layout_width="match_parent"
android:layout_height="22dp"
android:layout_alignParentBottom="true"
android:layout_marginBottom="-5dp"
android:src="@mipmap/img_news_instructor_tags_chinese"
android:visibility="visible" />
</RelativeLayout>
<LinearLayout
android:id="@+id/conversation_linear"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="41dp"
android:layout_toEndOf="@id/img_administrator_layout"
android:gravity="center_vertical">
<TextView
android:id="@+id/conversation_title"
style="@style/TextStyle.Alignment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:singleLine="true"
android:text="张三"
android:textColor="#161616"
android:textSize="16sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/conversation_linear"
android:layout_toEndOf="@id/img_administrator_layout"
android:layout_marginTop="7dp"
android:gravity="center_vertical">
<ImageView
android:id="@+id/rc_conversation_read_receipt"
android:layout_width="30dp"
android:layout_height="15dp"
android:layout_marginEnd="4dp"
android:visibility="gone" />
<TextView
android:id="@+id/rc_conversation_content"
style="@style/TextStyle.Alignment"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="60dp"
android:layout_weight="1"
android:ellipsize="end"
android:singleLine="true"
android:text="你好,朋友!"
android:textColor="@color/rc_secondary_color"
android:textSize="14sp" />
<RelativeLayout
android:id="@+id/conversation_unread"
android:layout_width="wrap_content"
android:layout_height="20dp"
android:layout_marginEnd="26dp">
<ImageView
android:id="@+id/conversation_unread_bg"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_centerInParent="true"
app:srcCompat="@drawable/rc_unread_count_bg_normal" />
<TextView
android:id="@+id/conversation_unread_count"
style="@style/TextStyle.Alignment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="15"
android:textColor="@color/rc_white_color"
android:textSize="14sp" />
</RelativeLayout>
</LinearLayout>
<TextView
android:id="@+id/conversation_date"
style="@style/TextStyle.Alignment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_marginTop="41dp"
android:layout_marginEnd="26dp"
android:text="3 月 22 日"
android:textColor="@color/rc_auxiliary_color"
android:textSize="@dimen/rc_font_nav_or_date_size" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/rc_conversation_portrait_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="visible">
<RelativeLayout
android:id="@+id/rc_conversation_portrait_rl"
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">
android:layout_marginStart="16dp"
android:layout_marginTop="39dp"
android:layout_marginEnd="15dp">
<ImageView
android:id="@+id/rc_conversation_portrait"
@ -34,17 +158,15 @@
android:visibility="gone" />
</RelativeLayout>
<LinearLayout
android:id="@+id/rc_conversation_linear"
android:layout_width="0dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="15dp"
android:layout_marginTop="@dimen/rc_margin_size_16"
android:layout_marginStart="88dp"
android:layout_marginTop="41dp"
android:layout_marginEnd="@dimen/rc_margin_size_12"
android:gravity="center_vertical"
app:layout_constraintEnd_toStartOf="@+id/rc_conversation_date"
app:layout_constraintStart_toEndOf="@+id/rc_conversation_portrait_rl"
app:layout_constraintTop_toTopOf="parent">
android:gravity="center_vertical">
<TextView
android:id="@+id/rc_conversation_title"
@ -54,7 +176,7 @@
android:ellipsize="end"
android:singleLine="true"
android:text="张三"
android:textColor="@color/rc_text_main_color"
android:textColor="#161616"
android:textSize="16sp" />
@ -62,30 +184,18 @@
<LinearLayout
android:layout_width="0dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="15dp"
android:gravity="center_vertical"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/rc_conversation_portrait_rl"
app:layout_constraintTop_toBottomOf="@+id/rc_conversation_linear">
<ImageView
android:id="@+id/rc_conversation_read_receipt"
android:layout_width="30dp"
android:layout_height="15dp"
android:layout_marginTop="4dp"
android:layout_marginEnd="4dp"
android:visibility="gone" />
android:layout_below="@id/rc_conversation_linear"
android:layout_marginStart="88dp"
android:gravity="center_vertical">
<TextView
android:id="@+id/rc_conversation_content"
android:id="@+id/conversation_content"
style="@style/TextStyle.Alignment"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginTop="4dp"
android:layout_marginEnd="60dp"
android:layout_weight="1"
@ -126,13 +236,12 @@
style="@style/TextStyle.Alignment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_marginTop="@dimen/rc_margin_size_16"
android:layout_marginEnd="@dimen/rc_margin_size_12"
android:text="3 月 22 日"
android:textColor="@color/rc_auxiliary_color"
android:textSize="@dimen/rc_font_nav_or_date_size"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
android:textSize="@dimen/rc_font_nav_or_date_size" />
<ImageView
android:id="@+id/rc_conversation_no_disturb"
@ -142,6 +251,7 @@
android:layout_marginBottom="@dimen/rc_margin_size_12"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:visibility="gone"
app:srcCompat="@drawable/rc_no_disturb" />
@ -150,8 +260,9 @@
android:layout_height="0.5dp"
android:layout_marginTop="71.5dp"
android:background="@color/rc_divider_color"
android:visibility="gone"
app:layout_constraintStart_toStartOf="@id/rc_conversation_linear"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</RelativeLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</RelativeLayout>

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View File

@ -1,11 +1,15 @@
package com.yunbao.main.activity;
import android.app.Dialog;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.fragment.app.FragmentManager;
@ -19,16 +23,19 @@ import com.alibaba.fastjson.JSON;
import com.facebook.appevents.AppEventsLogger;
import com.google.firebase.analytics.FirebaseAnalytics;
import com.yunbao.common.activity.AbsActivity;
import com.yunbao.common.activity.WebViewActivity;
import com.yunbao.common.bean.ImUserInfoModel;
import com.yunbao.common.custom.TabButtonGroup;
import com.yunbao.common.event.MessageIMEvent;
import com.yunbao.common.event.UpdateTablePointMe;
import com.yunbao.common.http.CommonHttpUtil;
import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.manager.imrongcloud.MessageIMManager;
import com.yunbao.common.utils.DialogUitl;
import com.yunbao.common.utils.ProcessResultUtil;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.views.weight.ViewClicksAntiShake;
import com.yunbao.live.activity.SystemMessageActivity;
import com.yunbao.live.bean.ImUserBean;
import com.yunbao.live.http.ImHttpUtil;
import com.yunbao.main.R;
@ -41,6 +48,7 @@ import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
@ -52,7 +60,7 @@ import static com.yunbao.common.CommonAppContext.isReady;
/**
* pdlive消息中心
*/
public class PDLiveConversationListActivity extends AbsActivity {
public class PDLiveConversationListActivity extends AbsActivity implements View.OnClickListener {
//菜单
private TabButtonGroup mTabButtonGroup;
public static String CLASSNAME = "PDLiveConversationListActivity", MESSAGENUMBER = "messageNumber", NUMBERME = "numberMe";
@ -64,8 +72,14 @@ public class PDLiveConversationListActivity extends AbsActivity {
private View redpointMe;
private SystemMessageAdapter messageAdapter;
private ProcessResultUtil mProcessResultUtil;
private TextView textNewsNotice, textNewsInteraction, textNewsOnline;
private ImageView newsIconClearance;
private Handler netHandler = new Handler();
private String type = null;
private List<ImUserBean> listUserBean = new ArrayList<>();
@Override
protected int getLayoutId() {
return R.layout.activity_conversation_list;
}
@ -88,6 +102,10 @@ public class PDLiveConversationListActivity extends AbsActivity {
container = findViewById(R.id.container);
redPoint = findViewById(R.id.v_table_redpoint);
redpointMe = findViewById(R.id.v_table_redpoint_me);
textNewsNotice = findViewById(R.id.text_news_notice);
textNewsInteraction = findViewById(R.id.text_news_interaction);
textNewsOnline = findViewById(R.id.text_news_online);
newsIconClearance = findViewById(R.id.news_icon_clearance);
mTabButtonGroup.setCurPosition(2);
findViewById(R.id.btn_start).setOnClickListener(v -> {
@ -104,39 +122,35 @@ public class PDLiveConversationListActivity extends AbsActivity {
startActivity(new Intent(mContext, MainActivity.class));
}
});
newsIconClearance.setOnClickListener(this);
}
private void showStartDialog() {
if (isReady == true) {
MainStartDialogFragment dialogFragment = new MainStartDialogFragment();
dialogFragment.setMainStartChooseCallback(true,this);
dialogFragment.setMainStartChooseCallback(true, this);
dialogFragment.show(getSupportFragmentManager(), "MainStartDialogFragment");
} else {
ToastUtil.show("正在初始化,請稍等....");
}
}
/**
* 初始化数据
*/
private void initData() {
IMLoginManager.get(mContext).checkInstructor();
mProcessResultUtil = new ProcessResultUtil(this);
//获取系统消息列表
ImHttpUtil.getImUserInfo("", new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0) {
container.post(new Runnable() {
@Override
public void run() {
List<ImUserBean> listUserBean = JSON.parseArray(Arrays.toString(info), ImUserBean.class);
addSystemMessagesView(listUserBean);
}
});
}
}
});
netHandler.post(imUserInfoRunnable);
//展示会话列表
conversationListFragment = new ConversationListFragment();
FragmentManager manager = getSupportFragmentManager();
FragmentTransaction transaction = manager.beginTransaction();
transaction.replace(R.id.container, conversationListFragment);
transaction.commit();
//自定义空数据背景View
conversationListFragment.setEmptyView(com.yunbao.live.R.layout.view_layout_msg);
//刷新列表内用户信息
ConversationIMListManager.get(mContext).addUserInfoProvider();
//消息中心
@ -151,6 +165,144 @@ public class PDLiveConversationListActivity extends AbsActivity {
MessageIMManager.get(this).getSystemMessages();
}
/**
* 系統消息獲取
*/
private Runnable imUserInfoRunnable = new Runnable() {
@Override
public void run() {
//获取系统消息列表
ImHttpUtil.getImUserInfo("", new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0) {
runOnUiThread(() -> {
listUserBean = JSON.parseArray(Arrays.toString(info), ImUserBean.class);
for (ImUserBean userBean : listUserBean) {
switch (userBean.getType()) {
//官方通知
case "1":
if (TextUtils.isEmpty(userBean.getNum()) || TextUtils.equals("0", userBean.getNum())) {
textNewsNotice.setVisibility(View.GONE);
} else {
textNewsNotice.setVisibility(View.VISIBLE);
textNewsNotice.setText(userBean.getNum());
}
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.img_news_notice), () -> {
type = userBean.getType();
netHandler.post(systemNumberRunnable);
startActivity(new Intent(mContext, SystemMessageActivity.class)
.putExtra("type", userBean.getType())
.putExtra("uid", "")
.putExtra("title", userBean.getTitle())
.putExtra("headImg", ""));
});
break;
//互動消息
case "2":
if (TextUtils.isEmpty(userBean.getNum()) || TextUtils.equals("0", userBean.getNum())) {
textNewsInteraction.setVisibility(View.GONE);
} else {
textNewsInteraction.setVisibility(View.VISIBLE);
textNewsInteraction.setText(userBean.getNum());
}
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.img_news_interaction), () -> {
type = userBean.getType();
netHandler.post(systemNumberRunnable);
startActivity(new Intent(mContext, SystemMessageActivity.class)
.putExtra("type", userBean.getType())
.putExtra("uid", "")
.putExtra("title", userBean.getTitle())
.putExtra("headImg", ""));
});
break;
//在線客服
case "3":
if (TextUtils.isEmpty(userBean.getNum()) || TextUtils.equals("0", userBean.getNum())) {
textNewsOnline.setVisibility(View.GONE);
} else {
textNewsOnline.setVisibility(View.VISIBLE);
textNewsOnline.setText(userBean.getNum());
}
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.img_news_online), () -> {
type = userBean.getType();
netHandler.post(systemNumberRunnable);
FirebaseAnalytics.getInstance(mContext).logEvent("FS_customer_service", null);
AppEventsLogger.newLogger(mContext).logEvent("FB_customer_service");
AdjustEvent adjustEvent1 = new AdjustEvent("ww5z2p");
Adjust.trackEvent(adjustEvent1);
if (userBean.getLink() != null && !"".equals(userBean.getLink())) {
WebViewActivity.forward(mContext, userBean.getLink());
} else {
startActivity(new Intent(mContext, SystemMessageActivity.class)
.putExtra("type", userBean.getType())
.putExtra("uid", "")
.putExtra("title", userBean.getTitle())
.putExtra("headImg", ""));
}
});
break;
}
}
});
}
}
});
}
};
//修改小紅點
private Runnable systemNumberRunnable = new Runnable() {
@Override
public void run() {
runOnUiThread(() -> {
int systemNumber = 0;
for (ImUserBean userBean : listUserBean) {
//未读消息数
String number = userBean.getNum();
switch (userBean.getType()) {
//官方通知
case "1":
if (TextUtils.equals(type, userBean.getType())) {
number = null;
textNewsNotice.setVisibility(View.GONE);
}
break;
//互動消息
case "2":
if (TextUtils.equals(type, userBean.getType())) {
number = null;
textNewsInteraction.setVisibility(View.GONE);
}
break;
//在線客服
case "3":
if (TextUtils.equals(type, userBean.getType())) {
number = null;
textNewsOnline.setVisibility(View.GONE);
}
break;
}
//未读消息不为空并且大于0
try {
if (!TextUtils.isEmpty(number) && Integer.parseInt(number) > 0) {
systemNumber = Integer.parseInt(number) + systemNumber;
}
} catch (NumberFormatException e) {
systemNumber = systemNumber + 0;
}
}
type = null;
MessageIMManager.get(mContext).setSystemNumber(systemNumber);
});
}
};
/**
* 添加头部系统消息
*
@ -178,6 +330,29 @@ public class PDLiveConversationListActivity extends AbsActivity {
conversationListFragment.addHeaderView(rootView);
}
@Override
public void onClick(View v) {
ViewClicksAntiShake.clicksAntiShake(v, new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
//清除全部消息
if (v.getId() == R.id.news_icon_clearance) {
DialogUitl.showSimpleDialog(mContext, null, getString(R.string.clear_unread_messages), false, new DialogUitl.SimpleCallback3() {
@Override
public void onConfirmClick(Dialog dialog) {
// IMCenter.getInstance().clearMessagesUnreadStatus();
}
@Override
public void onCancel() {
}
});
}
}
});
}
@Override
protected void onDestroy() {
super.onDestroy();

View File

@ -27,6 +27,7 @@ import com.yunbao.main.utils.PDLiveCustomConversationProvider;
import com.yunbao.main.utils.PDLiveMessageProcessor;
import com.yunbao.main.utils.PDSightMessageItemProvider;
import io.rong.imkit.IMCenter;
import io.rong.imkit.RongIM;
import io.rong.imkit.config.ConversationListBehaviorListener;
import io.rong.imkit.config.RongConfigCenter;
@ -35,7 +36,6 @@ import io.rong.imkit.conversation.messgelist.provider.SightMessageItemProvider;
import io.rong.imkit.conversationlist.model.BaseUiConversation;
import io.rong.imkit.conversationlist.provider.PrivateConversationProvider;
import io.rong.imkit.userinfo.RongUserInfoManager;
import io.rong.imkit.userinfo.UserDataProvider;
import io.rong.imkit.utils.RouteUtils;
import io.rong.imkit.widget.adapter.ProviderManager;
import io.rong.imlib.model.Conversation;
@ -149,6 +149,9 @@ public class ConversationIMListManager {
//使用空白字段存储自己服务器用户的所有的信息
userInfo.setExtra(GsonUtils.toJson(userBean));
RongUserInfoManager.getInstance().refreshUserInfoCache(userInfo);
if (TextUtils.equals(userBean.getIs_admin(), "1")) {
setConversationToTop(userInfo.getUserId());
}
}
}
@ -169,12 +172,12 @@ public class ConversationIMListManager {
private void addUserInfoProvider(String userId, Activity context) {
//获取用户信息
UserInfo userInfo = RongUserInfoManager.getInstance().getUserInfo(userId);
if (null != userInfo){
if (null != userInfo) {
context.runOnUiThread(() -> {
Conversation.ConversationType type = Conversation.ConversationType.PRIVATE;
RouteUtils.routeToConversationActivity(context, type, userId, null);
});
}else {
} else {
CommonHttpUtil.getUserBaseinfo(userId, new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
@ -194,6 +197,9 @@ public class ConversationIMListManager {
userInfo.setExtra(GsonUtils.toJson(userBean));
RongUserInfoManager.getInstance().setUserInfoProvider(s -> {
RongUserInfoManager.getInstance().refreshUserInfoCache(userInfo);
if (TextUtils.equals(userBean.getIs_admin(), "1")) {
setConversationToTop(userInfo.getUserId());
}
return null;
}, true);
@ -208,6 +214,14 @@ public class ConversationIMListManager {
}
/**
* 消息置顶
*/
private void setConversationToTop(String targetId) {
IMCenter.getInstance().setConversationToTop(Conversation.ConversationType.PRIVATE, targetId, true, false, null
);
}
private ConversationListBehaviorListener listener = new ConversationListBehaviorListener() {
@Override
public boolean onConversationPortraitClick(Context context, Conversation.ConversationType conversationType, String targetId) {
@ -234,9 +248,17 @@ public class ConversationIMListManager {
*/
@Override
public boolean onConversationLongClick(Context context, View view, BaseUiConversation baseUiConversation) {
new ConversationPopuwWindow((Activity) context)
.setIsAdmin(baseUiConversation.mCore.getTargetId())
.show(view);
//非指导员都可以点击
UserInfo userInfo = RongUserInfoManager.getInstance().getUserInfo(baseUiConversation.mCore.getTargetId());
if (userInfo != null && !TextUtils.isEmpty(userInfo.getExtra())) {
IMLoginModel model = new Gson().fromJson(userInfo.getExtra(), IMLoginModel.class);
if (!TextUtils.equals(model.getIsAdmin(), "1")) {
new ConversationPopuwWindow((Activity) context)
.setIsAdmin(baseUiConversation.mCore.getTargetId())
.show(view);
}
}
return true;
}
@ -246,7 +268,7 @@ public class ConversationIMListManager {
*/
@Override
public boolean onConversationClick(Context context, View view, BaseUiConversation baseUiConversation) {
ViewClicksAntiShake.clicksAntiShake(view, () -> jumpConversation((Activity) context, baseUiConversation.mCore.getTargetId()));
jumpConversation((Activity) context, baseUiConversation.mCore.getTargetId());
return true;
}
};

View File

@ -17,6 +17,7 @@ import io.rong.imkit.config.RongConfigCenter;
import io.rong.imkit.conversationlist.model.BaseUiConversation;
import io.rong.imkit.conversationlist.provider.BaseConversationProvider;
import io.rong.imkit.userinfo.RongUserInfoManager;
import io.rong.imkit.utils.RongDateUtils;
import io.rong.imkit.widget.adapter.IViewProviderListener;
import io.rong.imkit.widget.adapter.ViewHolder;
import io.rong.imlib.RongIMClient;
@ -24,6 +25,7 @@ import io.rong.imlib.model.Conversation;
import io.rong.imlib.model.Message;
import io.rong.imlib.model.UserInfo;
import io.rong.message.RecallNotificationMessage;
import io.rong.message.TextMessage;
/**
* pdlive自定义会话模板
@ -48,6 +50,36 @@ public class PDLiveCustomConversationProvider extends BaseConversationProvider {
public void bindViewHolder(ViewHolder holder, BaseUiConversation uiConversation, int position, List<BaseUiConversation> list, IViewProviderListener<BaseUiConversation> listener) {
//根据业务需要自定义处理
super.bindViewHolder(holder, uiConversation, position, list, listener);
String targetId = uiConversation.mCore.getTargetId();
UserInfo userInfo = RongUserInfoManager.getInstance().getUserInfo(targetId);
if (userInfo != null && !TextUtils.isEmpty(userInfo.getExtra())) {
IMLoginModel model = new Gson().fromJson(userInfo.getExtra(), IMLoginModel.class);
//指导员对话逻辑
if (model != null && TextUtils.equals(model.getIsAdmin(), "1")) {
holder.setBackgroundRes(R.id.administrator_layout, R.mipmap.img_news_instructor_bg);
holder.setBackgroundRes(R.id.rc_conversation_item, R.mipmap.white_bg);
holder.setVisible(R.id.rc_conversation_portrait_layout, false);
holder.setVisible(R.id.administrator_layout, true);
holder.setImageUri(R.id.img_administrator, userInfo.getPortraitUri());
holder.setText(R.id.conversation_title, userInfo.getName());
if (uiConversation.mCore.getLatestMessage() instanceof TextMessage) {
TextMessage message = (TextMessage) uiConversation.mCore.getLatestMessage();
holder.setText(R.id.rc_conversation_content, message.getContent());
}
if (uiConversation.mCore.getUnreadMessageCount() == 0) {
holder.setVisible(R.id.conversation_unread, false);
} else {
holder.setVisible(R.id.conversation_unread, true);
holder.setText(R.id.conversation_unread_count, String.valueOf(uiConversation.mCore.getUnreadMessageCount()));
}
holder.setText(R.id.conversation_date, RongDateUtils.getConversationListFormatDate(uiConversation.mCore.getSentTime(), holder.getContext()));
} else {
//非指导员按照原有视图展示
holder.setVisible(R.id.rc_conversation_portrait_layout, true);
holder.setVisible(R.id.administrator_layout, false);
}
}
ImageView readReceipt = holder.itemView.findViewById(com.yunbao.live.R.id.rc_conversation_read_receipt);
ImageView conversationUnread = holder.itemView.findViewById(com.yunbao.live.R.id.rc_conversation_unread_bg);
ImageView imgNew = holder.itemView.findViewById(com.yunbao.live.R.id.img_new);
@ -55,8 +87,7 @@ public class PDLiveCustomConversationProvider extends BaseConversationProvider {
Glide.with(holder.getContext()).asDrawable().load(R.mipmap.rc_unread_count_bg_normal).into(conversationUnread);
}
if (imgNew != null) {
String targetId = uiConversation.mCore.getTargetId();
UserInfo userInfo = RongUserInfoManager.getInstance().getUserInfo(targetId);
if (userInfo != null && !TextUtils.isEmpty(userInfo.getExtra())) {
IMLoginModel model = new Gson().fromJson(userInfo.getExtra(), IMLoginModel.class);
if (model != null && TextUtils.equals(model.getIsAdmin(), "1"))

View File

@ -9,20 +9,118 @@
android:orientation="vertical"
android:paddingTop="20dp">
<TextView
android:id="@+id/top_noback"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="18dp"
android:text="@string/message"
android:textColor="#ff161616"
android:textSize="24sp"
android:textStyle="bold" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<!-- <androidx.recyclerview.widget.RecyclerView-->
<!-- android:id="@+id/system_message_list"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="198dp" />-->
<TextView
android:id="@+id/top_noback"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="18dp"
android:text="@string/message"
android:textColor="#ff161616"
android:textSize="24sp"
android:textStyle="bold" />
<ImageView
android:id="@+id/news_icon_clearance"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="end|bottom"
android:layout_marginEnd="16dp"
android:layout_marginBottom="18dp"
android:src="@mipmap/news_icon_clearance" />
</FrameLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="0dp"
android:layout_height="130dp"
android:layout_weight="1">
<ImageView
android:id="@+id/img_news_notice"
android:layout_width="120dp"
android:layout_height="130dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:src="@mipmap/img_news_notice" />
<TextView
android:id="@+id/text_news_notice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_marginTop="20dp"
android:layout_marginEnd="9dp"
android:background="@drawable/background_system_message"
android:text="7"
android:textColor="@color/white"
android:textSize="14sp"
android:visibility="gone" />
</RelativeLayout>
<RelativeLayout
android:layout_width="0dp"
android:layout_height="130dp"
android:layout_weight="1">
<ImageView
android:id="@+id/img_news_interaction"
android:layout_width="120dp"
android:layout_height="130dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:src="@mipmap/img_news_interaction" />
<TextView
android:id="@+id/text_news_interaction"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_marginTop="20dp"
android:layout_marginEnd="9dp"
android:background="@drawable/background_system_message"
android:text="7"
android:textColor="@color/white"
android:textSize="14sp"
android:visibility="gone" />
</RelativeLayout>
<RelativeLayout
android:layout_width="0dp"
android:layout_height="130dp"
android:layout_weight="1">
<ImageView
android:id="@+id/img_news_online"
android:layout_width="120dp"
android:layout_height="130dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:src="@mipmap/img_news_online" />
<TextView
android:id="@+id/text_news_online"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_marginTop="20dp"
android:layout_marginEnd="9dp"
android:background="@drawable/background_system_message"
android:text="7"
android:textColor="@color/white"
android:textSize="14sp"
android:visibility="gone" />
</RelativeLayout>
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
@ -132,10 +230,10 @@
android:id="@+id/v_table_redpoint"
android:layout_width="20dp"
android:layout_height="20dp"
android:background="@drawable/background_ff5075"
android:gravity="center"
android:textColor="@color/white"
android:textSize="10dp"
android:gravity="center"
android:background="@drawable/background_ff5075"
android:visibility="gone" />
</LinearLayout>

Binary file not shown.

After

Width:  |  Height:  |  Size: 235 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB