From 98a8970f53cfc11ce0efebda0623da5c858c3bf8 Mon Sep 17 00:00:00 2001 From: Tim Su Date: Fri, 2 Jan 2009 11:33:10 +0000 Subject: [PATCH] Fixed completed task sorting yet again, and fixed a bug with multiple alerts. --- AndroidManifest.xml | 4 ++-- src/com/timsu/astrid/data/task/TaskModelForList.java | 2 +- src/com/timsu/astrid/utilities/Notifications.java | 6 ++++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 302705269..910e20ab5 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="30" + android:versionName="1.9.5"> diff --git a/src/com/timsu/astrid/data/task/TaskModelForList.java b/src/com/timsu/astrid/data/task/TaskModelForList.java index d89347f58..14ef0efea 100644 --- a/src/com/timsu/astrid/data/task/TaskModelForList.java +++ b/src/com/timsu/astrid/data/task/TaskModelForList.java @@ -107,7 +107,7 @@ public class TaskModelForList extends AbstractTaskModel { // bubble completed tasks to the bottom if(isTaskCompleted()) { if(getCompletionDate() == null) - weight += 20000; + weight += 1e6; else weight = (int)Math.max(10000 + (System.currentTimeMillis() - getCompletionDate().getTime()) / 1000, 10000); diff --git a/src/com/timsu/astrid/utilities/Notifications.java b/src/com/timsu/astrid/utilities/Notifications.java index dcf2c27c2..48ed2d7d0 100644 --- a/src/com/timsu/astrid/utilities/Notifications.java +++ b/src/com/timsu/astrid/utilities/Notifications.java @@ -42,6 +42,7 @@ public class Notifications extends BroadcastReceiver { public static final int FLAG_PREFERRED_DEADLINE = 2; public static final int FLAG_OVERDUE = 4; public static final int FLAG_FIXED = 8; + // higher bits are for different alerts private static Random random = new Random(); @@ -154,7 +155,7 @@ public class Notifications extends BroadcastReceiver { 0, FLAG_PREFERRED_DEADLINE | FLAG_OVERDUE, task); } if((task.getNotificationFlags() & TaskModelForList.NOTIFY_AFTER_DEADLINE) > 0) { - scheduleDeadline(context, task.getDefiniteDueDate(), DEADLINE_REPEAT, + scheduleDeadline(context, task.getDefiniteDueDate(), 0, DEADLINE_REPEAT, FLAG_DEFINITE_DEADLINE | FLAG_OVERDUE, task); } @@ -162,6 +163,7 @@ public class Notifications extends BroadcastReceiver { // fixed alerts Cursor cursor = alertController.getTaskAlertsCursor(task.getTaskIdentifier()); Date currentDate = new Date(); + int alertId = 0; while(cursor.getCount() > 0 && !cursor.isLast()) { cursor.moveToNext(); Date alert = new Alert(cursor).getDate(); @@ -169,7 +171,7 @@ public class Notifications extends BroadcastReceiver { continue; scheduleAlarm(context, task.getTaskIdentifier().getId(), - alert.getTime(), FLAG_FIXED); + alert.getTime(), FLAG_FIXED | (alertId++ << 4)); } cursor.close(); }