From 07ff5d715b61653536d4b54e9f39ea3c42759aca Mon Sep 17 00:00:00 2001 From: Phillip Hsu Date: Sun, 18 Sep 2016 17:17:01 -0700 Subject: [PATCH] Add one minute to paused Timer via VH and update notification immediately --- .../clock2/timers/TimerNotificationService.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/com/philliphsu/clock2/timers/TimerNotificationService.java b/app/src/main/java/com/philliphsu/clock2/timers/TimerNotificationService.java index 3a75684..107568f 100644 --- a/app/src/main/java/com/philliphsu/clock2/timers/TimerNotificationService.java +++ b/app/src/main/java/com/philliphsu/clock2/timers/TimerNotificationService.java @@ -168,7 +168,7 @@ public class TimerNotificationService extends ChronometerNotificationService { throw new IllegalStateException("Cannot start TimerNotificationService without a Timer"); } final long id = timer.getId(); -// final boolean isUpdate = mTimers.containsKey(id); // could use either map + final boolean isUpdate = mTimers.containsKey(id); // could use either map mTimers.put(id, timer); mControllers.put(id, new TimerController(timer, mUpdateHandler)); @@ -182,12 +182,12 @@ public class TimerNotificationService extends ChronometerNotificationService { title = getString(R.string.timer); } setContentTitle(id, title); - // There was still a delay before the notification got updated, so forget this. -// if (isUpdate) { -// // Immediately push any updates, or else there will be a noticeable delay. -// Log.d(TAG, "Updating notification"); -// updateNotification(id, true); -// } + if (isUpdate) { + // Immediately push any updates, or else there will be a noticeable delay. + // If there were any duration changes, this will reflect them. + setBase(id, timer.endTime()); + updateNotification(id, true); + } syncNotificationWithTimerState(id, timer.isRunning()); }