Hide number of unread message counter if there are no new messages

This commit is contained in:
steckbrief 2016-12-28 14:26:15 +01:00
parent 7190f3c540
commit 93c3c723a9

View file

@ -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 {