diff --git a/app/src/main/java/com/todoroo/astrid/alarms/AlarmService.java b/app/src/main/java/com/todoroo/astrid/alarms/AlarmService.java index 874b70f1c..c50a05f71 100644 --- a/app/src/main/java/com/todoroo/astrid/alarms/AlarmService.java +++ b/app/src/main/java/com/todoroo/astrid/alarms/AlarmService.java @@ -61,14 +61,13 @@ public class AlarmService { boolean changed = false; for (Alarm item : alarmDao.getAlarms(taskId)) { - if (!timestamps.contains(item.getTime())) { + if (!timestamps.remove(item.getTime())) { jobs.cancelAlarm(item.getId()); alarmDao.delete(item); changed = true; } } - // everything that remains shall be written for (Long timestamp : timestamps) { alarmDao.insert(new Alarm(taskId, timestamp)); changed = true; diff --git a/app/src/main/java/com/todoroo/astrid/ui/ReminderControlSet.java b/app/src/main/java/com/todoroo/astrid/ui/ReminderControlSet.java index 587d2bbb0..329c7c6be 100644 --- a/app/src/main/java/com/todoroo/astrid/ui/ReminderControlSet.java +++ b/app/src/main/java/com/todoroo/astrid/ui/ReminderControlSet.java @@ -224,8 +224,9 @@ public class ReminderControlSet extends TaskEditControlFragment { } private void addAlarmRow(final Long timestamp) { - addAlarmRow(getLongDateStringWithTime(context, timestamp), v -> alarms.remove(timestamp)); - alarms.add(timestamp); + if (alarms.add(timestamp)) { + addAlarmRow(getLongDateStringWithTime(context, timestamp), v -> alarms.remove(timestamp)); + } } private int getFlags() {