diff options
author | Christian Schneppe <christian@pix-art.de> | 2016-12-28 00:35:41 +0100 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2016-12-28 00:35:41 +0100 |
commit | ea6591dfec72ffabb2d22713f27e512154bca3c4 (patch) | |
tree | a483a2c13ba25c86ad279b917cb363e77b670dd3 /src/main/java/de/pixart | |
parent | 8a8f31882a13c69218e49dacbfc7cb5266c52b9f (diff) |
show unread messages per conversation in chat list
Diffstat (limited to 'src/main/java/de/pixart')
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/adapter/ConversationAdapter.java | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/adapter/ConversationAdapter.java b/src/main/java/de/pixart/messenger/ui/adapter/ConversationAdapter.java index d78c82cb2..600ac47eb 100644 --- a/src/main/java/de/pixart/messenger/ui/adapter/ConversationAdapter.java +++ b/src/main/java/de/pixart/messenger/ui/adapter/ConversationAdapter.java @@ -85,8 +85,9 @@ 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 mUnread = (TextView) view.findViewById(R.id.conversation_unread); Message message = conversation.getLatestMessage(); + int unreadcount = conversation.unreadCount(); String mimeType = message.getMimeType(); if (!conversation.isRead()) { @@ -130,6 +131,12 @@ public class ConversationAdapter extends ArrayAdapter<Conversation> { mLastMessage.setVisibility(View.VISIBLE); imagePreview.setVisibility(View.GONE); mLastMessage.setText(preview.first); + if (unreadcount > 0) { + mUnread.setVisibility(View.VISIBLE); + mUnread.setText(String.valueOf(unreadcount)); + } else { + mUnread.setVisibility(View.GONE); + } if (preview.second) { if (conversation.isRead()) { mLastMessage.setTypeface(null, Typeface.ITALIC); |