ソースを参照

1、修复消息列表刷新无效问题;

yzs 4 年 前
コミット
9a10fce7cb
共有1 個のファイルを変更した4 個の追加3 個の削除を含む
  1. 4 3
      uchat_im/src/main/java/com/shanp/youqi/im/adapter/MessageListAdapter.java

+ 4 - 3
uchat_im/src/main/java/com/shanp/youqi/im/adapter/MessageListAdapter.java

@@ -99,17 +99,18 @@ public class MessageListAdapter extends BaseQuickAdapter<ConversationListVo, Bas
                 Conversation conversation = vo.getConversation();
                 if (conversation == null) return;
                 TextView tvCount = helper.getView(R.id.tv_item_msg_count);
-                getUnReadCount(conversation.getConversationType(), conversation.getTargetId(), tvCount);
+                getUnReadCount(conversation, tvCount);
             }
         }
     }
 
-    public void getUnReadCount(Conversation.ConversationType type, String id, TextView tvCount) {
+    private void getUnReadCount(Conversation conversation, TextView tvCount) {
         if (!AppManager.get().isConnectRongCloud()) return;
-        RongIMClient.getInstance().getUnreadCount(type, id, new RongIMClient.ResultCallback<Integer>() {
+        RongIMClient.getInstance().getUnreadCount(conversation.getConversationType(), conversation.getTargetId(), new RongIMClient.ResultCallback<Integer>() {
             @Override
             public void onSuccess(Integer count) {
                 if (count != null) {
+                    conversation.setUnreadMessageCount(count);
                     String num;
                     if (count > 99) {
                         num = "99+";