Loading src/com/android/deskclock/timer/TimerFragment.java +10 −1 Original line number Diff line number Diff line Loading @@ -333,6 +333,14 @@ public class TimerFragment extends DeskClockFragment implements OnSharedPreferen } private void updateTimerState(TimerObj t, String action) { updateTimerState(t, action, true); } /** * @param update indicates whether to call updateNextTimesup in TimerReceiver. This is false * only for label changes. */ private void updateTimerState(TimerObj t, String action, boolean update) { if (Timers.DELETE_TIMER.equals(action)) { mAdapter.deleteTimer(t.mTimerId); if (mAdapter.getCount() == 0) { Loading @@ -345,6 +353,7 @@ public class TimerFragment extends DeskClockFragment implements OnSharedPreferen final Intent i = new Intent(); i.setAction(action); i.putExtra(Timers.TIMER_INTENT_EXTRA, t.mTimerId); i.putExtra(Timers.UPDATE_NEXT_TIMESUP, update); // Make sure the receiver is getting the intent ASAP. i.addFlags(Intent.FLAG_RECEIVER_FOREGROUND); getActivity().sendBroadcast(i); Loading Loading @@ -708,7 +717,7 @@ public class TimerFragment extends DeskClockFragment implements OnSharedPreferen public void setLabel(TimerObj timer, String label) { timer.mLabel = label; updateTimerState(timer, Timers.TIMER_UPDATE); updateTimerState(timer, Timers.TIMER_UPDATE, false); // Make sure the new label is visible. mAdapter.populateTimersFromPref(); } Loading src/com/android/deskclock/timer/TimerReceiver.java +4 −2 Original line number Diff line number Diff line Loading @@ -196,9 +196,11 @@ public class TimerReceiver extends BroadcastReceiver { showTimesUpNotification(context, t); } } // Update the next "Times up" alarm if (intent.getBooleanExtra(Timers.UPDATE_NEXT_TIMESUP, true)) { // Update the next "Times up" alarm unless explicitly told not to. updateNextTimesup(context); } } private void stopRingtoneIfNoTimesup(final Context context) { if (Timers.findExpiredTimer(mTimers) == null) { Loading src/com/android/deskclock/timer/Timers.java +2 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,8 @@ public class Timers { public static final String TIMER_INTENT_EXTRA = "timer.intent.extra"; public static final String UPDATE_NEXT_TIMESUP = "timer_update_next_timesup"; public static final String NOTIF_IN_USE_SHOW = "notif_in_use_show"; public static final String NOTIF_IN_USE_CANCEL = "notif_in_use_cancel"; public static final String NOTIF_APP_OPEN = "notif_app_open"; Loading Loading
src/com/android/deskclock/timer/TimerFragment.java +10 −1 Original line number Diff line number Diff line Loading @@ -333,6 +333,14 @@ public class TimerFragment extends DeskClockFragment implements OnSharedPreferen } private void updateTimerState(TimerObj t, String action) { updateTimerState(t, action, true); } /** * @param update indicates whether to call updateNextTimesup in TimerReceiver. This is false * only for label changes. */ private void updateTimerState(TimerObj t, String action, boolean update) { if (Timers.DELETE_TIMER.equals(action)) { mAdapter.deleteTimer(t.mTimerId); if (mAdapter.getCount() == 0) { Loading @@ -345,6 +353,7 @@ public class TimerFragment extends DeskClockFragment implements OnSharedPreferen final Intent i = new Intent(); i.setAction(action); i.putExtra(Timers.TIMER_INTENT_EXTRA, t.mTimerId); i.putExtra(Timers.UPDATE_NEXT_TIMESUP, update); // Make sure the receiver is getting the intent ASAP. i.addFlags(Intent.FLAG_RECEIVER_FOREGROUND); getActivity().sendBroadcast(i); Loading Loading @@ -708,7 +717,7 @@ public class TimerFragment extends DeskClockFragment implements OnSharedPreferen public void setLabel(TimerObj timer, String label) { timer.mLabel = label; updateTimerState(timer, Timers.TIMER_UPDATE); updateTimerState(timer, Timers.TIMER_UPDATE, false); // Make sure the new label is visible. mAdapter.populateTimersFromPref(); } Loading
src/com/android/deskclock/timer/TimerReceiver.java +4 −2 Original line number Diff line number Diff line Loading @@ -196,9 +196,11 @@ public class TimerReceiver extends BroadcastReceiver { showTimesUpNotification(context, t); } } // Update the next "Times up" alarm if (intent.getBooleanExtra(Timers.UPDATE_NEXT_TIMESUP, true)) { // Update the next "Times up" alarm unless explicitly told not to. updateNextTimesup(context); } } private void stopRingtoneIfNoTimesup(final Context context) { if (Timers.findExpiredTimer(mTimers) == null) { Loading
src/com/android/deskclock/timer/Timers.java +2 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,8 @@ public class Timers { public static final String TIMER_INTENT_EXTRA = "timer.intent.extra"; public static final String UPDATE_NEXT_TIMESUP = "timer_update_next_timesup"; public static final String NOTIF_IN_USE_SHOW = "notif_in_use_show"; public static final String NOTIF_IN_USE_CANCEL = "notif_in_use_cancel"; public static final String NOTIF_APP_OPEN = "notif_app_open"; Loading