From 108de56ba9231719d333d1087a5298d642160371 Mon Sep 17 00:00:00 2001 From: Alex Baker Date: Sun, 28 Oct 2018 10:43:41 -0500 Subject: [PATCH] Add option to hide list chips --- .../preferences/AppearancePreferences.java | 3 ++- .../java/org/tasks/tasklist/ViewHolder.java | 26 ++++++++++--------- .../main/res/layout/task_adapter_row_body.xml | 3 ++- app/src/main/res/values/keys.xml | 1 + app/src/main/res/values/strings.xml | 1 + .../main/res/xml/preferences_appearance.xml | 5 ++++ 6 files changed, 25 insertions(+), 14 deletions(-) diff --git a/app/src/main/java/org/tasks/preferences/AppearancePreferences.java b/app/src/main/java/org/tasks/preferences/AppearancePreferences.java index b16c28533..2fce5f915 100644 --- a/app/src/main/java/org/tasks/preferences/AppearancePreferences.java +++ b/app/src/main/java/org/tasks/preferences/AppearancePreferences.java @@ -53,7 +53,8 @@ public class AppearancePreferences extends InjectingPreferenceActivity R.string.p_fullTaskTitle, R.string.p_show_description, R.string.p_show_full_description, - R.string.p_linkify_task_list); + R.string.p_linkify_task_list, + R.string.p_show_list_indicators); setExtraOnChange(R.string.p_show_today_filter, EXTRA_FILTERS_CHANGED); setExtraOnChange(R.string.p_show_recently_modified_filter, EXTRA_FILTERS_CHANGED); setExtraOnChange(R.string.p_show_not_in_list_filter, EXTRA_FILTERS_CHANGED); diff --git a/app/src/main/java/org/tasks/tasklist/ViewHolder.java b/app/src/main/java/org/tasks/tasklist/ViewHolder.java index 30cd90b0f..999667390 100644 --- a/app/src/main/java/org/tasks/tasklist/ViewHolder.java +++ b/app/src/main/java/org/tasks/tasklist/ViewHolder.java @@ -270,20 +270,22 @@ class ViewHolder extends RecyclerView.ViewHolder { dueDate.setVisibility(View.GONE); } - String tags = task.getTagsString(); - List tagUuids = tags != null ? newArrayList(tags.split(",")) : Lists.newArrayList(); + if (preferences.getBoolean(R.string.p_show_list_indicators, true)) { + String tags = task.getTagsString(); + List tagUuids = tags != null ? newArrayList(tags.split(",")) : Lists.newArrayList(); - List chips = chipProvider.getChips(task.getCaldav(), task.getGoogleTaskList(), tagUuids); - if (chips.isEmpty()) { - chipGroup.setVisibility(View.GONE); - } else { - chipGroup.removeAllViews(); - for (Chip chip : chips) { - chip.setTextSize(fontSizeDetails); - chip.setOnClickListener(view -> callback.onClick((Filter) view.getTag())); - chipGroup.addView(chip); + List chips = chipProvider.getChips(task.getCaldav(), task.getGoogleTaskList(), tagUuids); + if (chips.isEmpty()) { + chipGroup.setVisibility(View.GONE); + } else { + chipGroup.removeAllViews(); + for (Chip chip : chips) { + chip.setTextSize(fontSizeDetails); + chip.setOnClickListener(view -> callback.onClick((Filter) view.getTag())); + chipGroup.addView(chip); + } + chipGroup.setVisibility(View.VISIBLE); } - chipGroup.setVisibility(View.VISIBLE); } } diff --git a/app/src/main/res/layout/task_adapter_row_body.xml b/app/src/main/res/layout/task_adapter_row_body.xml index 4cf7cd580..da6e6e721 100644 --- a/app/src/main/res/layout/task_adapter_row_body.xml +++ b/app/src/main/res/layout/task_adapter_row_body.xml @@ -96,6 +96,7 @@ android:layout_marginStart="@dimen/keyline_first" android:layout_marginLeft="@dimen/keyline_first" android:layout_marginRight="@dimen/keyline_content_inset" - android:layout_marginEnd="@dimen/keyline_content_inset"/> + android:layout_marginEnd="@dimen/keyline_content_inset" + android:visibility="gone"/> \ No newline at end of file diff --git a/app/src/main/res/values/keys.xml b/app/src/main/res/values/keys.xml index 3962f427e..a54d9d9c4 100644 --- a/app/src/main/res/values/keys.xml +++ b/app/src/main/res/values/keys.xml @@ -294,4 +294,5 @@ show_description show_full_description linkify_task_list + show_list_indicators diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 9adc0edd5..47d6b1719 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -873,4 +873,5 @@ File %1$s contained %2$s.\n\n Show full description Show links Add links to websites, addresses, and phone numbers + Show list chips diff --git a/app/src/main/res/xml/preferences_appearance.xml b/app/src/main/res/xml/preferences_appearance.xml index 26102453a..44ac8eb58 100644 --- a/app/src/main/res/xml/preferences_appearance.xml +++ b/app/src/main/res/xml/preferences_appearance.xml @@ -34,6 +34,11 @@ android:dependency="@string/p_show_description" android:title="@string/show_full_description" /> + +