diff options
author | steckbrief <steckbrief@chefmail.de> | 2016-12-28 14:26:15 +0100 |
---|---|---|
committer | steckbrief <steckbrief@chefmail.de> | 2016-12-29 13:12:21 +0100 |
commit | 93c3c723a9f7411087125b802badd788484ee6fb (patch) | |
tree | ce39aaa692943e602ecc95033d0504679fabb633 /src/main | |
parent | 7190f3c5406396bfbb8f128a07d2e74929502043 (diff) |
Hide number of unread message counter if there are no new messages
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/ui/adapter/ConversationAdapter.java | 8 |
1 files changed, 5 insertions, 3 deletions
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 97cf0739..e0e672e3 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/adapter/ConversationAdapter.java +++ b/src/main/java/de/thedevstack/conversationsplus/ui/adapter/ConversationAdapter.java @@ -68,6 +68,7 @@ public class ConversationAdapter extends ArrayAdapter<Conversation> { TextView mTimestamp = (TextView) view.findViewById(R.id.conversation_lastupdate); ImageView imagePreview = (ImageView) view.findViewById(R.id.conversation_lastimage); ImageView notificationStatus = (ImageView) view.findViewById(R.id.notification_status); + TextView txtUnreadCount = (TextView) view.findViewById(R.id.conversation_unreadcount); if (Settings.SHOW_ONLINE_STATUS) { int color = ConversationsPlusColors.offline(); @@ -84,11 +85,15 @@ public class ConversationAdapter extends ArrayAdapter<Conversation> { Message message = conversation.getLatestMessage(); + int txtUnreadCountVisibility = View.INVISIBLE; if (!conversation.isRead()) { convName.setTypeface(null, Typeface.BOLD); + txtUnreadCountVisibility = View.VISIBLE; + txtUnreadCount.setText(String.valueOf(conversation.unreadCount())); } else { convName.setTypeface(null, Typeface.NORMAL); } + txtUnreadCount.setVisibility(txtUnreadCountVisibility); if ((null != message.getFileParams() && message.getFileParams().getWidth() > 0) // TODO: Use FileParams.getMimeType() && (message.getTransferable() == null @@ -118,9 +123,6 @@ public class ConversationAdapter extends ArrayAdapter<Conversation> { 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 { |