11111
This commit is contained in:
parent
cc35227b56
commit
47030425cd
@ -31,16 +31,18 @@ public class PDLiveMessageListAdapter extends MessageListAdapter {
|
||||
Message.MessageDirection messageDirection = mDataList.get(position).getMessage().getMessageDirection();
|
||||
Message.SentStatus sentStatus = mDataList.get(position).getMessage().getSentStatus();
|
||||
ImageView readReceipt = holder.getConvertView().findViewById(R.id.rc_read_receipt);
|
||||
ImageView readReceiptNew = holder.getConvertView().findViewById(R.id.rc_read_receipt_new);
|
||||
if (readReceipt != null && readReceiptNew != null) {
|
||||
if (readReceipt.getVisibility() == View.VISIBLE) {
|
||||
readReceipt.setVisibility(View.GONE);
|
||||
ImageView readReceiptNew = holder.getConvertView().findViewById(R.id.rc_read_receipt_new);
|
||||
if (!mDataList.get(position).getMessage().getSenderUserId().equals(mDataList.get(position).getTargetId())) {
|
||||
if (sentStatus.equals(Message.SentStatus.READ)) {
|
||||
readReceiptNew.setBackgroundResource(R.mipmap.icon_message_read);
|
||||
} else {
|
||||
if (messageDirection.equals(Message.MessageDirection.SEND) && sentStatus.equals(Message.SentStatus.SENT))
|
||||
readReceiptNew.setBackgroundResource(R.mipmap.icon_message_unread);
|
||||
}
|
||||
} else {
|
||||
readReceipt.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
holder.getConvertView().setOnTouchListener(new View.OnTouchListener() {
|
||||
@Override
|
||||
public boolean onTouch(View v, MotionEvent event) {
|
||||
@ -50,4 +52,5 @@ public class PDLiveMessageListAdapter extends MessageListAdapter {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -26,30 +26,6 @@
|
||||
android:scaleType="centerCrop" />
|
||||
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rc_conversation_unread"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentEnd="true">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/rc_conversation_unread_bg"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
app:srcCompat="@drawable/rc_unread_count_bg_normal" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/rc_conversation_unread_count"
|
||||
style="@style/TextStyle.Alignment"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:text="15"
|
||||
android:textColor="@color/rc_white_color"
|
||||
android:textSize="@dimen/rc_font_auxiliary_size" />
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
<TextView
|
||||
@ -72,9 +48,9 @@
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
android:gravity="center_vertical"
|
||||
app:layout_constraintStart_toEndOf="@+id/rc_conversation_portrait_rl"
|
||||
app:layout_constraintTop_toBottomOf="@+id/rc_conversation_title">
|
||||
|
||||
@ -86,18 +62,51 @@
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginEnd="4dp" />
|
||||
|
||||
<View
|
||||
android:id="@+id/rc_margin"
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="1dp"
|
||||
android:visibility="gone"
|
||||
android:layout_marginStart="15dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/rc_conversation_content"
|
||||
style="@style/TextStyle.Alignment"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="15dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_marginEnd="60dp"
|
||||
android:layout_weight="1"
|
||||
android:ellipsize="end"
|
||||
android:singleLine="true"
|
||||
android:text="你好,朋友!"
|
||||
android:textColor="@color/rc_secondary_color"
|
||||
android:textSize="@dimen/rc_font_text_third_size" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rc_conversation_unread"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="10dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/rc_conversation_unread_bg"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
app:srcCompat="@drawable/rc_unread_count_bg_normal" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/rc_conversation_unread_count"
|
||||
style="@style/TextStyle.Alignment"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:text="15"
|
||||
android:textColor="@color/rc_white_color"
|
||||
android:textSize="@dimen/rc_font_auxiliary_size" />
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
package com.yunbao.main.utils;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
|
||||
@ -34,18 +36,23 @@ public class PDLiveCustomConversationProvider extends BaseConversationProvider {
|
||||
|
||||
@Override
|
||||
public void bindViewHolder(ViewHolder holder, BaseUiConversation uiConversation, int position, List<BaseUiConversation> list, IViewProviderListener<BaseUiConversation> listener) {
|
||||
|
||||
//根据业务需要,自定义处理
|
||||
super.bindViewHolder(holder, uiConversation, position, list, listener);
|
||||
|
||||
if (list.size() > 0) {
|
||||
Message.ReceivedStatus receivedStatus = list.get(position).mCore.getReceivedStatus();
|
||||
Message.SentStatus sentStatus = list.get(position).mCore.getSentStatus();
|
||||
ImageView readReceipt = holder.itemView.findViewById(com.yunbao.live.R.id.rc_read_receipt_new);
|
||||
if (receivedStatus.isRead()) {
|
||||
View rcMargin = holder.itemView.findViewById(com.yunbao.live.R.id.rc_margin);
|
||||
if (TextUtils.equals(list.get(position).mCore.getSenderUserId(), list.get(position).mCore.getTargetId())) {
|
||||
readReceipt.setVisibility(View.GONE);
|
||||
rcMargin.setVisibility(View.VISIBLE);
|
||||
}
|
||||
if (sentStatus == Message.SentStatus.READ) {
|
||||
readReceipt.setBackgroundResource(com.yunbao.live.R.mipmap.icon_messagelist_read);
|
||||
} else {
|
||||
readReceipt.setBackgroundResource(com.yunbao.live.R.mipmap.icon_messagelist_unread);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user