aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart
diff options
context:
space:
mode:
Diffstat (limited to '')
-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
2 files changed, 23 insertions, 0 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);