diff --git a/astrid/astrid.launch b/astrid/astrid.launch
index 7ce8fc659..f5769e42d 100644
--- a/astrid/astrid.launch
+++ b/astrid/astrid.launch
@@ -4,7 +4,7 @@
-
+
diff --git a/astrid/plugin-src/com/todoroo/astrid/reminders/ReminderService.java b/astrid/plugin-src/com/todoroo/astrid/reminders/ReminderService.java
index 4805611e8..7b84bc79f 100644
--- a/astrid/plugin-src/com/todoroo/astrid/reminders/ReminderService.java
+++ b/astrid/plugin-src/com/todoroo/astrid/reminders/ReminderService.java
@@ -24,7 +24,6 @@ import com.todoroo.andlib.utility.DateUtilities;
import com.todoroo.astrid.dao.TaskDao;
import com.todoroo.astrid.dao.TaskDao.TaskCriteria;
import com.todoroo.astrid.model.Task;
-import com.todoroo.astrid.utility.Constants;
import com.todoroo.astrid.utility.Preferences;
@@ -185,7 +184,7 @@ public final class ReminderService {
long dueDate = task.getValue(Task.DUE_DATE);
if(dueDate > DateUtilities.now())
return NO_ALARM;
- return DateUtilities.now() + (long)((4 + 20 * random.nextFloat()) * DateUtilities.ONE_HOUR);
+ return DateUtilities.now() + (long)((4 + 30 * random.nextFloat()) * DateUtilities.ONE_HOUR);
}
return NO_ALARM;
}
@@ -302,9 +301,8 @@ public final class ReminderService {
PendingIntent pendingIntent = PendingIntent.getBroadcast(context, 0,
intent, 0);
- if(Constants.DEBUG || true)
- Log.e("Astrid", "Alarm (" + task.getId() + ", " + type +
- ") set for " + new Date(time));
+ Log.e("Astrid", "Alarm (" + task.getId() + ", " + type +
+ ") set for " + new Date(time));
am.set(AlarmManager.RTC_WAKEUP, time, pendingIntent);
}
}
diff --git a/astrid/plugin-src/com/todoroo/astrid/rmilk/api/data/RtmTaskNote.java b/astrid/plugin-src/com/todoroo/astrid/rmilk/api/data/RtmTaskNote.java
index 5ad24f260..3e5875789 100644
--- a/astrid/plugin-src/com/todoroo/astrid/rmilk/api/data/RtmTaskNote.java
+++ b/astrid/plugin-src/com/todoroo/astrid/rmilk/api/data/RtmTaskNote.java
@@ -22,6 +22,7 @@ package com.todoroo.astrid.rmilk.api.data;
import java.util.Date;
import org.w3c.dom.Element;
+import org.w3c.dom.EntityReference;
import org.w3c.dom.Text;
import android.util.Log;
@@ -37,13 +38,13 @@ public class RtmTaskNote
extends RtmData
{
- private String id;
+ private final String id;
- private Date created;
+ private final Date created;
- private Date modified;
+ private final Date modified;
- private String title;
+ private final String title;
private String text;
@@ -58,6 +59,10 @@ public class RtmTaskNote
// note element, so get all of the children.
for (int i=0; i < element.getChildNodes().getLength(); i++) {
Object innerNote = element.getChildNodes().item(i);
+
+ if(innerNote instanceof EntityReference) // this node is empty
+ continue;
+
if(!(innerNote instanceof Text)) {
Log.w("rtm-note", "Expected text type, got " + innerNote.getClass());
continue;
diff --git a/astrid/src/com/todoroo/astrid/adapter/TaskAdapter.java b/astrid/src/com/todoroo/astrid/adapter/TaskAdapter.java
index e66a6c5d7..e12635a31 100644
--- a/astrid/src/com/todoroo/astrid/adapter/TaskAdapter.java
+++ b/astrid/src/com/todoroo/astrid/adapter/TaskAdapter.java
@@ -301,9 +301,6 @@ public class TaskAdapter extends CursorAdapter implements Filterable {
task.setValue(Task.COMPLETION_DATE,
completedItems.get(task.getId()) ? DateUtilities.now() : 0);
}
- System.err.println("look it read " + task.getId() + " was " +
- task.isCompleted()
- + ", cache had " + completedItems.get(task.getId()));
completeBox.setChecked(task.isCompleted());
}
diff --git a/astrid/src/com/todoroo/astrid/dao/TaskDao.java b/astrid/src/com/todoroo/astrid/dao/TaskDao.java
index f4c68ec78..c1682428b 100644
--- a/astrid/src/com/todoroo/astrid/dao/TaskDao.java
+++ b/astrid/src/com/todoroo/astrid/dao/TaskDao.java
@@ -146,13 +146,13 @@ public class TaskDao extends GenericDao {
if (task.getId() == Task.NO_ID) {
saveSuccessful = createNew(task);
} else {
- beforeSave(task, values, skipHooks);
saveSuccessful = saveExisting(task);
- afterSave(task, values, skipHooks);
}
- if(saveSuccessful)
+ if(saveSuccessful) {
task.markSaved();
+ afterSave(task, values, skipHooks);
+ }
return saveSuccessful;
}
@@ -183,7 +183,7 @@ public class TaskDao extends GenericDao {
0));
}
if(!item.containsValue(Task.REMINDER_FLAGS)) {
- item.setValue(Task.REMINDER_FLAGS, Task.NOTIFY_AT_DEADLINE);
+ item.setValue(Task.REMINDER_FLAGS, Task.NOTIFY_AT_DEADLINE | Task.NOTIFY_AFTER_DEADLINE);
}
return super.createNew(item);
@@ -195,24 +195,6 @@ public class TaskDao extends GenericDao {
return super.saveExisting(item);
}
- /**
- * Called before the task is saved.
- *
- * - Update notifications based on task status
- *
- Update associated calendar event
- *
- * @param database
- * @param task
- * task that was just changed
- * @param values
- * values that were changed
- * @param duringSync
- * whether this save occurs as part of a sync
- */
- private void beforeSave(Task task, ContentValues values, boolean duringSync) {
- //
- }
-
/**
* Called after the task is saved.
*
@@ -222,16 +204,16 @@ public class TaskDao extends GenericDao {
* @param database
* @param task task that was just changed
* @param values values to be persisted to the database
- * @param duringSync whether this save occurs as part of a sync
+ * @param skipHooks whether this save occurs as part of a sync
*/
- private void afterSave(Task task, ContentValues values, boolean duringSync) {
+ private void afterSave(Task task, ContentValues values, boolean skipHooks) {
if(values.containsKey(Task.COMPLETION_DATE.name) && task.isCompleted())
- afterComplete(task, values, duringSync);
+ afterComplete(task, values, skipHooks);
else {
ReminderService.getInstance().scheduleAlarm(task);
}
- if(duringSync)
+ if(skipHooks)
return;
// TODO due date was updated, update calendar event
diff --git a/tests/src/com/todoroo/astrid/reminders/ReminderServiceTests.java b/tests/src/com/todoroo/astrid/reminders/ReminderServiceTests.java
index 4572fe4a6..3864f308c 100644
--- a/tests/src/com/todoroo/astrid/reminders/ReminderServiceTests.java
+++ b/tests/src/com/todoroo/astrid/reminders/ReminderServiceTests.java
@@ -99,7 +99,7 @@ public class ReminderServiceTests extends DatabaseTestCase {
public void createAlarm(Task task, long time, int type) {
super.createAlarm(task, time, type);
assertTrue(time > DateUtilities.now());
- assertTrue(time < DateUtilities.now() + DateUtilities.ONE_DAY);
+ assertTrue(time < DateUtilities.now() + 2 * DateUtilities.ONE_DAY);
assertEquals(type, ReminderService.TYPE_OVERDUE);
}
});