fix #650 notifications alerting multiple times

This commit is contained in:
Conny Duck 2018-06-25 14:08:36 +02:00
commit 3c685800d8
2 changed files with 9 additions and 2 deletions

View file

@ -112,7 +112,7 @@ public class NotificationHelper {
* @param account the account for which the notification should be shown
*/
public static void make(final Context context, Notification body, AccountEntity account) {
public static void make(final Context context, Notification body, AccountEntity account, boolean isFirstOfBatch) {
if (!filterNotification(account, body, context)) {
return;
@ -203,6 +203,11 @@ public class NotificationHelper {
builder.setCategory(NotificationCompat.CATEGORY_SOCIAL);
builder.setOnlyAlertOnce(true);
// only alert for the first notification of a batch to avoid multiple alerts at once
if(!isFirstOfBatch) {
builder.setGroupAlertBehavior(NotificationCompat.GROUP_ALERT_SUMMARY);
}
// Summary
// =======
final NotificationCompat.Builder summaryBuilder = newNotification(context, body, account, true);