aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/de/thedevstack/conversationsplus/ui/adapter/ConversationAdapter.java31
-rw-r--r--src/main/res/layout/conversation_list_row.xml72
2 files changed, 59 insertions, 44 deletions
diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/adapter/ConversationAdapter.java b/src/main/java/de/thedevstack/conversationsplus/ui/adapter/ConversationAdapter.java
index 98a9a96c..97cf0739 100644
--- a/src/main/java/de/thedevstack/conversationsplus/ui/adapter/ConversationAdapter.java
+++ b/src/main/java/de/thedevstack/conversationsplus/ui/adapter/ConversationAdapter.java
@@ -112,20 +112,23 @@ 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 {
+ 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 {
+ lastMessageTypeface = Typeface.BOLD;
+ }
+ }
+ mLastMessage.setTypeface(null, lastMessageTypeface);
+ }
long muted_till = conversation.getLongAttribute(Conversation.ATTRIBUTE_MUTED_TILL,0);
if (muted_till == Long.MAX_VALUE) {
diff --git a/src/main/res/layout/conversation_list_row.xml b/src/main/res/layout/conversation_list_row.xml
index 74e84593..41fd1b90 100644
--- a/src/main/res/layout/conversation_list_row.xml
+++ b/src/main/res/layout/conversation_list_row.xml
@@ -14,7 +14,7 @@
android:layout_height="match_parent"
android:background="@color/red500"/>
- <FrameLayout
+ <FrameLayout
android:id="@+id/swipeable_item"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
@@ -25,8 +25,8 @@
android:layout_height="wrap_content"
android:background="?android:selectableItemBackground"
android:orientation="horizontal"
- android:padding="8dp"
- android:id="@+id/conversationListRowContent">
+ android:padding="4dp"
+ android:id="@+id/conversationListRowContent">
<com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/conversation_image"
@@ -36,21 +36,21 @@
android:scaleType="centerCrop"
app:riv_corner_radius="2dp"/>
- <TextView
- android:layout_width="56dp"
- android:layout_height="4dp"
- android:textAppearance="?android:attr/textAppearanceSmall"
- android:id="@+id/status"
- android:layout_below="@+id/conversation_image"
- android:paddingTop="8dp"
- android:paddingRight="8dp"/>
+ <TextView
+ android:layout_width="56dp"
+ android:layout_height="4dp"
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ android:id="@+id/status"
+ android:layout_below="@+id/conversation_image"
+ android:paddingTop="8dp"
+ android:paddingRight="8dp"/>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toRightOf="@+id/conversation_image"
- android:paddingLeft="8dp">
+ android:paddingLeft="4dp">
<TextView
android:id="@+id/conversation_name"
@@ -73,22 +73,23 @@
android:layout_marginTop="4dp">
<LinearLayout android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_alignParentLeft="true"
- android:layout_centerVertical="true"
- android:layout_toLeftOf="@+id/notification_status"
- android:orientation="vertical">
+ android:layout_height="wrap_content"
+ android:layout_alignParentLeft="true"
+ android:layout_centerVertical="true"
+ android:layout_toLeftOf="@+id/notification_status"
+ android:orientation="vertical"
+ android:id="@+id/conversation_last">
- <github.ankushsachdeva.emojicon.EmojiconTextView
- android:id="@+id/conversation_lastmsg"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:scrollHorizontally="false"
- android:singleLine="true"
+ <github.ankushsachdeva.emojicon.EmojiconTextView
+ android:id="@+id/conversation_lastmsg"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:scrollHorizontally="false"
+ android:singleLine="true"
android:text="This is a placeholder text to show the last messages"
- android:textColor="@color/primaryText"
- android:textSize="?attr/TextSizeBody"
- app:emojiconSize="?attr/EmojiconSizeBody" />
+ android:textColor="@color/primaryText"
+ android:textSize="?attr/TextSizeBody"
+ app:emojiconSize="?attr/EmojiconSizeBody" />
<com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/conversation_lastimage"
@@ -103,11 +104,22 @@
android:id="@+id/notification_status"
android:layout_width="16sp"
android:layout_height="16sp"
- android:layout_alignParentRight="true"
android:layout_centerVertical="true"
- android:layout_marginLeft="4dp"
- android:src="@drawable/ic_notifications_grey600_24dp"
- />
+ android:layout_toLeftOf="@+id/conversation_unreadcount"
+ android:src="@drawable/ic_notifications_grey600_24dp" />
+
+ <TextView
+ android:id="@+id/conversation_unreadcount"
+ android:layout_width="16sp"
+ android:layout_height="16sp"
+ android:layout_centerVertical="true"
+ android:layout_alignParentRight="true"
+ android:gravity="right"
+ android:text="1"
+ android:textColor="@color/secondaryText"
+ android:textSize="?attr/TextSizeInfo"
+ android:textStyle="bold"
+ android:visibility="invisible"/>
</RelativeLayout>
<TextView