diff options
author | steckbrief <steckbrief@chefmail.de> | 2017-01-05 20:17:12 +0100 |
---|---|---|
committer | steckbrief <steckbrief@chefmail.de> | 2017-01-05 20:17:12 +0100 |
commit | c9ae205490bc644e01fb38611406b4f91c4d2f6b (patch) | |
tree | 3ca307f2fe81974b97c9710efcb977fa076ab906 /src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java | |
parent | 28676d3048eaf52260101cf6390c12479192e892 (diff) | |
parent | 93c3c723a9f7411087125b802badd788484ee6fb (diff) |
Merge remote-tracking branch 'origin/trz/rename' into trz/rebase
Diffstat (limited to 'src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java')
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java index 4ea7d7cf..317dcc78 100644 --- a/src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java +++ b/src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java @@ -69,6 +69,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(); @@ -85,11 +86,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 @@ -113,20 +118,20 @@ public class ConversationAdapter extends ArrayAdapter<Conversation> { } 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 { + 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) { |