diff --git a/api/src/com/todoroo/andlib/sql/Functions.java b/api/src/com/todoroo/andlib/sql/Functions.java index 13eaa963a..88f6a9d21 100644 --- a/api/src/com/todoroo/andlib/sql/Functions.java +++ b/api/src/com/todoroo/andlib/sql/Functions.java @@ -29,6 +29,10 @@ public final class Functions { return new Field("(strftime('%s','now')*1000)"); } + public static Field fromNow(long millis) { + return new Field("(strftime('%s','now')*1000 + " + millis + ")"); + } + public static Field cast(Field field, String newType) { return new Field("CAST(" + field.toString() + " AS " + newType + ")"); diff --git a/astrid/res/drawable/icn_check_off.png b/astrid/res/drawable/icn_check_off.png new file mode 100644 index 000000000..507563be9 Binary files /dev/null and b/astrid/res/drawable/icn_check_off.png differ diff --git a/astrid/res/drawable/icn_check_on.png b/astrid/res/drawable/icn_check_on.png new file mode 100644 index 000000000..e16354c04 Binary files /dev/null and b/astrid/res/drawable/icn_check_on.png differ diff --git a/astrid/res/values/strings-core.xml b/astrid/res/values/strings-core.xml index 54e921d51..9004b7856 100644 --- a/astrid/res/values/strings-core.xml +++ b/astrid/res/values/strings-core.xml @@ -131,6 +131,15 @@ Astrid reminders are disabled! You will not receive any reminders + + Active + Today + Soon + Late + Done + Hidden + + diff --git a/astrid/src/com/todoroo/astrid/dao/TaskDao.java b/astrid/src/com/todoroo/astrid/dao/TaskDao.java index bb3d398cf..7e877fdfd 100644 --- a/astrid/src/com/todoroo/astrid/dao/TaskDao.java +++ b/astrid/src/com/todoroo/astrid/dao/TaskDao.java @@ -99,11 +99,26 @@ public class TaskDao extends DatabaseDao { Task.DELETION_DATE.eq(0)); } + /** @return tasks that are due within the next 24 hours */ + public static Criterion dueToday() { + return Criterion.and(TaskCriteria.activeAndVisible(), Task.DUE_DATE.gt(0), Task.DUE_DATE.lt(Functions.fromNow(DateUtilities.ONE_DAY))); + } + + /** @return tasks that are due within the next 72 hours */ + public static Criterion dueSoon() { + return Criterion.and(TaskCriteria.activeAndVisible(), Task.DUE_DATE.gt(0), Task.DUE_DATE.lt(Functions.fromNow(3 * DateUtilities.ONE_DAY))); + } + /** @return tasks that are not hidden at current time */ public static Criterion isVisible() { return Task.HIDE_UNTIL.lt(Functions.now()); } + /** @return tasks that are hidden at the current time */ + public static Criterion isHidden() { + return Task.HIDE_UNTIL.gt(Functions.now()); + } + /** @return tasks that have a due date */ public static Criterion hasDeadlines() { return Task.DUE_DATE.neq(0);