This commit is contained in:
18401019693 2022-07-27 13:18:32 +08:00
parent 133e45bc63
commit 838ae0815b
7 changed files with 31 additions and 11 deletions

View File

@ -124,8 +124,7 @@ public class IMLoginManager extends BaseCacheManager {
* 退出登录 * 退出登录
*/ */
public void logout() { public void logout() {
//添加融云连接状态监听
RongcloudIMManager.removeIMStatusListener();
//删除用户登录信息 //删除用户登录信息
deleteByKey(KEY_USER_INFO); deleteByKey(KEY_USER_INFO);
//用户对象置空 //用户对象置空

View File

@ -156,9 +156,6 @@ public class RongcloudIMManager {
RongIM.setConnectionStatusListener(connectionStatusListener); RongIM.setConnectionStatusListener(connectionStatusListener);
} }
public static void removeIMStatusListener() {
RongIM.setConnectionStatusListener(null);
}
/** /**
* 监听 IM 连接状态可根据连接状态进行不同业务处理 * 监听 IM 连接状态可根据连接状态进行不同业务处理

View File

@ -87,10 +87,10 @@
<ImageView <ImageView
android:id="@+id/rc_conversation_unread_bg" android:id="@+id/rc_conversation_unread_bg"
android:layout_width="wrap_content" android:layout_width="20dp"
android:layout_height="wrap_content" android:layout_height="20dp"
android:layout_centerInParent="true" android:layout_centerInParent="true"
app:srcCompat="@mipmap/rc_unread_count_bg_normal" /> app:srcCompat="@drawable/rc_unread_count_bg_normal" />
<TextView <TextView
android:id="@+id/rc_conversation_unread_count" android:id="@+id/rc_conversation_unread_count"

View File

@ -24,11 +24,13 @@ import com.yunbao.main.activity.PDLiveConversationListActivity;
import com.yunbao.main.dialog.ConversationPopuwWindow; import com.yunbao.main.dialog.ConversationPopuwWindow;
import com.yunbao.main.utils.PDLiveCustomConversationProvider; import com.yunbao.main.utils.PDLiveCustomConversationProvider;
import com.yunbao.main.utils.PDLiveMessageProcessor; import com.yunbao.main.utils.PDLiveMessageProcessor;
import com.yunbao.main.utils.PDSightMessageItemProvider;
import io.rong.imkit.RongIM; import io.rong.imkit.RongIM;
import io.rong.imkit.config.ConversationListBehaviorListener; import io.rong.imkit.config.ConversationListBehaviorListener;
import io.rong.imkit.config.RongConfigCenter; import io.rong.imkit.config.RongConfigCenter;
import io.rong.imkit.conversation.extension.RongExtensionManager; import io.rong.imkit.conversation.extension.RongExtensionManager;
import io.rong.imkit.conversation.messgelist.provider.SightMessageItemProvider;
import io.rong.imkit.conversationlist.model.BaseUiConversation; import io.rong.imkit.conversationlist.model.BaseUiConversation;
import io.rong.imkit.conversationlist.provider.PrivateConversationProvider; import io.rong.imkit.conversationlist.provider.PrivateConversationProvider;
import io.rong.imkit.userinfo.RongUserInfoManager; import io.rong.imkit.userinfo.RongUserInfoManager;
@ -59,6 +61,8 @@ public class ConversationIMListManager {
providerManager.replaceProvider(PrivateConversationProvider.class, new PDLiveCustomConversationProvider()); providerManager.replaceProvider(PrivateConversationProvider.class, new PDLiveCustomConversationProvider());
//注册小视频模块 //注册小视频模块
RongExtensionManager.getInstance().registerExtensionModule(new SightExtensionModule()); RongExtensionManager.getInstance().registerExtensionModule(new SightExtensionModule());
//自定义小视频消息模板
RongConfigCenter.conversationConfig().replaceMessageProvider(SightMessageItemProvider.class, new PDSightMessageItemProvider());
//会话列表监听事件 //会话列表监听事件
RongIM.setConversationListBehaviorListener(listener); RongIM.setConversationListBehaviorListener(listener);
} }
@ -138,7 +142,7 @@ public class ConversationIMListManager {
} else { } else {
userNiceName = userBean.getUserNiceName(); userNiceName = userBean.getUserNiceName();
} }
if (!TextUtils.isEmpty(userNiceName)&&!TextUtils.isEmpty(userBean.getAvatar())){ if (!TextUtils.isEmpty(userNiceName) && !TextUtils.isEmpty(userBean.getAvatar())) {
UserInfo userInfo = new UserInfo(userId, userNiceName, Uri.parse(userBean.getAvatar())); UserInfo userInfo = new UserInfo(userId, userNiceName, Uri.parse(userBean.getAvatar()));
//使用空白字段存储自己服务器用户的所有的信息 //使用空白字段存储自己服务器用户的所有的信息
userInfo.setExtra(GsonUtils.toJson(userBean)); userInfo.setExtra(GsonUtils.toJson(userBean));
@ -161,7 +165,7 @@ public class ConversationIMListManager {
//非指导员都可以点击 //非指导员都可以点击
UserInfo userInfo = RongUserInfoManager.getInstance().getUserInfo(targetId); UserInfo userInfo = RongUserInfoManager.getInstance().getUserInfo(targetId);
IMLoginModel model = new Gson().fromJson(userInfo.getExtra(), IMLoginModel.class); IMLoginModel model = new Gson().fromJson(userInfo.getExtra(), IMLoginModel.class);
if (!TextUtils.equals(model.getIsAdmin(),"1")){ if (!TextUtils.equals(model.getIsAdmin(), "1")) {
RouteUtil.forwardUserHome(mContext, targetId, 0); RouteUtil.forwardUserHome(mContext, targetId, 0);
} }

View File

@ -5,6 +5,8 @@ import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.ImageView; import android.widget.ImageView;
import com.bumptech.glide.Glide;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.main.R; import com.yunbao.main.R;
import java.util.List; import java.util.List;
@ -43,6 +45,10 @@ public class PDLiveCustomConversationProvider extends BaseConversationProvider {
//根据业务需要自定义处理 //根据业务需要自定义处理
super.bindViewHolder(holder, uiConversation, position, list, listener); super.bindViewHolder(holder, uiConversation, position, list, listener);
ImageView readReceipt = holder.itemView.findViewById(com.yunbao.live.R.id.rc_conversation_read_receipt); 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);
if (conversationUnread!=null){
Glide.with(holder.getContext()).asDrawable().load(R.mipmap.rc_unread_count_bg_normal).into(conversationUnread);
}
readReceipt.setVisibility(View.VISIBLE); readReceipt.setVisibility(View.VISIBLE);
if (RongConfigCenter.featureConfig().isReadReceiptConversationType(Conversation.ConversationType.PRIVATE) && if (RongConfigCenter.featureConfig().isReadReceiptConversationType(Conversation.ConversationType.PRIVATE) &&

View File

@ -0,0 +1,14 @@
package com.yunbao.main.utils;
import io.rong.imkit.conversation.messgelist.provider.SightMessageItemProvider;
/**
* 自定义小视频消息模板
*/
public class PDSightMessageItemProvider extends SightMessageItemProvider {
public PDSightMessageItemProvider() {
super();
//添加小视频已读回执
mConfig.showReadState = true;
}
}

View File

@ -54,7 +54,7 @@
<TextView <TextView
android:id="@+id/red_point" android:id="@+id/red_point"
android:layout_width="23dp" android:layout_width="20dp"
android:layout_height="20dp" android:layout_height="20dp"
android:layout_below="@id/time" android:layout_below="@id/time"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"