diff --git a/live/src/main/java/com/yunbao/live/activity/PDLIiveChatActivity.java b/live/src/main/java/com/yunbao/live/activity/PDLIiveChatActivity.java index fc92c0311..91808132f 100644 --- a/live/src/main/java/com/yunbao/live/activity/PDLIiveChatActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/PDLIiveChatActivity.java @@ -110,8 +110,8 @@ public class PDLIiveChatActivity extends FragmentActivity { private void initData() { IMLoginManager.get(mContext).checkInstructor(); - //刷新列表内用户信息 - addUserInfoProvider(); +// //刷新列表内用户信息 +// addUserInfoProvider(); //获取一下系统通知 MessageIMManager.get(this).getSystemMessages(); @@ -144,39 +144,39 @@ public class PDLIiveChatActivity extends FragmentActivity { conversationListFragment.addHeaderView(rootView); } - /** - * 刷新用户信息(异步) - */ - public void addUserInfoProvider() { - RongUserInfoManager.getInstance().setUserInfoProvider(userId -> { - CommonHttpUtil.getUserBaseinfo(userId, new HttpCallback() { - @Override - public void onSuccess(int code, String msg, String[] info) { - if (code == 0 && info.length > 0) { - JSONObject obj = JSON.parseObject(info[0]); - SearchUserBean userBean = JSON.toJavaObject(obj, SearchUserBean.class); - String userNiceName = ""; - String remark = InstructorRemarkManager.get(mContext).getInstructorRemark().get(userId); - if (!TextUtils.isEmpty(remark)) { - userNiceName = remark; - } else { - userNiceName = userBean.getUserNiceName(); - } - if (!TextUtils.isEmpty(userNiceName) && !TextUtils.isEmpty(userBean.getAvatar())) { - UserInfo userInfo = new UserInfo(userId, userNiceName, Uri.parse(userBean.getAvatar())); - //使用空白字段存储自己服务器用户的所有的信息 - userInfo.setExtra(GsonUtils.toJson(userBean)); - RongUserInfoManager.getInstance().refreshUserInfoCache(userInfo); - } - } - - } - }); - - return null; - }, true); - - } +// /** +// * 刷新用户信息(异步) +// */ +// public void addUserInfoProvider() { +// RongUserInfoManager.getInstance().setUserInfoProvider(userId -> { +// CommonHttpUtil.getUserBaseinfo(userId, new HttpCallback() { +// @Override +// public void onSuccess(int code, String msg, String[] info) { +// if (code == 0 && info.length > 0) { +// JSONObject obj = JSON.parseObject(info[0]); +// SearchUserBean userBean = JSON.toJavaObject(obj, SearchUserBean.class); +// String userNiceName = ""; +// String remark = InstructorRemarkManager.get(mContext).getInstructorRemark().get(userId); +// if (!TextUtils.isEmpty(remark)) { +// userNiceName = remark; +// } else { +// userNiceName = userBean.getUserNiceName(); +// } +// if (!TextUtils.isEmpty(userNiceName) && !TextUtils.isEmpty(userBean.getAvatar())) { +// UserInfo userInfo = new UserInfo(userId, userNiceName, Uri.parse(userBean.getAvatar())); +// //使用空白字段存储自己服务器用户的所有的信息 +// userInfo.setExtra(GsonUtils.toJson(userBean)); +// RongUserInfoManager.getInstance().refreshUserInfoCache(userInfo); +// } +// } +// +// } +// }); +// +// return null; +// }, true); +// +// } @Override protected void onDestroy() { diff --git a/main/src/main/java/com/yunbao/main/utils/PDLiveCustomConversationProvider.java b/main/src/main/java/com/yunbao/main/utils/PDLiveCustomConversationProvider.java index 587d9a42f..55b227695 100644 --- a/main/src/main/java/com/yunbao/main/utils/PDLiveCustomConversationProvider.java +++ b/main/src/main/java/com/yunbao/main/utils/PDLiveCustomConversationProvider.java @@ -55,12 +55,13 @@ public class PDLiveCustomConversationProvider extends BaseConversationProvider { public void bindViewHolder(ViewHolder holder, BaseUiConversation uiConversation, int position, List list, IViewProviderListener 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())) { + if ((userInfo != null && !TextUtils.isEmpty(userInfo.getExtra()))|| TextUtils.equals(userInfo.getName(), "指导员测试")) { IMLoginModel model = new Gson().fromJson(userInfo.getExtra(), IMLoginModel.class); //指导员对话逻辑 - if (model != null && TextUtils.equals(model.getIsAdmin(), "1")) { + if ((model != null && TextUtils.equals(model.getIsAdmin(), "1")) ) { RelativeLayout conversationItem = holder.getView(R.id.rc_conversation_item); RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) conversationItem.getLayoutParams(); params.height = DpUtil.dp2px(143); @@ -77,10 +78,15 @@ public class PDLiveCustomConversationProvider extends BaseConversationProvider { 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.conversation_content, message.getContent()); + if (TextUtils.isEmpty(uiConversation.mConversationContent)){ + if (uiConversation.mCore.getLatestMessage() instanceof TextMessage) { + TextMessage message = (TextMessage) uiConversation.mCore.getLatestMessage(); + holder.setText(R.id.conversation_content, message.getContent()); + } + }else { + holder.setText(R.id.conversation_content,uiConversation.mConversationContent); } + if (uiConversation.mCore.getUnreadMessageCount() == 0) { holder.setVisible(R.id.conversation_unread, false); } else { @@ -105,15 +111,7 @@ public class PDLiveCustomConversationProvider extends BaseConversationProvider { if (conversationUnread != null) { Glide.with(holder.getContext()).asDrawable().load(R.mipmap.rc_unread_count_bg_normal).into(conversationUnread); } - if (imgNew != null) { - if (userInfo != null && !TextUtils.isEmpty(userInfo.getExtra())) { - IMLoginModel model = new Gson().fromJson(userInfo.getExtra(), IMLoginModel.class); - if (model != null && TextUtils.equals(model.getIsAdmin(), "1")) - Glide.with(holder.getContext()).asDrawable().load("https://downs.yaoulive.com/Instructors.png").into(imgNew); - } - - } readReceipt.setVisibility(View.VISIBLE); if (RongConfigCenter.featureConfig().isReadReceiptConversationType(Conversation.ConversationType.PRIVATE) && uiConversation.mCore.getSenderUserId().equals(RongIMClient.getInstance().getCurrentUserId()) &&