Fixed up bugs in reminders that would cause them to go off continually. Version bumped to 3.2.7

pull/14/head 3.2.7
Tim Su 14 years ago
parent e129443c9d
commit 3e57703911

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.timsu.astrid"
android:versionName="3.2.6 (bug fixes and ui improvements)"
android:versionCode="153">
android:versionName="3.2.7 (bug fixes and ui improvements)"
android:versionCode="154">
<!-- widgets, alarms, and services will break if Astrid is installed on SD card -->
<!-- android:installLocation="internalOnly"> -->

@ -136,10 +136,11 @@ public class Notifications extends BroadcastReceiver {
// update last reminder time
task.setValue(Task.REMINDER_LAST, DateUtilities.now());
taskDao.saveExisting(task);
boolean saved = taskDao.saveExisting(task);
// schedule next notification
ReminderService.getInstance().scheduleAlarm(task);
// schedule next notification (unless couldn't save last time)
if(saved)
ReminderService.getInstance().scheduleAlarm(task);
Context context = ContextManager.getContext();
String title = context.getString(R.string.app_name);

@ -199,7 +199,7 @@ public final class ReminderService {
private long calculateNextOverdueReminder(Task task) {
if(task.hasDueDate() && task.getFlag(Task.REMINDER_FLAGS, Task.NOTIFY_AFTER_DEADLINE)) {
long dueDate = task.getValue(Task.DUE_DATE);
long lastReminder = task.getValue(Task.REMINDER_LAST);;
long lastReminder = task.getValue(Task.REMINDER_LAST);
if(dueDate > DateUtilities.now())
return dueDate + (long)((0.5f + 2f * random.nextFloat()) * DateUtilities.ONE_HOUR);
@ -233,18 +233,26 @@ public final class ReminderService {
long dueDate = task.getValue(Task.DUE_DATE);
long lastReminder = task.getValue(Task.REMINDER_LAST);;
if(lastReminder > dueDate)
return NO_ALARM;
else if(task.hasDueTime())
long dueDateAlarm;
if(task.hasDueTime())
// return due date straight up
return dueDate;
dueDateAlarm = dueDate;
else {
// return notification time on this day
Date date = new Date(dueDate);
date.setHours(Preferences.getIntegerFromString(R.string.p_rmd_time, 12));
date.setMinutes(0);
return date.getTime();
dueDateAlarm = date.getTime();
}
if(lastReminder > dueDateAlarm)
return NO_ALARM;
if(dueDate > DateUtilities.now() && dueDateAlarm < DateUtilities.now())
dueDateAlarm = dueDate;
return dueDateAlarm;
}
return NO_ALARM;
}

@ -225,10 +225,14 @@ public class TaskDao extends GenericDao<Task> {
* @param skipHooks whether this save occurs as part of a sync
*/
private void afterSave(Task task, ContentValues values) {
if(values != null && values.containsKey(Task.COMPLETION_DATE.name) && task.isCompleted())
afterComplete(task, values);
else
ReminderService.getInstance().scheduleAlarm(task);
if(values != null) {
if(values.containsKey(Task.COMPLETION_DATE.name) && task.isCompleted())
afterComplete(task, values);
else if(values.containsKey(Task.DUE_DATE.name) ||
values.containsKey(Task.REMINDER_FLAGS.name) ||
values.containsKey(Task.REMINDER_PERIOD.name))
ReminderService.getInstance().scheduleAlarm(task);
}
Astrid2TaskProvider.notifyDatabaseModification();
TasksWidget.updateWidgets(ContextManager.getContext());

@ -16,6 +16,7 @@ import com.todoroo.astrid.dao.Database;
public final class UpgradeService {
private static final int V3_2_6 = 153;
private static final int V3_2_5 = 152;
private static final int V3_2_4 = 151;
private static final int V3_2_3 = 150;
@ -110,8 +111,12 @@ public final class UpgradeService {
"If you liked the old version, you can also go back by " +
"<a href='http://bit.ly/oldastrid'>clicking here</a>",
});
if(from > V3_1_0 && from <= V3_2_6)
newVersionString(changeLog, "3.2.7 (8/25/10)", new String[] {
"Fixed: crazy notifications for overdue tasks! :(",
});
if(from > V3_1_0 && from <= V3_2_5)
newVersionString(changeLog, "3.2.6 (8/24/10)", new String[] {
newVersionString(changeLog, "3.2.7 (8/24/10)", new String[] {
"RTM: fix for login popping up randomly, not syncing priority",
"Sync: added a 'Sync Now!' button to the menu, moved options to Settings",
"Improvements to notification code to remind you of missed notifications",

Loading…
Cancel
Save