From 7190f3c5406396bfbb8f128a07d2e74929502043 Mon Sep 17 00:00:00 2001 From: steckbrief Date: Wed, 28 Dec 2016 14:17:58 +0100 Subject: Implement FS#239: Show number of unread messages in conversations overview --- .../ui/adapter/ConversationAdapter.java | 31 ++++++++++++---------- 1 file changed, 17 insertions(+), 14 deletions(-) (limited to 'src/main/java/de') diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/adapter/ConversationAdapter.java b/src/main/java/de/thedevstack/conversationsplus/ui/adapter/ConversationAdapter.java index 98a9a96c..97cf0739 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/adapter/ConversationAdapter.java +++ b/src/main/java/de/thedevstack/conversationsplus/ui/adapter/ConversationAdapter.java @@ -112,20 +112,23 @@ public class ConversationAdapter extends ArrayAdapter { } String lastMessagePreview = ((null == msgPrefix || msgPrefix.isEmpty()) ? "" : (msgPrefix + ": ")) + msgText; mLastMessage.setText(lastMessagePreview); - if (preview.second) { - if (conversation.isRead()) { - mLastMessage.setTypeface(null, Typeface.ITALIC); - } else { - mLastMessage.setTypeface(null,Typeface.BOLD_ITALIC); - } - } else { - if (conversation.isRead()) { - mLastMessage.setTypeface(null,Typeface.NORMAL); - } else { - mLastMessage.setTypeface(null,Typeface.BOLD); - } - } - } + int lastMessageTypeface = Typeface.NORMAL; + if (conversation.isRead()) { + if (preview.second) { + lastMessageTypeface = Typeface.ITALIC; + } + } else { + TextView txtUnreadCount = (TextView) view.findViewById(R.id.conversation_unreadcount); + txtUnreadCount.setVisibility(View.VISIBLE); + txtUnreadCount.setText(String.valueOf(conversation.unreadCount())); + if (preview.second) { + lastMessageTypeface = Typeface.BOLD_ITALIC; + } else { + lastMessageTypeface = Typeface.BOLD; + } + } + mLastMessage.setTypeface(null, lastMessageTypeface); + } long muted_till = conversation.getLongAttribute(Conversation.ATTRIBUTE_MUTED_TILL,0); if (muted_till == Long.MAX_VALUE) { -- cgit v1.2.3