Implements FS#64: Show who wrote last message in conversation overview

This commit is contained in:
steckbrief 2016-02-13 21:18:31 +01:00
parent d84151487e
commit 0af30b4aec

View file

@ -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);