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