From 02ba9402bcf8329a66f8eca733d4b3b49d898e46 Mon Sep 17 00:00:00 2001 From: Alex Baker Date: Fri, 4 Nov 2016 14:31:13 -0500 Subject: [PATCH] Show hidden & completed in astrid subtask views --- .../todoroo/astrid/activity/TaskListFragment.java | 8 +------- .../astrid/subtasks/SubtasksFilterUpdater.java | 12 +++++++----- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/todoroo/astrid/activity/TaskListFragment.java b/src/main/java/com/todoroo/astrid/activity/TaskListFragment.java index a78b88cd7..0815a639a 100644 --- a/src/main/java/com/todoroo/astrid/activity/TaskListFragment.java +++ b/src/main/java/com/todoroo/astrid/activity/TaskListFragment.java @@ -43,12 +43,9 @@ import com.todoroo.astrid.core.BuiltInFilterExposer; import com.todoroo.astrid.dao.TaskDao; import com.todoroo.astrid.data.Task; import com.todoroo.astrid.gtasks.GtasksPreferenceService; -import com.todoroo.astrid.gtasks.GtasksSubtaskListFragment; import com.todoroo.astrid.service.TaskCreator; import com.todoroo.astrid.service.TaskDeleter; import com.todoroo.astrid.service.TaskDuplicator; -import com.todoroo.astrid.subtasks.SubtasksListFragment; -import com.todoroo.astrid.subtasks.SubtasksTagListFragment; import com.todoroo.astrid.timers.TimerPlugin; import com.todoroo.astrid.voice.VoiceInputAssistant; @@ -240,12 +237,9 @@ public class TaskListFragment extends InjectingFragment implements if (preferences.getBoolean(R.string.p_show_completed_tasks, false)) { completed.setChecked(true); } - if (this instanceof GtasksSubtaskListFragment) { + if (taskAdapter.isManuallySorted()) { completed.setChecked(true); completed.setEnabled(false); - } - - if (this instanceof SubtasksTagListFragment || this instanceof SubtasksListFragment || this instanceof GtasksSubtaskListFragment) { hidden.setChecked(true); hidden.setEnabled(false); } diff --git a/src/main/java/com/todoroo/astrid/subtasks/SubtasksFilterUpdater.java b/src/main/java/com/todoroo/astrid/subtasks/SubtasksFilterUpdater.java index e55ea141b..e94ae1fb6 100644 --- a/src/main/java/com/todoroo/astrid/subtasks/SubtasksFilterUpdater.java +++ b/src/main/java/com/todoroo/astrid/subtasks/SubtasksFilterUpdater.java @@ -3,7 +3,6 @@ package com.todoroo.astrid.subtasks; import android.text.TextUtils; import com.todoroo.andlib.data.TodorooCursor; -import com.todoroo.andlib.sql.Criterion; import com.todoroo.astrid.api.Filter; import com.todoroo.astrid.dao.TaskDao; import com.todoroo.astrid.dao.TaskListMetadataDao; @@ -73,10 +72,10 @@ public class SubtasksFilterUpdater { String query = filter.getSqlQuery(); query = query.replaceAll("ORDER BY .*", ""); - query = query + String.format(" ORDER BY %s, %s, %s", - Task.DELETION_DATE, getOrderString(), Task.CREATION_DATE); - query = query.replace(TaskDao.TaskCriteria.isVisible().toString(), - Criterion.all.toString()); + query = query + String.format(" ORDER BY %s", getOrderString()); + query = query.replace( + TaskDao.TaskCriteria.activeAndVisible().toString(), + TaskDao.TaskCriteria.notDeleted().toString()); filter.setFilterQueryOverride(query); } @@ -122,6 +121,9 @@ public class SubtasksFilterUpdater { Set idsInQuery = new HashSet<>(); String sql = filter.getSqlQuery().replaceAll("ORDER BY .*", ""); //$NON-NLS-1$//$NON-NLS-2$ sql = sql + String.format(" ORDER BY %s", Task.CREATION_DATE); //$NON-NLS-1$ + sql = sql.replace( + TaskDao.TaskCriteria.activeAndVisible().toString(), + TaskDao.TaskCriteria.notDeleted().toString()); TodorooCursor tasks = taskDao.fetchFiltered(sql, Task.UUID); try { for (tasks.moveToFirst(); !tasks.isAfterLast(); tasks.moveToNext()) {