aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/de/pixart/messenger/services/NotificationService.java22
-rw-r--r--src/main/res/values/strings.xml1
2 files changed, 17 insertions, 6 deletions
diff --git a/src/main/java/de/pixart/messenger/services/NotificationService.java b/src/main/java/de/pixart/messenger/services/NotificationService.java
index c2e62fbd6..9c5f46282 100644
--- a/src/main/java/de/pixart/messenger/services/NotificationService.java
+++ b/src/main/java/de/pixart/messenger/services/NotificationService.java
@@ -159,6 +159,7 @@ public class NotificationService {
}
if (this.mIsInForeground && isScreenOn) {
mXmppConnectionService.vibrate();
+ return;
}
synchronized (notifications) {
pushToStack(message);
@@ -223,20 +224,26 @@ public class NotificationService {
}
final Builder mBuilder;
if (notifications.size() == 1 && Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {
+ Log.d(Config.LOGTAG, "Notification: Received 1 single notification and using device < Android N");
mBuilder = buildSingleConversations(notifications.values().iterator().next());
modifyForSoundVibrationAndLight(mBuilder, notify, preferences);
notificationManager.notify(NOTIFICATION_ID, mBuilder.build());
} else {
+ Log.d(Config.LOGTAG, "Notification: Received multiple notification or using Android N");
mBuilder = buildMultipleConversation();
modifyForSoundVibrationAndLight(mBuilder, notify, preferences);
notificationManager.notify(NOTIFICATION_ID, mBuilder.build());
- for(Map.Entry<String,ArrayList<Message>> entry : notifications.entrySet()) {
- Builder singleBuilder = buildSingleConversations(entry.getValue());
- singleBuilder.setGroup(CONVERSATIONS_GROUP);
- modifyForSoundVibrationAndLight(singleBuilder,notify,preferences);
- notificationManager.notify(entry.getKey(), NOTIFICATION_ID ,singleBuilder.build());
- }
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
+ for (Map.Entry<String, ArrayList<Message>> entry : notifications.entrySet()) {
+ Log.d(Config.LOGTAG, "Notification: Received notification for Android N");
+ Builder singleBuilder = buildSingleConversations(entry.getValue());
+ singleBuilder.setGroup(CONVERSATIONS_GROUP);
+ modifyForSoundVibrationAndLight(singleBuilder, notify, preferences);
+ notificationManager.notify(entry.getKey(), NOTIFICATION_ID, singleBuilder.build());
+ }
+ }
}
+ mBuilder.setNumber(mXmppConnectionService.unreadCount());
}
}
@@ -269,10 +276,13 @@ public class NotificationService {
final Builder mBuilder = new NotificationCompat.Builder(
mXmppConnectionService);
final NotificationCompat.InboxStyle style = new NotificationCompat.InboxStyle();
+ Integer Unread = mXmppConnectionService.unreadCount();
+ String SummaryText = mXmppConnectionService.getString(R.string.unread_messages) + " " + Unread.toString();
style.setBigContentTitle(notifications.size()
+ " "
+ mXmppConnectionService
.getString(R.string.unread_conversations));
+ style.setSummaryText(SummaryText);
final StringBuilder names = new StringBuilder();
Conversation conversation = null;
for (final ArrayList<Message> messages : notifications.values()) {
diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml
index 718dfbc9c..528e91811 100644
--- a/src/main/res/values/strings.xml
+++ b/src/main/res/values/strings.xml
@@ -694,4 +694,5 @@
<string name="preparing_video">Prepare video for transmission</string>
<string name="compressing_video">Compressing video, please wait...</string>
<string name="shared_video_with_x">Shared video with %s</string>
+ <string name="unread_messages">Unread messages:</string>
</resources>