Fixed bugs with hide until default being overriden by quick add

pull/14/head
Sam Bosley 13 years ago
parent ba4a28723c
commit 865980c2be

@ -206,11 +206,7 @@ public class TaskDao extends DatabaseDao<Task> {
Task.URGENCY_NONE); Task.URGENCY_NONE);
item.setValue(Task.DUE_DATE, Task.createDueDate(setting, 0)); item.setValue(Task.DUE_DATE, Task.createDueDate(setting, 0));
} }
if(!item.containsValue(Task.HIDE_UNTIL)) { createDefaultHideUntil(item);
int setting = Preferences.getIntegerFromString(R.string.p_default_hideUntil_key,
Task.HIDE_UNTIL_NONE);
item.setValue(Task.HIDE_UNTIL, item.createHideUntil(setting, 0));
}
setDefaultReminders(item); setDefaultReminders(item);
@ -223,6 +219,14 @@ public class TaskDao extends DatabaseDao<Task> {
return result; 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() { private void userRetentionMetrics() {
if(Preferences.getBoolean(AstridPreferences.P_FIRST_TASK, true)) { if(Preferences.getBoolean(AstridPreferences.P_FIRST_TASK, true)) {
StatisticsService.reportEvent(StatisticsConstants.USER_FIRST_TASK); StatisticsService.reportEvent(StatisticsConstants.USER_FIRST_TASK);

@ -35,6 +35,7 @@ import com.todoroo.astrid.activity.TaskEditFragment;
import com.todoroo.astrid.activity.TaskListActivity; import com.todoroo.astrid.activity.TaskListActivity;
import com.todoroo.astrid.activity.TaskListFragment; import com.todoroo.astrid.activity.TaskListFragment;
import com.todoroo.astrid.activity.TaskListFragment.OnTaskListItemClickedListener; import com.todoroo.astrid.activity.TaskListFragment.OnTaskListItemClickedListener;
import com.todoroo.astrid.dao.TaskDao;
import com.todoroo.astrid.data.TagData; import com.todoroo.astrid.data.TagData;
import com.todoroo.astrid.data.Task; import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.gcal.GCalControlSet; import com.todoroo.astrid.gcal.GCalControlSet;
@ -274,8 +275,11 @@ public class QuickAddBar extends LinearLayout {
if (repeatControl.isRecurrenceSet()) if (repeatControl.isRecurrenceSet())
repeatControl.writeToModel(task); 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); deadlineControl.writeToModel(task);
TaskDao.createDefaultHideUntil(task);
}
gcalControl.writeToModel(task); gcalControl.writeToModel(task);
peopleControl.setTask(task); peopleControl.setTask(task);
peopleControl.saveSharingSettings(null); peopleControl.saveSharingSettings(null);

Loading…
Cancel
Save