Fix '0 tasks' notification

pull/848/head^2
Alex Baker 6 years ago
parent 66c7cd7853
commit 4c7440afe4

@ -128,7 +128,7 @@ public class NotificationManager {
createNotifications(notifications, false, false, false, true);
} else {
createNotifications(notifications, false, false, false, false);
notificationManagerCompat.cancel(SUMMARY_NOTIFICATION_ID);
cancelSummaryNotification();
}
}
@ -138,12 +138,12 @@ public class NotificationManager {
notificationDao.insertAll(newNotifications);
int totalCount = existingNotifications.size() + newNotifications.size();
if (totalCount == 0) {
notificationManagerCompat.cancel(SUMMARY_NOTIFICATION_ID);
cancelSummaryNotification();
} else if (totalCount == 1) {
List<Notification> notifications =
newArrayList(concat(existingNotifications, newNotifications));
createNotifications(notifications, alert, nonstop, fiveTimes, false);
notificationManagerCompat.cancel(SUMMARY_NOTIFICATION_ID);
cancelSummaryNotification();
} else if (preferences.bundleNotifications()) {
updateSummary(false, false, false, Collections.emptyList());
@ -235,6 +235,10 @@ public class NotificationManager {
boolean notify, boolean nonStop, boolean fiveTimes, List<Notification> newNotifications) {
List<Task> tasks = taskDao.activeNotifications();
int taskCount = tasks.size();
if (taskCount == 0) {
cancelSummaryNotification();
return;
}
ArrayList<Long> taskIds = newArrayList(transform(tasks, Task::getId));
Filter filter =
new Filter(
@ -429,4 +433,8 @@ public class NotificationManager {
snoozePendingIntent)
.extend(wearableExtender);
}
private void cancelSummaryNotification() {
notificationManagerCompat.cancel(SUMMARY_NOTIFICATION_ID);
}
}

Loading…
Cancel
Save