aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/de/pixart/messenger/entities/Conversation.java15
-rw-r--r--src/main/java/de/pixart/messenger/ui/adapter/ConversationAdapter.java8
-rw-r--r--src/main/res/drawable/rounded_rectangle_primary.xml16
-rw-r--r--src/main/res/drawable/rounded_rectangle_red.xml (renamed from src/main/res/drawable/rounded_rectangle.xml)2
-rw-r--r--src/main/res/layout/conversation_list_row.xml26
5 files changed, 61 insertions, 6 deletions
diff --git a/src/main/java/de/pixart/messenger/entities/Conversation.java b/src/main/java/de/pixart/messenger/entities/Conversation.java
index 526c60f6c..4a7b45088 100644
--- a/src/main/java/de/pixart/messenger/entities/Conversation.java
+++ b/src/main/java/de/pixart/messenger/entities/Conversation.java
@@ -994,6 +994,21 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
}
}
+ public int failedCount() {
+ synchronized (this.messages) {
+ int count = 0;
+ for (int i = this.messages.size() - 1; i >= 0; --i) {
+ Message message = this.messages.get(i);
+ if ((message.getType() == Message.TYPE_IMAGE || message.getType() == Message.TYPE_FILE) && message.getEncryption() != Message.ENCRYPTION_PGP) {
+ if (message.getStatus() == Message.STATUS_SEND_FAILED){
+ ++count;
+ }
+ }
+ }
+ return count;
+ }
+ }
+
public class Smp {
public static final int STATUS_NONE = 0;
public static final int STATUS_CONTACT_REQUESTED = 1;
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 600ac47eb..3fe3cceae 100644
--- a/src/main/java/de/pixart/messenger/ui/adapter/ConversationAdapter.java
+++ b/src/main/java/de/pixart/messenger/ui/adapter/ConversationAdapter.java
@@ -86,8 +86,10 @@ public class ConversationAdapter extends ArrayAdapter<Conversation> {
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);
+ TextView mFailed = (TextView) view.findViewById(R.id.conversation_failed);
Message message = conversation.getLatestMessage();
int unreadcount = conversation.unreadCount();
+ int failedcount = conversation.failedCount();
String mimeType = message.getMimeType();
if (!conversation.isRead()) {
@@ -137,6 +139,12 @@ public class ConversationAdapter extends ArrayAdapter<Conversation> {
} else {
mUnread.setVisibility(View.GONE);
}
+ if (failedcount > 0) {
+ mFailed.setVisibility(View.VISIBLE);
+ mFailed.setText(String.valueOf(failedcount));
+ } else {
+ mFailed.setVisibility(View.GONE);
+ }
if (preview.second) {
if (conversation.isRead()) {
mLastMessage.setTypeface(null, Typeface.ITALIC);
diff --git a/src/main/res/drawable/rounded_rectangle_primary.xml b/src/main/res/drawable/rounded_rectangle_primary.xml
new file mode 100644
index 000000000..3a32aa8e5
--- /dev/null
+++ b/src/main/res/drawable/rounded_rectangle_primary.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+
+<item>
+ <shape android:shape="rectangle">
+ <padding
+ android:bottom="2dp"
+ android:left="2dp"
+ android:right="2dp"
+ android:top="2dp" />
+ <solid android:color="@color/primary" />
+ <corners android:radius="6dp" />
+ </shape>
+</item>
+
+</layer-list> \ No newline at end of file
diff --git a/src/main/res/drawable/rounded_rectangle.xml b/src/main/res/drawable/rounded_rectangle_red.xml
index fab83eda9..a6cb17d2b 100644
--- a/src/main/res/drawable/rounded_rectangle.xml
+++ b/src/main/res/drawable/rounded_rectangle_red.xml
@@ -8,7 +8,7 @@
android:left="2dp"
android:right="2dp"
android:top="2dp" />
- <solid android:color="@color/primary" />
+ <solid android:color="@color/red800" />
<corners android:radius="6dp" />
</shape>
</item>
diff --git a/src/main/res/layout/conversation_list_row.xml b/src/main/res/layout/conversation_list_row.xml
index 195a14621..16d611ce9 100644
--- a/src/main/res/layout/conversation_list_row.xml
+++ b/src/main/res/layout/conversation_list_row.xml
@@ -46,13 +46,13 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/conversation_lastwrapper"
- android:layout_toLeftOf="@+id/conversation_unread"
android:paddingRight="4dp"
android:singleLine="true"
android:text="Awesome groupchat"
android:textColor="@color/black87"
android:textSize="?attr/TextSizeHeadline"
- android:typeface="sans" />
+ android:typeface="sans"
+ android:layout_toLeftOf="@+id/conversation_failed" />
<RelativeLayout
android:id="@+id/conversation_lastwrapper"
@@ -110,18 +110,34 @@
android:text="100"
android:textColor="@color/grey50"
android:textSize="?attr/TextSizeBody"
- android:background="@drawable/rounded_rectangle"
+ android:background="@drawable/rounded_rectangle_primary"
+ android:visibility="gone"
+ android:paddingLeft="4dp"
+ android:paddingRight="4dp"
+ android:paddingBottom="2dp"
+ android:layout_margin="1dp" />
+ <TextView
+ android:id="@+id/conversation_failed"
+ android:layout_toLeftOf="@+id/conversation_unread"
+ 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/rounded_rectangle_red"
android:visibility="gone"
android:paddingLeft="4dp"
android:paddingRight="4dp"
- android:paddingBottom="2dp" />
+ android:paddingBottom="2dp"
+ android:layout_margin="1dp" />
<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:layout_alignBaseline="@+id/conversation_name"
android:paddingLeft="4dp"
android:gravity="right"
android:text="23:42"