hide message content in notifications in paranoia mode

This commit is contained in:
Daniel Gultsch 2015-12-02 12:54:55 +01:00
parent dc8967d8fc
commit 8455e5b5dd
2 changed files with 34 additions and 20 deletions

View file

@ -234,8 +234,13 @@ public class NotificationService {
if (messages.size() > 0) {
conversation = messages.get(0).getConversation();
final String name = conversation.getName();
if (Config.PARANOID_MODE) {
int count = messages.size();
style.addLine(Html.fromHtml("<b>"+name+"</b> "+mXmppConnectionService.getResources().getQuantityString(R.plurals.x_messages,count,count)));
} else {
style.addLine(Html.fromHtml("<b>" + name + "</b> "
+ UIHelper.getMessagePreview(mXmppConnectionService, messages.get(0)).first));
}
names.append(name);
names.append(", ");
}
@ -264,6 +269,10 @@ public class NotificationService {
mBuilder.setLargeIcon(mXmppConnectionService.getAvatarService()
.get(conversation, getPixel(64)));
mBuilder.setContentTitle(conversation.getName());
if (Config.PARANOID_MODE) {
int count = messages.size();
mBuilder.setContentText(mXmppConnectionService.getResources().getQuantityString(R.plurals.x_messages,count,count));
} else {
Message message;
if ((message = getImage(messages)) != null) {
modifyForImage(mBuilder, message, messages, notify);
@ -284,6 +293,7 @@ public class NotificationService {
mXmppConnectionService.getString(R.string.show_location),
createShowLocationIntent(message));
}
}
mBuilder.setContentIntent(createContentIntent(conversation));
}
return mBuilder;

View file

@ -549,4 +549,8 @@
<string name="not_a_valid_port">This is not a valid port number</string>
<string name="not_valid_hostname">This is not a valid hostname</string>
<string name="connected_accounts">%1$d of %2$d accounts connected</string>
<plurals name="x_messages">
<item quantity="one">%d message</item>
<item quantity="other">%d messages</item>
</plurals>
</resources>