changed string from unread conversation to messages in notification

This commit is contained in:
Daniel Gultsch 2017-03-07 18:12:33 +01:00
parent 5b17734287
commit 8502d519c1

View File

@ -404,8 +404,7 @@ public class NotificationService {
if(messages.get(0).getConversation().getMode() == Conversation.MODE_SINGLE) { if(messages.get(0).getConversation().getMode() == Conversation.MODE_SINGLE) {
builder.setStyle(new NotificationCompat.BigTextStyle().bigText(getMergedBodies(messages))); 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((messages.size() - 1))).first);
} } else {
else {
final NotificationCompat.InboxStyle style = new NotificationCompat.InboxStyle(); final NotificationCompat.InboxStyle style = new NotificationCompat.InboxStyle();
SpannableString styledString; SpannableString styledString;
for (Message message : messages) { for (Message message : messages) {
@ -415,14 +414,14 @@ public class NotificationService {
style.addLine(styledString); style.addLine(styledString);
} }
builder.setStyle(style); builder.setStyle(style);
if(messages.size() == 1) { int count = messages.size();
if(count == 1) {
final String name = UIHelper.getMessageDisplayName(messages.get(0)); final String name = UIHelper.getMessageDisplayName(messages.get(0));
styledString = new SpannableString(name + ": " + messages.get(0).getBody()); styledString = new SpannableString(name + ": " + messages.get(0).getBody());
styledString.setSpan(new StyleSpan(Typeface.BOLD), 0, name.length(), 0); styledString.setSpan(new StyleSpan(Typeface.BOLD), 0, name.length(), 0);
builder.setContentText(styledString); builder.setContentText(styledString);
} } else {
else { builder.setContentText(mXmppConnectionService.getResources().getQuantityString(R.plurals.x_messages,count,count));
builder.setContentText(messages.size() + " " + mXmppConnectionService.getString(R.string.unread_conversations));
} }
} }
} }