From 2ce3030d29fb50ab3d31b5c93d8d934090391153 Mon Sep 17 00:00:00 2001 From: Sam Bosley Date: Mon, 15 Apr 2013 11:42:21 -0700 Subject: [PATCH] First pass at hide until due time --- api/src/com/todoroo/astrid/data/Task.java | 4 +++- astrid/res/values/strings-core.xml | 1 + .../com/todoroo/astrid/ui/HideUntilControlSet.java | 13 +++++++------ 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/api/src/com/todoroo/astrid/data/Task.java b/api/src/com/todoroo/astrid/data/Task.java index f1fb5cd38..bdab30a7f 100644 --- a/api/src/com/todoroo/astrid/data/Task.java +++ b/api/src/com/todoroo/astrid/data/Task.java @@ -414,6 +414,7 @@ public final class Task extends RemoteModel { public static final int HIDE_UNTIL_WEEK_BEFORE = 3; public static final int HIDE_UNTIL_SPECIFIC_DAY = 4; public static final int HIDE_UNTIL_SPECIFIC_DAY_TIME = 5; + public static final int HIDE_UNTIL_DUE_TIME = 6; /** * Creates due date for this task. If this due date has no time associated, @@ -487,6 +488,7 @@ public final class Task extends RemoteModel { case HIDE_UNTIL_NONE: return 0; case HIDE_UNTIL_DUE: + case HIDE_UNTIL_DUE_TIME: date = getValue(DUE_DATE); break; case HIDE_UNTIL_DAY_BEFORE: @@ -507,7 +509,7 @@ public final class Task extends RemoteModel { return date; Date hideUntil = new Date(date / 1000L * 1000L); // get rid of millis - if(setting != HIDE_UNTIL_SPECIFIC_DAY_TIME) { + if(setting != HIDE_UNTIL_SPECIFIC_DAY_TIME && setting != HIDE_UNTIL_DUE_TIME) { hideUntil.setHours(0); hideUntil.setMinutes(0); hideUntil.setSeconds(0); diff --git a/astrid/res/values/strings-core.xml b/astrid/res/values/strings-core.xml index 45b5bb8ed..18f697e3e 100644 --- a/astrid/res/values/strings-core.xml +++ b/astrid/res/values/strings-core.xml @@ -412,6 +412,7 @@ Never Due date + Due time Day before due Week before due Specific day/time diff --git a/astrid/src/com/todoroo/astrid/ui/HideUntilControlSet.java b/astrid/src/com/todoroo/astrid/ui/HideUntilControlSet.java index f31febb4d..3979ed92c 100644 --- a/astrid/src/com/todoroo/astrid/ui/HideUntilControlSet.java +++ b/astrid/src/com/todoroo/astrid/ui/HideUntilControlSet.java @@ -86,9 +86,10 @@ public class HideUntilControlSet extends PopupControlSet implements OnItemSelect HideUntilValue[] values = new HideUntilValue[labels.length]; values[0] = new HideUntilValue(labels[0], Task.HIDE_UNTIL_NONE); values[1] = new HideUntilValue(labels[1], Task.HIDE_UNTIL_DUE); - values[2] = new HideUntilValue(labels[2], Task.HIDE_UNTIL_DAY_BEFORE); - values[3] = new HideUntilValue(labels[3], Task.HIDE_UNTIL_WEEK_BEFORE); - values[4] = new HideUntilValue(labels[4], Task.HIDE_UNTIL_SPECIFIC_DAY, -1); + values[2] = new HideUntilValue(labels[2], Task.HIDE_UNTIL_DUE_TIME); + values[3] = new HideUntilValue(labels[3], Task.HIDE_UNTIL_DAY_BEFORE); + values[4] = new HideUntilValue(labels[4], Task.HIDE_UNTIL_WEEK_BEFORE); + values[5] = new HideUntilValue(labels[5], Task.HIDE_UNTIL_SPECIFIC_DAY, -1); if(specificDate > 0) { HideUntilValue[] updated = new HideUntilValue[values.length + 1]; @@ -238,13 +239,13 @@ public class HideUntilControlSet extends PopupControlSet implements OnItemSelect selection = 0; date = 0; } else if(date == dueTime) { - selection = 1; + selection = task.hasDueTime() ? 2 : 1; date = 0; } else if(date + DateUtilities.ONE_DAY == dueDay.getTime()) { - selection = 2; + selection = 3; date = 0; } else if(date + DateUtilities.ONE_WEEK == dueDay.getTime()) { - selection = 3; + selection = 4; date = 0; }