Add option to disable subtasks

Subtasks are disabled by default
gtask_related_email
Alex Baker 6 years ago
parent a4a201d647
commit 21a1b9cfc7

@ -113,7 +113,14 @@ public class BasicPreferences extends InjectingPreferenceActivity
R.string.p_linkify_task_list,
R.string.p_show_list_indicators);
findPreference(getString(R.string.customize_edit_screen))
findPreference(R.string.p_show_subtasks)
.setOnPreferenceChangeListener((preference, newValue) -> {
forceRestart();
localBroadcastManager.broadcastRefresh();
return true;
});
findPreference(R.string.customize_edit_screen)
.setOnPreferenceClickListener(
preference -> {
startActivityForResult(

@ -5,6 +5,7 @@ import static com.google.common.collect.Iterables.filter;
import static com.google.common.collect.Iterables.transform;
import static com.google.common.collect.Sets.newHashSet;
import static com.todoroo.andlib.utility.AndroidUtilities.atLeastKitKat;
import static com.todoroo.andlib.utility.AndroidUtilities.atLeastLollipop;
import static java.util.Collections.emptySet;
import android.content.ContentResolver;
@ -527,4 +528,8 @@ public class Preferences {
public int getDefaultPriority() {
return getIntegerFromString(R.string.p_default_importance_key, Priority.LOW);
}
public boolean showSubtasks() {
return atLeastLollipop() && getBoolean(R.string.p_show_subtasks, false);
}
}

@ -109,6 +109,7 @@ public class TaskListViewModel extends ViewModel {
if (filter.supportSubtasks()
&& (includeGoogleTaskSubtasks || includeCaldavSubtasks)
&& preferences.showSubtasks()
&& !(preferences.isManualSort() && filter.supportsManualSort())) {
String tagQuery =
Query.select(field("group_concat(distinct(tag_uid))"))

@ -308,4 +308,5 @@
<string name="google_tasks_position_hack">Custom order synchronization fix</string>
<string name="google_tasks_position_hack_summary">Always perform a full synchronization to workaround https://issuetracker.google.com/issues/132432317</string>
<string name="subscription_help_url">https://tasks.org/subscribe</string>
<string name="p_show_subtasks">show_subtasks</string>
</resources>

@ -560,4 +560,6 @@ File %1$s contained %2$s.\n\n
<string name="subtasks_enable_synchronization">Enable synchronization to add subtasks</string>
<string name="subtasks_multilevel_google_task">Multi-level subtasks not supported by Google Tasks</string>
<string name="enter_title_hint">Enter title</string>
<string name="show_subtasks">Show subtasks</string>
<string name="show_subtasks_summary">Displaying subtasks will degrade app performance</string>
</resources>

@ -38,6 +38,12 @@
android:key="@string/p_rowPadding"
android:title="@string/row_spacing"/>
<CheckBoxPreference
android:defaultValue="false"
android:key="@string/p_show_subtasks"
android:title="@string/show_subtasks"
android:summary="@string/show_subtasks_summary" />
<com.todoroo.astrid.ui.MultilineCheckboxPreference
android:defaultValue="false"
android:key="@string/p_fullTaskTitle"

Loading…
Cancel
Save