diff --git a/app/src/main/java/com/philliphsu/clock2/alarms/AlarmViewHolder.java b/app/src/main/java/com/philliphsu/clock2/alarms/AlarmViewHolder.java index 0832d18..102876e 100644 --- a/app/src/main/java/com/philliphsu/clock2/alarms/AlarmViewHolder.java +++ b/app/src/main/java/com/philliphsu/clock2/alarms/AlarmViewHolder.java @@ -96,7 +96,11 @@ public class AlarmViewHolder extends BaseViewHolder implements AlarmCount @OnClick(R.id.dismiss) void onClick() { - AlarmUtils.cancelAlarm(getContext(), getAlarm()); + Alarm alarm = getAlarm(); + AlarmUtils.cancelAlarm(getContext(), alarm); + if (alarm.isSnoozed()) { + alarm.stopSnoozing(); // TOneverDO: before cancelAlarm() + } bindDismissButton(false, ""); // Will be set to correct text the next time we bind. // TODO: Check if alarm has no recurrence, then turn it off. } diff --git a/app/src/main/java/com/philliphsu/clock2/util/AlarmUtils.java b/app/src/main/java/com/philliphsu/clock2/util/AlarmUtils.java index 035c58a..aabf56e 100644 --- a/app/src/main/java/com/philliphsu/clock2/util/AlarmUtils.java +++ b/app/src/main/java/com/philliphsu/clock2/util/AlarmUtils.java @@ -67,6 +67,9 @@ public final class AlarmUtils { removeUpcomingAlarmNotification(c, a); // If service is not running, nothing happens + // TODO: Since RingtoneService is a bound service, will this destroy the service after returning? + // Note that if a stopped service still has ServiceConnection objects bound to it with the + // BIND_AUTO_CREATE set, it will not be destroyed until all of these bindings are removed. c.stopService(new Intent(c, RingtoneService.class)); }