aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2017-04-13 21:58:05 +0200
committerChristian Schneppe <christian@pix-art.de>2017-04-13 21:58:05 +0200
commit8f771c2eacff5b86ec027853be4745e7d6ea73ea (patch)
tree1ec7239a65e2d1a1710d89b147efd9970c85f757
parent6f32449361d4592f33270835ea64de00bf1a317c (diff)
show first instead of last message in notification preview
-rw-r--r--src/main/java/de/pixart/messenger/services/NotificationService.java12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/main/java/de/pixart/messenger/services/NotificationService.java b/src/main/java/de/pixart/messenger/services/NotificationService.java
index 25b87f761..e7ae8d3a0 100644
--- a/src/main/java/de/pixart/messenger/services/NotificationService.java
+++ b/src/main/java/de/pixart/messenger/services/NotificationService.java
@@ -228,7 +228,9 @@ public class NotificationService {
if (messages != null && messages.size() > 0) {
Message last = messages.get(messages.size() - 1);
if (last.getStatus() != Message.STATUS_RECEIVED) {
- mXmppConnectionService.markRead(last.getConversation(), false);
+ if (mXmppConnectionService.markRead(last.getConversation(), false)) {
+ mXmppConnectionService.updateConversationUi();
+ }
}
}
}
@@ -440,7 +442,7 @@ public class NotificationService {
} else {
if (messages.get(0).getConversation().getMode() == Conversation.MODE_SINGLE) {
builder.setStyle(new NotificationCompat.BigTextStyle().bigText(getMergedBodies(messages)));
- builder.setContentText(UIHelper.getMessagePreview(mXmppConnectionService, messages.get((messages.size() - 1))).first);
+ builder.setContentText(UIHelper.getMessagePreview(mXmppConnectionService, messages.get(0)).first);
} else {
final NotificationCompat.InboxStyle style = new NotificationCompat.InboxStyle();
SpannableString styledString;
@@ -500,11 +502,11 @@ public class NotificationService {
private CharSequence getMergedBodies(final ArrayList<Message> messages) {
final StringBuilder text = new StringBuilder();
- for (int i = 0; i < messages.size(); ++i) {
- text.append(UIHelper.getMessagePreview(mXmppConnectionService, messages.get(i)).first);
- if (i != messages.size() - 1) {
+ for(Message message : messages) {
+ if (text.length() != 0) {
text.append("\n");
}
+ text.append(UIHelper.getMessagePreview(mXmppConnectionService, message).first);
}
return text.toString();
}