diff options
author | Christian Schneppe <christian@pix-art.de> | 2017-03-09 20:09:20 +0100 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2017-03-09 20:09:20 +0100 |
commit | 9cae1f7a6002acfc6b5299c599756093136c70d4 (patch) | |
tree | b219b3597796175e63362d71255f5bbf2ac45263 /src/main/java/de/pixart/messenger/ui | |
parent | 5b41c0da43d7c2f18fd96aa81cd70ffe8f5970f6 (diff) |
Adds a message sender label in each conversation for text messages
Diffstat (limited to 'src/main/java/de/pixart/messenger/ui')
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/adapter/ConversationAdapter.java | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/adapter/ConversationAdapter.java b/src/main/java/de/pixart/messenger/ui/adapter/ConversationAdapter.java index f17b7a2ab..acc2c2eb2 100644 --- a/src/main/java/de/pixart/messenger/ui/adapter/ConversationAdapter.java +++ b/src/main/java/de/pixart/messenger/ui/adapter/ConversationAdapter.java @@ -84,6 +84,7 @@ 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); TextView mUnread = (TextView) view.findViewById(R.id.conversation_unread); @@ -125,16 +126,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); @@ -158,6 +174,7 @@ public class ConversationAdapter extends ArrayAdapter<Conversation> { if (conversation.getIncomingChatState().equals(ChatState.COMPOSING)) { mLastMessage.setText(R.string.is_typing); mLastMessage.setTypeface(null, Typeface.BOLD_ITALIC); + mSenderName.setVisibility(View.GONE); } return view; } |