Adds a message sender label in each conversation for text messages
This commit is contained in:
parent
6088913fb6
commit
633aad3193
|
@ -59,8 +59,10 @@ public class ConversationAdapter extends ArrayAdapter<Conversation> {
|
|||
}
|
||||
TextView mLastMessage = (TextView) view.findViewById(R.id.conversation_lastmsg);
|
||||
TextView mTimestamp = (TextView) view.findViewById(R.id.conversation_lastupdate);
|
||||
TextView mSenderName = (TextView) view.findViewById(R.id.sender_name);
|
||||
ImageView imagePreview = (ImageView) view.findViewById(R.id.conversation_lastimage);
|
||||
ImageView notificationStatus = (ImageView) view.findViewById(R.id.notification_status);
|
||||
UnreadCountCustomView unreadCountCustomView = (UnreadCountCustomView) view.findViewById(R.id.unread_count);
|
||||
|
||||
Message message = conversation.getLatestMessage();
|
||||
int unreadCount = conversation.unreadCount();
|
||||
|
@ -81,7 +83,6 @@ public class ConversationAdapter extends ArrayAdapter<Conversation> {
|
|||
Pair<String,Boolean> preview = UIHelper.getMessagePreview(activity,message);
|
||||
mLastMessage.setVisibility(View.VISIBLE);
|
||||
imagePreview.setVisibility(View.GONE);
|
||||
UnreadCountCustomView unreadCountCustomView = (UnreadCountCustomView) view.findViewById(R.id.unread_count);
|
||||
if (unreadCount > 0) {
|
||||
unreadCountCustomView.setVisibility(View.VISIBLE);
|
||||
unreadCountCustomView.setUnreadCount(unreadCount);
|
||||
|
@ -92,16 +93,31 @@ public class ConversationAdapter extends ArrayAdapter<Conversation> {
|
|||
if (preview.second) {
|
||||
if (conversation.isRead()) {
|
||||
mLastMessage.setTypeface(null, Typeface.ITALIC);
|
||||
mSenderName.setTypeface(null, Typeface.NORMAL);
|
||||
} else {
|
||||
mLastMessage.setTypeface(null,Typeface.BOLD_ITALIC);
|
||||
mSenderName.setTypeface(null,Typeface.BOLD);
|
||||
}
|
||||
} else {
|
||||
if (conversation.isRead()) {
|
||||
mLastMessage.setTypeface(null,Typeface.NORMAL);
|
||||
mSenderName.setTypeface(null,Typeface.NORMAL);
|
||||
} else {
|
||||
mLastMessage.setTypeface(null,Typeface.BOLD);
|
||||
mSenderName.setTypeface(null,Typeface.BOLD);
|
||||
}
|
||||
}
|
||||
if (message.getStatus() == Message.STATUS_RECEIVED) {
|
||||
if (conversation.getMode() == Conversation.MODE_MULTI) {
|
||||
mSenderName.setVisibility(View.VISIBLE);
|
||||
mSenderName.setText(UIHelper.getMessageDisplayName(message));
|
||||
} else {
|
||||
mSenderName.setVisibility(View.GONE);
|
||||
}
|
||||
} else {
|
||||
mSenderName.setVisibility(View.VISIBLE);
|
||||
mSenderName.setText(activity.getString(R.string.me));
|
||||
}
|
||||
}
|
||||
|
||||
long muted_till = conversation.getLongAttribute(Conversation.ATTRIBUTE_MUTED_TILL,0);
|
||||
|
|
|
@ -57,11 +57,25 @@
|
|||
android:layout_below="@id/conversation_name"
|
||||
android:layout_marginTop="4dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/sender_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="?attr/IconSize"
|
||||
android:layout_centerVertical="true"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:text="@string/me"
|
||||
android:layout_marginRight="3sp"
|
||||
android:textColor="?attr/color_text_secondary"
|
||||
android:visibility="visible"/>
|
||||
|
||||
<LinearLayout android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:orientation="vertical"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_toRightOf="@id/sender_name"
|
||||
android:layout_alignWithParentIfMissing="true"
|
||||
android:layout_toLeftOf="@+id/notification_status"
|
||||
android:id="@+id/txt_img_wrapper">
|
||||
<TextView
|
||||
|
|
Loading…
Reference in a new issue