diff options
author | steckbrief <steckbrief@chefmail.de> | 2016-02-13 21:18:31 +0100 |
---|---|---|
committer | steckbrief <steckbrief@chefmail.de> | 2016-02-13 21:18:31 +0100 |
commit | 0af30b4aec590615631a37362d7edf10af88ffd5 (patch) | |
tree | d66d1d47f0a8eb344957815cdbabdb072b0f7bbe /src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java | |
parent | d84151487eaa5d9741c5a840c41f0247d6335f5e (diff) |
Implements FS#64: Show who wrote last message in conversation overview
Diffstat (limited to '')
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java index 1a619e02..9c3b5430 100644 --- a/src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java +++ b/src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java @@ -110,7 +110,18 @@ public class ConversationAdapter extends ArrayAdapter<Conversation> { Pair<String,Boolean> preview = UIHelper.getMessagePreview(activity,message); mLastMessage.setVisibility(View.VISIBLE); imagePreview.setVisibility(View.GONE); - mLastMessage.setText(preview.first); + CharSequence msgText = preview.first; + String msgPrefix = null; + if (message.getStatus() == Message.STATUS_SEND + || message.getStatus() == Message.STATUS_SEND_DISPLAYED + || message.getStatus() == Message.STATUS_SEND_FAILED + || message.getStatus() == Message.STATUS_SEND_RECEIVED) { + msgPrefix = activity.getString(R.string.cplus_me); + } else if (conversation.getMode() == Conversation.MODE_MULTI) { + msgPrefix = UIHelper.getMessageDisplayName(message); + } + String lastMessagePreview = ((null == msgPrefix || msgPrefix.isEmpty()) ? "" : (msgPrefix + ": ")) + msgText; + mLastMessage.setText(lastMessagePreview); if (preview.second) { if (conversation.isRead()) { mLastMessage.setTypeface(null, Typeface.ITALIC); @@ -140,7 +151,7 @@ public class ConversationAdapter extends ArrayAdapter<Conversation> { notificationStatus.setImageResource(R.drawable.ic_notifications_none_grey600_24dp); } - mTimestamp.setText(UIHelper.readableTimeDifference(activity,conversation.getLatestMessage().getTimeSent())); + mTimestamp.setText(UIHelper.readableTimeDifference(activity, message.getTimeSent())); ImageView profilePicture = (ImageView) view.findViewById(R.id.conversation_image); profilePicture.setOnLongClickListener(new ShowResourcesListDialogListener(activity, conversation.getContact())); loadAvatar(conversation, profilePicture); |