Loading AndroidManifest.xml +1 −0 Original line number Diff line number Diff line Loading @@ -109,6 +109,7 @@ android:theme="@android:style/Theme.NoDisplay"> <intent-filter> <action android:name="android.intent.action.DISMISS_ALARM" /> <action android:name="android.intent.action.DISMISS_TIMER" /> <action android:name="android.intent.action.SHOW_ALARMS" /> <action android:name="android.intent.action.SHOW_TIMERS" /> <action android:name="android.intent.action.SNOOZE_ALARM" /> Loading res/values/strings.xml +5 −3 Original line number Diff line number Diff line Loading @@ -1007,9 +1007,11 @@ --> <string name="timer_created">Timer created</string> <!-- String that represents that the user has successfully reset a timer through a voice action that was marked as deleteAfterUse and was thus deleted instead. [CHAR LIMIT=NONE] <!-- String that represents that the user has successfully dismissed a timer. [CHAR_LIMIT=NONE] --> <string name="timer_dismissed">Timer dismissed</string> <!-- String that represents that the user has successfully deleted a timer. [CHAR LIMIT=NONE] --> <string name="timer_deleted">Timer deleted</string> Loading src/com/android/deskclock/HandleApiCalls.java +12 −5 Original line number Diff line number Diff line Loading @@ -64,8 +64,6 @@ public class HandleApiCalls extends Activity { private static final LogUtils.Logger LOGGER = new LogUtils.Logger("HandleApiCalls"); static final String ACTION_SHOW_TIMERS = "android.intent.action.SHOW_TIMERS"; private Context mAppContext; @Override Loading @@ -83,16 +81,17 @@ public class HandleApiCalls extends Activity { LOGGER.i("onCreate: " + intent); switch (action) { case AlarmClock.ACTION_SET_ALARM: handleSetAlarm(intent); break; case AlarmClock.ACTION_SHOW_ALARMS: handleShowAlarms(intent); handleShowAlarms(); break; case AlarmClock.ACTION_SET_TIMER: handleSetTimer(intent); break; case ACTION_SHOW_TIMERS: case AlarmClock.ACTION_SHOW_TIMERS: handleShowTimers(intent); break; case AlarmClock.ACTION_DISMISS_ALARM: Loading @@ -101,6 +100,9 @@ public class HandleApiCalls extends Activity { case AlarmClock.ACTION_SNOOZE_ALARM: handleSnoozeAlarm(intent); break; case AlarmClock.ACTION_DISMISS_TIMER: handleDismissTimer(); break; } } catch (Exception e) { LOGGER.wtf(e); Loading Loading @@ -383,7 +385,12 @@ public class HandleApiCalls extends Activity { Controller.getController().notifyVoiceSuccess(this, getString(R.string.alarm_is_set, time)); } private void handleShowAlarms(Intent intent) { private void handleDismissTimer() { DataModel.getDataModel().resetOrDeleteExpiredTimers(R.string.label_intent); Controller.getController().notifyVoiceSuccess(this, getString(R.string.timer_dismissed)); } private void handleShowAlarms() { Events.sendAlarmEvent(R.string.action_show, R.string.label_intent); // Open DeskClock positioned on the alarms tab. Loading src/com/android/deskclock/data/DataModel.java +2 −2 Original line number Diff line number Diff line Loading @@ -546,9 +546,9 @@ public final class DataModel { * * @param eventLabelId the label of the timer event to send; 0 if no event should be sent */ public void resetExpiredTimers(@StringRes int eventLabelId) { public void resetOrDeleteExpiredTimers(@StringRes int eventLabelId) { enforceMainLooper(); mTimerModel.resetExpiredTimers(eventLabelId); mTimerModel.resetOrDeleteExpiredTimers(eventLabelId); } /** Loading src/com/android/deskclock/data/TimerModel.java +3 −2 Original line number Diff line number Diff line Loading @@ -340,11 +340,12 @@ final class TimerModel { } /** * Reset all expired timers. * Reset all expired timers. Exactly one parameter should be filled, with preference given to * eventLabelId. * * @param eventLabelId the label of the timer event to send; 0 if no event should be sent */ void resetExpiredTimers(@StringRes int eventLabelId) { void resetOrDeleteExpiredTimers(@StringRes int eventLabelId) { final List<Timer> timers = new ArrayList<>(getTimers()); for (Timer timer : timers) { if (timer.isExpired()) { Loading Loading
AndroidManifest.xml +1 −0 Original line number Diff line number Diff line Loading @@ -109,6 +109,7 @@ android:theme="@android:style/Theme.NoDisplay"> <intent-filter> <action android:name="android.intent.action.DISMISS_ALARM" /> <action android:name="android.intent.action.DISMISS_TIMER" /> <action android:name="android.intent.action.SHOW_ALARMS" /> <action android:name="android.intent.action.SHOW_TIMERS" /> <action android:name="android.intent.action.SNOOZE_ALARM" /> Loading
res/values/strings.xml +5 −3 Original line number Diff line number Diff line Loading @@ -1007,9 +1007,11 @@ --> <string name="timer_created">Timer created</string> <!-- String that represents that the user has successfully reset a timer through a voice action that was marked as deleteAfterUse and was thus deleted instead. [CHAR LIMIT=NONE] <!-- String that represents that the user has successfully dismissed a timer. [CHAR_LIMIT=NONE] --> <string name="timer_dismissed">Timer dismissed</string> <!-- String that represents that the user has successfully deleted a timer. [CHAR LIMIT=NONE] --> <string name="timer_deleted">Timer deleted</string> Loading
src/com/android/deskclock/HandleApiCalls.java +12 −5 Original line number Diff line number Diff line Loading @@ -64,8 +64,6 @@ public class HandleApiCalls extends Activity { private static final LogUtils.Logger LOGGER = new LogUtils.Logger("HandleApiCalls"); static final String ACTION_SHOW_TIMERS = "android.intent.action.SHOW_TIMERS"; private Context mAppContext; @Override Loading @@ -83,16 +81,17 @@ public class HandleApiCalls extends Activity { LOGGER.i("onCreate: " + intent); switch (action) { case AlarmClock.ACTION_SET_ALARM: handleSetAlarm(intent); break; case AlarmClock.ACTION_SHOW_ALARMS: handleShowAlarms(intent); handleShowAlarms(); break; case AlarmClock.ACTION_SET_TIMER: handleSetTimer(intent); break; case ACTION_SHOW_TIMERS: case AlarmClock.ACTION_SHOW_TIMERS: handleShowTimers(intent); break; case AlarmClock.ACTION_DISMISS_ALARM: Loading @@ -101,6 +100,9 @@ public class HandleApiCalls extends Activity { case AlarmClock.ACTION_SNOOZE_ALARM: handleSnoozeAlarm(intent); break; case AlarmClock.ACTION_DISMISS_TIMER: handleDismissTimer(); break; } } catch (Exception e) { LOGGER.wtf(e); Loading Loading @@ -383,7 +385,12 @@ public class HandleApiCalls extends Activity { Controller.getController().notifyVoiceSuccess(this, getString(R.string.alarm_is_set, time)); } private void handleShowAlarms(Intent intent) { private void handleDismissTimer() { DataModel.getDataModel().resetOrDeleteExpiredTimers(R.string.label_intent); Controller.getController().notifyVoiceSuccess(this, getString(R.string.timer_dismissed)); } private void handleShowAlarms() { Events.sendAlarmEvent(R.string.action_show, R.string.label_intent); // Open DeskClock positioned on the alarms tab. Loading
src/com/android/deskclock/data/DataModel.java +2 −2 Original line number Diff line number Diff line Loading @@ -546,9 +546,9 @@ public final class DataModel { * * @param eventLabelId the label of the timer event to send; 0 if no event should be sent */ public void resetExpiredTimers(@StringRes int eventLabelId) { public void resetOrDeleteExpiredTimers(@StringRes int eventLabelId) { enforceMainLooper(); mTimerModel.resetExpiredTimers(eventLabelId); mTimerModel.resetOrDeleteExpiredTimers(eventLabelId); } /** Loading
src/com/android/deskclock/data/TimerModel.java +3 −2 Original line number Diff line number Diff line Loading @@ -340,11 +340,12 @@ final class TimerModel { } /** * Reset all expired timers. * Reset all expired timers. Exactly one parameter should be filled, with preference given to * eventLabelId. * * @param eventLabelId the label of the timer event to send; 0 if no event should be sent */ void resetExpiredTimers(@StringRes int eventLabelId) { void resetOrDeleteExpiredTimers(@StringRes int eventLabelId) { final List<Timer> timers = new ArrayList<>(getTimers()); for (Timer timer : timers) { if (timer.isExpired()) { Loading