aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsteckbrief <steckbrief@chefmail.de>2017-01-05 20:17:12 +0100
committersteckbrief <steckbrief@chefmail.de>2017-01-05 20:17:12 +0100
commitc9ae205490bc644e01fb38611406b4f91c4d2f6b (patch)
tree3ca307f2fe81974b97c9710efcb977fa076ab906
parent28676d3048eaf52260101cf6390c12479192e892 (diff)
parent93c3c723a9f7411087125b802badd788484ee6fb (diff)
Merge remote-tracking branch 'origin/trz/rename' into trz/rebase
-rw-r--r--src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java33
-rw-r--r--src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java13
-rw-r--r--src/main/res/layout/conversation_list_row.xml72
-rw-r--r--src/main/res/layout/message_received.xml5
-rw-r--r--src/main/res/layout/message_sent.xml3
5 files changed, 68 insertions, 58 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) {
diff --git a/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java
index d562dd5e..0e0e086f 100644
--- a/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java
+++ b/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java
@@ -76,15 +76,6 @@ public class MessageAdapter extends ArrayAdapter<Message> {
private OnContactPictureClicked mOnContactPictureClickedListener;
private OnContactPictureLongClicked mOnContactPictureLongClickedListener;
- private OnLongClickListener openContextMenu = new OnLongClickListener() {
-
- @Override
- public boolean onLongClick(View v) {
- v.showContextMenu();
- return true;
- }
- };
-
public MessageAdapter(ConversationActivity activity, List<Message> messages) {
super(activity, 0, messages);
this.activity = activity;
@@ -376,7 +367,6 @@ public class MessageAdapter extends ArrayAdapter<Message> {
}
viewHolder.messageBody.setTextColor(this.getMessageTextColor(darkBackground, true));
viewHolder.messageBody.setTypeface(null, Typeface.NORMAL);
- viewHolder.messageBody.setOnLongClickListener(openContextMenu);
}
/**
@@ -454,7 +444,6 @@ public class MessageAdapter extends ArrayAdapter<Message> {
openDownloadable(message);
}
});
- viewHolder.download_button.setOnLongClickListener(openContextMenu);
}
private void displayLocationMessage(ViewHolder viewHolder, final Message message) {
@@ -469,7 +458,6 @@ public class MessageAdapter extends ArrayAdapter<Message> {
showLocation(message);
}
});
- viewHolder.download_button.setOnLongClickListener(openContextMenu);
}
private void displayImageMessage(ViewHolder viewHolder,
@@ -504,7 +492,6 @@ public class MessageAdapter extends ArrayAdapter<Message> {
openDownloadable(message);
}
});
- viewHolder.image.setOnLongClickListener(openContextMenu);
}
private View displayStatusMessage(final Message message, ViewHolder viewHolder) {
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
diff --git a/src/main/res/layout/message_received.xml b/src/main/res/layout/message_received.xml
index d331b3ef..029b0d74 100644
--- a/src/main/res/layout/message_received.xml
+++ b/src/main/res/layout/message_received.xml
@@ -46,7 +46,8 @@
android:layout_marginTop="8dp"
android:layout_marginBottom="4dp"
android:adjustViewBounds="true"
- android:background="@color/black87"
+ android:longClickable="true"
+ android:background="@color/primaryText"
android:scaleType="centerCrop" />
<github.ankushsachdeva.emojicon.EmojiconTextView
@@ -54,6 +55,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:autoLink="web|phone|email"
+ android:longClickable="true"
android:textColor="@color/primaryText"
android:textSize="?attr/TextSizeBody"
app:emojiconSize="?attr/EmojiconSizeBody" />
@@ -61,6 +63,7 @@
<Button
android:id="@+id/download_button"
style="?android:attr/buttonStyleSmall"
+ android:longClickable="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone" />
diff --git a/src/main/res/layout/message_sent.xml b/src/main/res/layout/message_sent.xml
index 30003309..f59c51f3 100644
--- a/src/main/res/layout/message_sent.xml
+++ b/src/main/res/layout/message_sent.xml
@@ -48,6 +48,7 @@
android:layout_marginBottom="4dp"
android:adjustViewBounds="true"
android:background="@color/primaryText"
+ android:longClickable="true"
android:scaleType="centerCrop" />
<github.ankushsachdeva.emojicon.EmojiconTextView
@@ -55,6 +56,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:autoLink="web|phone|email"
+ android:longClickable="true"
android:textColor="@color/primaryText"
android:textSize="?attr/TextSizeBody"
app:emojiconSize="?attr/EmojiconSizeBody"/>
@@ -62,6 +64,7 @@
<Button
android:id="@+id/download_button"
style="?android:attr/buttonStyleSmall"
+ android:longClickable="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone" />