Show timestamp on summary notification

pull/574/head
Alex Baker 7 years ago
parent 2314c28458
commit 0105d034b6

@ -22,4 +22,7 @@ public interface NotificationDao {
@Query("DELETE FROM notification WHERE task = :taskId")
void delete(long taskId);
@Query("SELECT MAX(timestamp) FROM notification")
long latestTimestamp();
}

@ -139,17 +139,18 @@ public class NotificationManager {
Iterable<Long> notificationIds = transform(appDatabase.notificationDao().getAll(), n -> n.taskId);
Filter notifications = new Filter(context.getString(R.string.notifications),
new QueryTemplate().where(Task.ID.in(notificationIds)));
long when = appDatabase.notificationDao().latestTimestamp();
NotificationCompat.Builder builder = new NotificationCompat.Builder(context, NotificationManager.NOTIFICATION_CHANNEL_DEFAULT)
.setGroupSummary(true)
.setGroup(GROUP_KEY)
.setShowWhen(false)
.setShowWhen(true)
.setWhen(when)
.setSmallIcon(R.drawable.ic_done_all_white_24dp)
.setContentIntent(PendingIntent.getActivity(context, 0, TaskIntents.getTaskListIntent(context, notifications), PendingIntent.FLAG_UPDATE_CURRENT));
if (notify) {
builder.setGroupAlertBehavior(NotificationCompat.GROUP_ALERT_SUMMARY)
.setPriority(NotificationCompat.PRIORITY_HIGH)
.setSound(preferences.getRingtone());
} else {
builder.setOnlyAlertOnce(true)
.setGroupAlertBehavior(NotificationCompat.GROUP_ALERT_CHILDREN);

Loading…
Cancel
Save