hide message content in notifications in paranoia mode
This commit is contained in:
parent
dc8967d8fc
commit
8455e5b5dd
|
@ -234,8 +234,13 @@ public class NotificationService {
|
||||||
if (messages.size() > 0) {
|
if (messages.size() > 0) {
|
||||||
conversation = messages.get(0).getConversation();
|
conversation = messages.get(0).getConversation();
|
||||||
final String name = conversation.getName();
|
final String name = conversation.getName();
|
||||||
style.addLine(Html.fromHtml("<b>" + name + "</b> "
|
if (Config.PARANOID_MODE) {
|
||||||
+ UIHelper.getMessagePreview(mXmppConnectionService, messages.get(0)).first));
|
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(name);
|
||||||
names.append(", ");
|
names.append(", ");
|
||||||
}
|
}
|
||||||
|
@ -264,25 +269,30 @@ public class NotificationService {
|
||||||
mBuilder.setLargeIcon(mXmppConnectionService.getAvatarService()
|
mBuilder.setLargeIcon(mXmppConnectionService.getAvatarService()
|
||||||
.get(conversation, getPixel(64)));
|
.get(conversation, getPixel(64)));
|
||||||
mBuilder.setContentTitle(conversation.getName());
|
mBuilder.setContentTitle(conversation.getName());
|
||||||
Message message;
|
if (Config.PARANOID_MODE) {
|
||||||
if ((message = getImage(messages)) != null) {
|
int count = messages.size();
|
||||||
modifyForImage(mBuilder, message, messages, notify);
|
mBuilder.setContentText(mXmppConnectionService.getResources().getQuantityString(R.plurals.x_messages,count,count));
|
||||||
} else {
|
} else {
|
||||||
modifyForTextOnly(mBuilder, messages, notify);
|
Message message;
|
||||||
}
|
if ((message = getImage(messages)) != null) {
|
||||||
if ((message = getFirstDownloadableMessage(messages)) != null) {
|
modifyForImage(mBuilder, message, messages, notify);
|
||||||
mBuilder.addAction(
|
} else {
|
||||||
Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP ?
|
modifyForTextOnly(mBuilder, messages, notify);
|
||||||
R.drawable.ic_file_download_white_24dp : R.drawable.ic_action_download,
|
}
|
||||||
mXmppConnectionService.getResources().getString(R.string.download_x_file,
|
if ((message = getFirstDownloadableMessage(messages)) != null) {
|
||||||
UIHelper.getFileDescriptionString(mXmppConnectionService, message)),
|
mBuilder.addAction(
|
||||||
createDownloadIntent(message)
|
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,
|
||||||
if ((message = getFirstLocationMessage(messages)) != null) {
|
UIHelper.getFileDescriptionString(mXmppConnectionService, message)),
|
||||||
mBuilder.addAction(R.drawable.ic_room_white_24dp,
|
createDownloadIntent(message)
|
||||||
mXmppConnectionService.getString(R.string.show_location),
|
);
|
||||||
createShowLocationIntent(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));
|
mBuilder.setContentIntent(createContentIntent(conversation));
|
||||||
}
|
}
|
||||||
|
|
|
@ -549,4 +549,8 @@
|
||||||
<string name="not_a_valid_port">This is not a valid port number</string>
|
<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="not_valid_hostname">This is not a valid hostname</string>
|
||||||
<string name="connected_accounts">%1$d of %2$d accounts connected</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>
|
</resources>
|
||||||
|
|
Loading…
Reference in New Issue