diff --git a/app/tmp/full-r8-config.txt b/app/tmp/full-r8-config.txt index 9986f7a7c..f80ae5cc7 100644 --- a/app/tmp/full-r8-config.txt +++ b/app/tmp/full-r8-config.txt @@ -674,6 +674,8 @@ rx.internal.util.atomic.LinkedQueueNode* consumerNode; -keep class androidx.constraintlayout.widget.ConstraintLayout { (android.content.Context, android.util.AttributeSet); } +-keep class androidx.constraintlayout.widget.Group { (android.content.Context, android.util.AttributeSet); } + -keep class androidx.constraintlayout.widget.Guideline { (android.content.Context, android.util.AttributeSet); } -keep class androidx.coordinatorlayout.widget.CoordinatorLayout { (android.content.Context, android.util.AttributeSet); } diff --git a/common/src/main/java/com/yunbao/common/adapter/MainConversationListAdapter.java b/common/src/main/java/com/yunbao/common/adapter/MainConversationListAdapter.java index 086719b46..57dd4836e 100644 --- a/common/src/main/java/com/yunbao/common/adapter/MainConversationListAdapter.java +++ b/common/src/main/java/com/yunbao/common/adapter/MainConversationListAdapter.java @@ -81,9 +81,7 @@ public class MainConversationListAdapter extends ConversationListAdapter { if (this.mFilter == mFilter) return; this.mFilter = mFilter; -// if (allDataList !=null && !allDataList.isEmpty()){ -// super.setDataCollection(UiConversationCodeUtil.FilterData(mFilter, allDataList)); -// } + } @@ -93,8 +91,11 @@ public class MainConversationListAdapter extends ConversationListAdapter { public void setSrcList(List srcList) { this.srcList = srcList; - super.setDataCollection(UiConversationCodeUtil.FilterData(mFilter, allDataList)); - // notifyDataSetChanged(); + if (mFilter== FILTER_OFFLINE || mFilter == FILTER_ONLINE) { + super.setDataCollection(UiConversationCodeUtil.FilterData(mFilter, allDataList)); + }else { + notifyDataSetChanged(); + } } public void setOnRefreshListener(OnRecyclerListRefreshListener> onRefreshListener) { @@ -190,16 +191,16 @@ public class MainConversationListAdapter extends ConversationListAdapter { Message message = conversation.mCore.getMessage(); - if (message != null && message.getMessageDirection()==Message.MessageDirection.SEND){ - holder.setVisible(R.id.rc_conversation_unread_tv, true); - if (conversation.mCore.getSentStatus() == Message.SentStatus.READ){ - holder.setTextColor(R.id.rc_conversation_unread_tv, ContextCompat.getColor(holder.itemView.getContext(), R.color.rc_secondary_color)); - holder.setText(R.id.rc_conversation_unread_tv, WordUtil.getNewString(R.string.message_chat_msg_read_tip)); - }else { - holder.setTextColor(R.id.rc_conversation_unread_tv, ContextCompat.getColor(holder.itemView.getContext(), R.color.red)); - holder.setText(R.id.rc_conversation_unread_tv, WordUtil.getNewString(R.string.message_chat_msg_unread_tip)); - } - }else { + if (message != null && message.getMessageDirection() == Message.MessageDirection.SEND) { + holder.setVisible(R.id.rc_conversation_unread_tv, true); + if (conversation.mCore.getSentStatus() == Message.SentStatus.READ) { + holder.setTextColor(R.id.rc_conversation_unread_tv, ContextCompat.getColor(holder.itemView.getContext(), R.color.rc_secondary_color)); + holder.setText(R.id.rc_conversation_unread_tv, WordUtil.getNewString(R.string.message_chat_msg_read_tip)); + } else { + holder.setTextColor(R.id.rc_conversation_unread_tv, ContextCompat.getColor(holder.itemView.getContext(), R.color.red)); + holder.setText(R.id.rc_conversation_unread_tv, WordUtil.getNewString(R.string.message_chat_msg_unread_tip)); + } + } else { holder.setVisible(R.id.rc_conversation_unread_tv, false); } @@ -285,7 +286,8 @@ public class MainConversationListAdapter extends ConversationListAdapter { if (data.hashCode() == listHashCode) return; listHashCode = data.hashCode(); List tmp = new ArrayList<>(); - Log.i("聊天数据源", "setDataCollection: " + data.hashCode()); + Log.i("聊天数据源", "size()" + data.size() + " setDataCollection: " + data.hashCode()); + List urls = new ArrayList<>(); if (srcList == null) { srcList = new ArrayList<>(); @@ -327,13 +329,24 @@ public class MainConversationListAdapter extends ConversationListAdapter { } tmp.add(item); } - allDataList = tmp; - if (mFilter != FILTER_OFFLINE || isSearch == true) { - List showData = UiConversationCodeUtil.FilterData(mFilter, tmp); - if (!UiConversationCodeUtil.checkIsSame(showData, mDataList)) { - super.setDataCollection(showData); + List showData = null; + if (isSearch) { + Log.i("聊天数据源", "FilterData isSearch"); + showData = UiConversationCodeUtil.FilterData(mFilter, tmp, allDataList); + } else { + allDataList = tmp; + if (mFilter != FILTER_OFFLINE) + { + Log.i("聊天数据源", "FilterData notSearch"); + showData = UiConversationCodeUtil.FilterData(mFilter, allDataList); } } + if (showData != null && !UiConversationCodeUtil.checkIsSame(showData, mDataList)) { + Log.i("聊天数据源", "数据源有变化" + showData.size()); + super.setDataCollection(showData); + } else { + Log.i("聊天数据源", "数据源无变化"); + } } @@ -346,6 +359,7 @@ public class MainConversationListAdapter extends ConversationListAdapter { private List tmpUids = new ArrayList<>(); public void clear() { + Log.i("聊天数据源", "clear: " + mDataList.size()); mDataList.clear(); if (srcList != null) { srcList.clear(); diff --git a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java index aa7831883..93119834f 100644 --- a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java +++ b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java @@ -1295,7 +1295,7 @@ public interface PDLiveApi { @Query("open_off") int status ); - @GET("/api/public/?service=Pdlmsg.sendBefore") + @GET("/api/public/?service=Pdlmsg.sendBefore&new_pop=1") Observable> getMessageSayHiTimer( ); diff --git a/common/src/main/java/com/yunbao/common/utils/UiConversationCodeUtil.java b/common/src/main/java/com/yunbao/common/utils/UiConversationCodeUtil.java index 31b9244ee..a22e6e12a 100644 --- a/common/src/main/java/com/yunbao/common/utils/UiConversationCodeUtil.java +++ b/common/src/main/java/com/yunbao/common/utils/UiConversationCodeUtil.java @@ -71,6 +71,77 @@ public class UiConversationCodeUtil { } +private static boolean isContains(List list, BaseUiConversation item) { + // 根据 item.mCore.getChannelId() 判断 list 是否包含 + if (list == null || list.isEmpty() || item == null || item.mCore == null) { + return false; + } + for (BaseUiConversation conversation : list) { + // 增加空值检查 + if (conversation != null && conversation.mCore != null + && conversation.mCore.getTargetId() != null + && conversation.mCore.getTargetId().equals(item.mCore.getTargetId())) { + return true; + } + } + return false; +} + + + + public static List FilterData(int filterType, List keyList,List srcList) { + List showData = new ArrayList<>(); + if (keyList == null || keyList.isEmpty()) + return showData; + Log.i("MainConversationListAdapter", "FilterData: 源" + keyList.size()); + switch (filterType) { + case FILTER_ALL: + showData = keyList; + break; + case FILTER_ONLINE: + for (BaseUiConversation conversation : srcList) { + if ("0".equals(conversation.mCore.getDraft()) && isContains(keyList, conversation)) { + showData.add(conversation); + } + } + break; + case FILTER_OFFLINE: + for (BaseUiConversation conversation : keyList) { + if (!"0".equals(conversation.mCore.getDraft())) { + showData.add(conversation); + } + } + break; + case FILTER_READ: + for (BaseUiConversation conversation : keyList) + if (conversation.mCore.getMessage() != null && conversation.mCore.getMessage().getMessageDirection() != null) { + if (conversation.mCore.getMessage().getMessageDirection() == Message.MessageDirection.SEND) { + if (conversation.mCore.getSentStatus() == Message.SentStatus.READ) { + showData.add(conversation); + } + } + } + break; + case FILTER_UNREAD: + for (BaseUiConversation conversation : keyList) { + boolean isRead; + if (conversation.mCore.getMessage() != null && conversation.mCore.getMessage().getMessageDirection() != null) { + if (conversation.mCore.getMessage().getMessageDirection() == Message.MessageDirection.SEND) { + if (conversation.mCore.getSentStatus() != Message.SentStatus.READ) { + showData.add(conversation); + } + } + } + } + break; + } + Log.i("MainConversationListAdapter", "FilterData: 结果" + showData.size()); + return showData; + } + + + + public static List FilterData(int filterType, List data) { List showData = new ArrayList<>(); if (data == null || data.isEmpty()) @@ -106,7 +177,6 @@ public class UiConversationCodeUtil { break; case FILTER_UNREAD: for (BaseUiConversation conversation : data) { - boolean isRead; if (conversation.mCore.getMessage() != null && conversation.mCore.getMessage().getMessageDirection() != null) { if (conversation.mCore.getMessage().getMessageDirection() == Message.MessageDirection.SEND) { if (conversation.mCore.getSentStatus() != Message.SentStatus.READ) { @@ -117,6 +187,7 @@ public class UiConversationCodeUtil { } break; } + Log.i("MainConversationListAdapter", "FilterData: 结果" + showData.size()); return showData; } diff --git a/common/src/main/res/layout/rc_conversationlist_item2.xml b/common/src/main/res/layout/rc_conversationlist_item2.xml index 36d2b5cf9..1d65f5c7f 100644 --- a/common/src/main/res/layout/rc_conversationlist_item2.xml +++ b/common/src/main/res/layout/rc_conversationlist_item2.xml @@ -90,6 +90,10 @@ android:ellipsize="end" android:maxLines="1" tools:text="[已读]" + app:layout_constraintEnd_toStartOf="@id/rc_conversation_content" + android:layout_marginEnd="6dp" + android:visibility="gone" + tools:visibility="visible" android:textColor="@color/rc_secondary_color" android:textSize="13dp" /> @@ -99,7 +103,6 @@ style="@style/TextStyle.Alignment" android:layout_width="0dp" android:layout_height="wrap_content" - android:paddingStart="6dp" android:paddingEnd="6dp" android:ellipsize="end" android:maxLines="1" diff --git a/common/src/main/res/values-zh/strings.xml b/common/src/main/res/values-zh/strings.xml index c1ebbf176..803281b67 100644 --- a/common/src/main/res/values-zh/strings.xml +++ b/common/src/main/res/values-zh/strings.xml @@ -1609,6 +1609,6 @@ 全部聊天 僅展示在線 僅展示離線 - 僅展示對方已讀 - 僅展示對方未讀 + 展示對方已讀 + 展示對方未讀 diff --git a/main/src/main/java/com/yunbao/main/views/MainMessageViewHolder.java b/main/src/main/java/com/yunbao/main/views/MainMessageViewHolder.java index 10a092bb6..75e703b7f 100644 --- a/main/src/main/java/com/yunbao/main/views/MainMessageViewHolder.java +++ b/main/src/main/java/com/yunbao/main/views/MainMessageViewHolder.java @@ -512,7 +512,7 @@ public class MainMessageViewHolder extends AbsMainViewHolder { tabTexts.get(0).setText(WordUtil.getNewString(R.string.message_chat_msg_recommend)); relativeLayouts.get(1).setVisibility(View.VISIBLE); tabTexts.get(1).setText(WordUtil.getNewString(chatViewModel.getTitleTextId())); - // tabExpend.get(1).setVisibility(View.VISIBLE); + tabExpend.get(1).setVisibility(View.VISIBLE); } else { //主播B tabExpend.get(0).setVisibility(View.VISIBLE); relativeLayouts.get(0).setVisibility(View.VISIBLE);