show sender name for notications in conferences. fixes #1581
This commit is contained in:
parent
1de74c2337
commit
aea664a0ec
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue