aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2015-12-02 12:54:55 +0100
committerDaniel Gultsch <daniel@gultsch.de>2015-12-02 12:54:55 +0100
commit8455e5b5dd82371d58b2d5e7474779cd6ee5d5f3 (patch)
treeb71ba53d889dab174e5a852a1f5752e96a011ece /src/main/java/eu/siacs
parentdc8967d8fc09a5b7e515bb5005726d677a08c86b (diff)
hide message content in notifications in paranoia mode
Diffstat (limited to 'src/main/java/eu/siacs')
-rw-r--r--src/main/java/eu/siacs/conversations/services/NotificationService.java50
1 files changed, 30 insertions, 20 deletions
diff --git a/src/main/java/eu/siacs/conversations/services/NotificationService.java b/src/main/java/eu/siacs/conversations/services/NotificationService.java
index abd42f4c..b54e5482 100644
--- a/src/main/java/eu/siacs/conversations/services/NotificationService.java
+++ b/src/main/java/eu/siacs/conversations/services/NotificationService.java
@@ -234,8 +234,13 @@ public class NotificationService {
if (messages.size() > 0) {
conversation = messages.get(0).getConversation();
final String name = conversation.getName();
- style.addLine(Html.fromHtml("<b>" + name + "</b> "
- + UIHelper.getMessagePreview(mXmppConnectionService, messages.get(0)).first));
+ 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,25 +269,30 @@ public class NotificationService {
mBuilder.setLargeIcon(mXmppConnectionService.getAvatarService()
.get(conversation, getPixel(64)));
mBuilder.setContentTitle(conversation.getName());
- Message message;
- if ((message = getImage(messages)) != null) {
- modifyForImage(mBuilder, message, messages, notify);
+ if (Config.PARANOID_MODE) {
+ int count = messages.size();
+ mBuilder.setContentText(mXmppConnectionService.getResources().getQuantityString(R.plurals.x_messages,count,count));
} else {
- modifyForTextOnly(mBuilder, messages, notify);
- }
- if ((message = getFirstDownloadableMessage(messages)) != null) {
- mBuilder.addAction(
- Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP ?
- R.drawable.ic_file_download_white_24dp : R.drawable.ic_action_download,
- mXmppConnectionService.getResources().getString(R.string.download_x_file,
- UIHelper.getFileDescriptionString(mXmppConnectionService, message)),
- createDownloadIntent(message)
- );
- }
- if ((message = getFirstLocationMessage(messages)) != null) {
- mBuilder.addAction(R.drawable.ic_room_white_24dp,
- mXmppConnectionService.getString(R.string.show_location),
- createShowLocationIntent(message));
+ Message message;
+ if ((message = getImage(messages)) != null) {
+ modifyForImage(mBuilder, message, messages, notify);
+ } else {
+ modifyForTextOnly(mBuilder, messages, notify);
+ }
+ if ((message = getFirstDownloadableMessage(messages)) != null) {
+ mBuilder.addAction(
+ Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP ?
+ R.drawable.ic_file_download_white_24dp : R.drawable.ic_action_download,
+ mXmppConnectionService.getResources().getString(R.string.download_x_file,
+ UIHelper.getFileDescriptionString(mXmppConnectionService, message)),
+ createDownloadIntent(message)
+ );
+ }
+ if ((message = getFirstLocationMessage(messages)) != null) {
+ mBuilder.addAction(R.drawable.ic_room_white_24dp,
+ mXmppConnectionService.getString(R.string.show_location),
+ createShowLocationIntent(message));
+ }
}
mBuilder.setContentIntent(createContentIntent(conversation));
}