From 865980c2be7ce9e63260a0f7aa54d0401f39dc20 Mon Sep 17 00:00:00 2001 From: Sam Bosley Date: Thu, 23 Feb 2012 00:43:17 -0800 Subject: [PATCH] Fixed bugs with hide until default being overriden by quick add --- astrid/src/com/todoroo/astrid/dao/TaskDao.java | 14 +++++++++----- astrid/src/com/todoroo/astrid/ui/QuickAddBar.java | 6 +++++- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/astrid/src/com/todoroo/astrid/dao/TaskDao.java b/astrid/src/com/todoroo/astrid/dao/TaskDao.java index bb64e4699..b242fa886 100644 --- a/astrid/src/com/todoroo/astrid/dao/TaskDao.java +++ b/astrid/src/com/todoroo/astrid/dao/TaskDao.java @@ -206,11 +206,7 @@ public class TaskDao extends DatabaseDao { Task.URGENCY_NONE); item.setValue(Task.DUE_DATE, Task.createDueDate(setting, 0)); } - if(!item.containsValue(Task.HIDE_UNTIL)) { - int setting = Preferences.getIntegerFromString(R.string.p_default_hideUntil_key, - Task.HIDE_UNTIL_NONE); - item.setValue(Task.HIDE_UNTIL, item.createHideUntil(setting, 0)); - } + createDefaultHideUntil(item); setDefaultReminders(item); @@ -223,6 +219,14 @@ public class TaskDao extends DatabaseDao { return result; } + public static void createDefaultHideUntil(Task item) { + if(!item.containsValue(Task.HIDE_UNTIL)) { + int setting = Preferences.getIntegerFromString(R.string.p_default_hideUntil_key, + Task.HIDE_UNTIL_NONE); + item.setValue(Task.HIDE_UNTIL, item.createHideUntil(setting, 0)); + } + } + private void userRetentionMetrics() { if(Preferences.getBoolean(AstridPreferences.P_FIRST_TASK, true)) { StatisticsService.reportEvent(StatisticsConstants.USER_FIRST_TASK); diff --git a/astrid/src/com/todoroo/astrid/ui/QuickAddBar.java b/astrid/src/com/todoroo/astrid/ui/QuickAddBar.java index f6440d9d8..0465fd354 100644 --- a/astrid/src/com/todoroo/astrid/ui/QuickAddBar.java +++ b/astrid/src/com/todoroo/astrid/ui/QuickAddBar.java @@ -35,6 +35,7 @@ import com.todoroo.astrid.activity.TaskEditFragment; import com.todoroo.astrid.activity.TaskListActivity; import com.todoroo.astrid.activity.TaskListFragment; import com.todoroo.astrid.activity.TaskListFragment.OnTaskListItemClickedListener; +import com.todoroo.astrid.dao.TaskDao; import com.todoroo.astrid.data.TagData; import com.todoroo.astrid.data.Task; import com.todoroo.astrid.gcal.GCalControlSet; @@ -274,8 +275,11 @@ public class QuickAddBar extends LinearLayout { if (repeatControl.isRecurrenceSet()) repeatControl.writeToModel(task); - if (deadlineControl.isDeadlineSet()) + if (deadlineControl.isDeadlineSet()) { // Need to redo hide until using defaults in case it was set by some markup magic + task.clearValue(Task.HIDE_UNTIL); deadlineControl.writeToModel(task); + TaskDao.createDefaultHideUntil(task); + } gcalControl.writeToModel(task); peopleControl.setTask(task); peopleControl.saveSharingSettings(null);