aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java
diff options
context:
space:
mode:
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.java19
1 files changed, 12 insertions, 7 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,19 +118,19 @@ public class ConversationAdapter extends ArrayAdapter<Conversation> {
}
String lastMessagePreview = ((null == msgPrefix || msgPrefix.isEmpty()) ? "" : (msgPrefix + ": ")) + msgText;
mLastMessage.setText(lastMessagePreview);
- if (preview.second) {
+ int lastMessageTypeface = Typeface.NORMAL;
if (conversation.isRead()) {
- mLastMessage.setTypeface(null, Typeface.ITALIC);
- } else {
- mLastMessage.setTypeface(null,Typeface.BOLD_ITALIC);
+ if (preview.second) {
+ lastMessageTypeface = Typeface.ITALIC;
}
} else {
- if (conversation.isRead()) {
- mLastMessage.setTypeface(null,Typeface.NORMAL);
+ if (preview.second) {
+ lastMessageTypeface = Typeface.BOLD_ITALIC;
} else {
- mLastMessage.setTypeface(null,Typeface.BOLD);
+ lastMessageTypeface = Typeface.BOLD;
}
}
+ mLastMessage.setTypeface(null, lastMessageTypeface);
}
long muted_till = conversation.getLongAttribute(Conversation.ATTRIBUTE_MUTED_TILL,0);