aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2015-12-09 10:26:30 +0100
committerDaniel Gultsch <daniel@gultsch.de>2015-12-09 10:26:30 +0100
commitaea664a0eca8c6f4c2c7113563d7bb5201787c61 (patch)
treefa97c073e0f40bd05a3413e8c2aea5f62e098fe7 /src/main/java
parent1de74c2337a97c55180827ea8497f9efca12c24b (diff)
show sender name for notications in conferences. fixes #1581
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/eu/siacs/conversations/services/NotificationService.java17
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 b54e5482..03ab6f63 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