diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2015-12-09 10:26:30 +0100 |
---|---|---|
committer | Christian S <christian@pix-art.de> | 2015-12-12 15:50:19 +0100 |
commit | 911a8ab9e757947560ac4b4b7f1c35d0fda173fa (patch) | |
tree | 16cd598051a44e012f7b54342c0f8b3b44a42cb8 /src/main/java/eu/siacs/conversations/services/NotificationService.java | |
parent | 00e8d9c4771ad9cfa18d26709d2e7ba6883dd2ad (diff) |
show sender name for notications in conferences. fixes #1581
Diffstat (limited to '')
-rw-r--r-- | src/main/java/eu/siacs/conversations/services/NotificationService.java | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/main/java/eu/siacs/conversations/services/NotificationService.java b/src/main/java/eu/siacs/conversations/services/NotificationService.java index 744ca1506..6d107807c 100644 --- a/src/main/java/eu/siacs/conversations/services/NotificationService.java +++ b/src/main/java/eu/siacs/conversations/services/NotificationService.java @@ -276,6 +276,8 @@ public class NotificationService { Message message; if ((message = getImage(messages)) != null) { modifyForImage(mBuilder, message, messages, notify); + } else if (conversation.getMode() == Conversation.MODE_MULTI) { + modifyForConference(mBuilder, conversation, messages, notify); } else { modifyForTextOnly(mBuilder, messages, notify); } @@ -336,6 +338,21 @@ public class NotificationService { } } + private void modifyForConference(Builder builder, Conversation conversation, List<Message> messages, boolean notify) { + final Message first = messages.get(0); + final Message last = messages.get(messages.size() - 1); + final NotificationCompat.InboxStyle style = new NotificationCompat.InboxStyle(); + style.setBigContentTitle(conversation.getName()); + for(Message message : messages) { + style.addLine(Html.fromHtml("<b>"+UIHelper.getMessageDisplayName(message)+"</b> "+UIHelper.getMessagePreview(mXmppConnectionService,message).first)); + } + builder.setContentText(UIHelper.getMessageDisplayName(first)+ ": " +UIHelper.getMessagePreview(mXmppConnectionService, messages.get(0)).first); + builder.setStyle(style); + if (notify) { + builder.setTicker(UIHelper.getMessageDisplayName(last) + ": " + UIHelper.getMessagePreview(mXmppConnectionService,last).first); + } + } + private Message getImage(final Iterable<Message> messages) { for (final Message message : messages) { if (message.getType() != Message.TYPE_TEXT |