From 93c3c723a9f7411087125b802badd788484ee6fb Mon Sep 17 00:00:00 2001 From: steckbrief Date: Wed, 28 Dec 2016 14:26:15 +0100 Subject: Hide number of unread message counter if there are no new messages --- .../conversationsplus/ui/adapter/ConversationAdapter.java | 8 +++++--- 1 file 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 { 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 { 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 { 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 { -- cgit v1.2.3