From 9ef1ea283b3d8f56d6a8d0bf5f453cdcb2d6d362 Mon Sep 17 00:00:00 2001 From: Tal Hacohen Date: Wed, 8 Oct 2014 21:52:14 +0300 Subject: [PATCH] Fix notification display order. Messages in notifications were showing in reverse order, that is newest on top instead of newest at the bottom making multiple messages hard to read. Closes #1984 --- .../securesms/notifications/MessageNotifier.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/org/thoughtcrime/securesms/notifications/MessageNotifier.java b/src/org/thoughtcrime/securesms/notifications/MessageNotifier.java index 3f390f381c..9119510fcf 100644 --- a/src/org/thoughtcrime/securesms/notifications/MessageNotifier.java +++ b/src/org/thoughtcrime/securesms/notifications/MessageNotifier.java @@ -53,6 +53,7 @@ import org.whispersystems.textsecure.api.messages.TextSecureEnvelope; import java.io.IOException; import java.util.List; +import java.util.ListIterator; /** * Handles posting system notifications for new messages. @@ -180,7 +181,9 @@ public class MessageNotifier { SpannableStringBuilder content = new SpannableStringBuilder(); - for (NotificationItem item : notifications) { + ListIterator iterator = notifications.listIterator(notifications.size()); + while(iterator.hasPrevious()) { + NotificationItem item = iterator.previous(); content.append(item.getBigStyleSummary()); content.append('\n'); } @@ -224,7 +227,9 @@ public class MessageNotifier { InboxStyle style = new InboxStyle(); - for (NotificationItem item : notifications) { + ListIterator iterator = notifications.listIterator(notifications.size()); + while(iterator.hasPrevious()) { + NotificationItem item = iterator.previous(); style.addLine(item.getTickerText()); }