Fix duplicate alarm bug

pull/795/head
Alex Baker 6 years ago
parent 7020fff332
commit a0a56b4a4b

@ -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;

@ -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() {

Loading…
Cancel
Save