僅展示對方已讀 僅展示對方未讀 逻辑进行调整
This commit is contained in:
parent
02387a7321
commit
08480af796
@ -188,23 +188,19 @@ public class MainConversationListAdapter extends ConversationListAdapter {
|
||||
holder.setVisible(R.id.rc_conversation_unread_count, false);
|
||||
}
|
||||
|
||||
boolean isRead = false;
|
||||
Message message = conversation.mCore.getMessage();
|
||||
if (message != null) {
|
||||
Message.MessageDirection direction = message.getMessageDirection();
|
||||
if (direction != null && direction == Message.MessageDirection.SEND) {
|
||||
isRead = (conversation.mCore.getSentStatus() == Message.SentStatus.READ);
|
||||
} else {
|
||||
isRead = conversation.mCore.getReceivedStatus().isRead();
|
||||
}
|
||||
}
|
||||
|
||||
if (isRead) {
|
||||
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));
|
||||
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 {
|
||||
holder.setVisible(R.id.rc_conversation_unread_tv, false);
|
||||
}
|
||||
|
||||
|
||||
|
@ -95,19 +95,13 @@ public class UiConversationCodeUtil {
|
||||
}
|
||||
break;
|
||||
case FILTER_READ:
|
||||
for (BaseUiConversation conversation : data) {
|
||||
boolean isRead;
|
||||
for (BaseUiConversation conversation : data)
|
||||
if (conversation.mCore.getMessage() != null && conversation.mCore.getMessage().getMessageDirection() != null) {
|
||||
if (conversation.mCore.getMessage().getMessageDirection() == Message.MessageDirection.SEND) {
|
||||
isRead = (conversation.mCore.getSentStatus() == Message.SentStatus.READ);
|
||||
} else {
|
||||
isRead = conversation.mCore.getReceivedStatus().isRead();
|
||||
if (conversation.mCore.getSentStatus() == Message.SentStatus.READ) {
|
||||
showData.add(conversation);
|
||||
}
|
||||
}
|
||||
if (isRead) {
|
||||
showData.add(conversation);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
case FILTER_UNREAD:
|
||||
@ -115,12 +109,9 @@ public class UiConversationCodeUtil {
|
||||
boolean isRead;
|
||||
if (conversation.mCore.getMessage() != null && conversation.mCore.getMessage().getMessageDirection() != null) {
|
||||
if (conversation.mCore.getMessage().getMessageDirection() == Message.MessageDirection.SEND) {
|
||||
isRead = (conversation.mCore.getSentStatus() == Message.SentStatus.READ);
|
||||
} else {
|
||||
isRead = conversation.mCore.getReceivedStatus().isRead();
|
||||
}
|
||||
if (!isRead) {
|
||||
showData.add(conversation);
|
||||
if (conversation.mCore.getSentStatus() != Message.SentStatus.READ) {
|
||||
showData.add(conversation);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -84,8 +84,8 @@
|
||||
android:id="@+id/rc_conversation_unread_tv"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_marginBottom="4dp"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/rc_conversation_portrait"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintStart_toStartOf="@+id/rc_conversation_title"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
@ -105,17 +105,17 @@
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/rc_secondary_color"
|
||||
android:textSize="13dp"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/rc_conversation_unread_tv"
|
||||
app:layout_constraintEnd_toStartOf="@+id/rc_conversation_read_receipt"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toEndOf="@+id/rc_conversation_unread_tv"
|
||||
app:layout_constraintTop_toTopOf="@+id/rc_conversation_unread_tv"
|
||||
android:layout_marginBottom="4dp"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/rc_conversation_portrait"
|
||||
tools:text="你好,朋友!111111111111111111111" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/rc_conversation_unread_count"
|
||||
app:layout_constraintTop_toTopOf="@+id/rc_conversation_unread_tv"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/rc_conversation_unread_tv"
|
||||
app:layout_constraintTop_toTopOf="@+id/rc_conversation_content"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/rc_conversation_content"
|
||||
app:layout_constraintEnd_toEndOf="@+id/rc_conversation_date"
|
||||
style="@style/TextStyle.Alignment"
|
||||
app:layout_constraintDimensionRatio="1"
|
||||
|
@ -1609,6 +1609,6 @@
|
||||
<string name="all_chats">全部聊天</string>
|
||||
<string name="online_only">僅展示在線</string>
|
||||
<string name="offline_only">僅展示離線</string>
|
||||
<string name="read_only">僅展示已讀</string>
|
||||
<string name="unread_only">僅展示未讀</string>
|
||||
<string name="read_only">僅展示對方已讀</string>
|
||||
<string name="unread_only">僅展示對方未讀</string>
|
||||
</resources>
|
||||
|
Loading…
Reference in New Issue
Block a user