diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/adapter/ConversationAdapter.java | 9 | ||||
-rw-r--r-- | src/main/res/layout/conversation_list_row.xml | 19 |
2 files changed, 26 insertions, 2 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); diff --git a/src/main/res/layout/conversation_list_row.xml b/src/main/res/layout/conversation_list_row.xml index 5a8f0736f..ec4b55363 100644 --- a/src/main/res/layout/conversation_list_row.xml +++ b/src/main/res/layout/conversation_list_row.xml @@ -1,5 +1,6 @@ <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent" android:layout_height="wrap_content" android:descendantFocusability="blocksDescendants"> @@ -46,7 +47,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/conversation_lastwrapper" - android:layout_toLeftOf="@+id/conversation_lastupdate" + android:layout_toLeftOf="@+id/conversation_unread" android:paddingRight="4dp" android:singleLine="true" android:text="Awesome groupchat" @@ -102,11 +103,27 @@ </RelativeLayout> <TextView + android:id="@+id/conversation_unread" + android:layout_toLeftOf="@+id/conversation_lastupdate" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignBaseline="@+id/conversation_name" + android:text="100" + android:textColor="@color/grey50" + android:textSize="?attr/TextSizeBody" + android:background="@drawable/circle" + android:visibility="gone" + android:paddingLeft="4dp" + android:paddingRight="4dp" + android:paddingBottom="2dp" /> + + <TextView android:id="@+id/conversation_lastupdate" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/conversation_name" android:layout_alignParentRight="true" + android:paddingLeft="4dp" android:gravity="right" android:text="23:42" android:textColor="@color/black54" |