From d9d48674eda0330546beb4661ba3908cc96bebca Mon Sep 17 00:00:00 2001 From: ByteHamster Date: Sat, 27 Apr 2024 10:42:54 +0200 Subject: [PATCH] Move 'show subscription title' setting to subscription page (#7097) --- .../ui/screen/subscriptions/SubscriptionFragment.java | 7 +++++++ app/src/main/res/menu/subscriptions.xml | 6 ++++++ .../antennapod/storage/preferences/UserPreferences.java | 4 ++++ ui/i18n/src/main/res/values/strings.xml | 3 +-- .../src/main/res/xml/preferences_user_interface.xml | 5 ----- 5 files changed, 18 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/de/danoeh/antennapod/ui/screen/subscriptions/SubscriptionFragment.java b/app/src/main/java/de/danoeh/antennapod/ui/screen/subscriptions/SubscriptionFragment.java index 1176c948d..793a62ede 100644 --- a/app/src/main/java/de/danoeh/antennapod/ui/screen/subscriptions/SubscriptionFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/ui/screen/subscriptions/SubscriptionFragment.java @@ -189,6 +189,9 @@ public class SubscriptionFragment extends Fragment private void refreshToolbarState() { int columns = prefs.getInt(PREF_NUM_COLUMNS, getDefaultNumOfColumns()); toolbar.getMenu().findItem(COLUMN_CHECKBOX_IDS[columns - MIN_NUM_COLUMNS]).setChecked(true); + toolbar.getMenu().findItem(R.id.pref_show_subscription_title).setVisible(columns > 1); + toolbar.getMenu().findItem(R.id.pref_show_subscription_title) + .setChecked(UserPreferences.shouldShowSubscriptionTitle()); } @Subscribe(sticky = true, threadMode = ThreadMode.MAIN) @@ -229,6 +232,10 @@ public class SubscriptionFragment extends Fragment } else if (itemId == R.id.action_statistics) { ((MainActivity) getActivity()).loadChildFragment(new StatisticsFragment()); return true; + } else if (itemId == R.id.pref_show_subscription_title) { + item.setChecked(!item.isChecked()); + UserPreferences.setShouldShowSubscriptionTitle(item.isChecked()); + subscriptionAdapter.notifyDataSetChanged(); } return false; } diff --git a/app/src/main/res/menu/subscriptions.xml b/app/src/main/res/menu/subscriptions.xml index 95764aedb..927962b7a 100644 --- a/app/src/main/res/menu/subscriptions.xml +++ b/app/src/main/res/menu/subscriptions.xml @@ -49,4 +49,10 @@ + + diff --git a/storage/preferences/src/main/java/de/danoeh/antennapod/storage/preferences/UserPreferences.java b/storage/preferences/src/main/java/de/danoeh/antennapod/storage/preferences/UserPreferences.java index 9e7333a2e..4b2553109 100644 --- a/storage/preferences/src/main/java/de/danoeh/antennapod/storage/preferences/UserPreferences.java +++ b/storage/preferences/src/main/java/de/danoeh/antennapod/storage/preferences/UserPreferences.java @@ -831,6 +831,10 @@ public abstract class UserPreferences { return prefs.getBoolean(PREF_SUBSCRIPTION_TITLE, false); } + public static void setShouldShowSubscriptionTitle(boolean show) { + prefs.edit().putBoolean(PREF_SUBSCRIPTION_TITLE, show).apply(); + } + public static void setAllEpisodesSortOrder(SortOrder s) { prefs.edit().putString(PREF_SORT_ALL_EPISODES, "" + s.code).apply(); } diff --git a/ui/i18n/src/main/res/values/strings.xml b/ui/i18n/src/main/res/values/strings.xml index b86792f20..884e99ac9 100644 --- a/ui/i18n/src/main/res/values/strings.xml +++ b/ui/i18n/src/main/res/values/strings.xml @@ -525,8 +525,7 @@ Notification disabled This setting is unique to each podcast. You can change it by opening the podcast page. Contribute - Show subscription title - Display the subscription title below the cover image + Show titles New episodes action Action to take for new episodes diff --git a/ui/preferences/src/main/res/xml/preferences_user_interface.xml b/ui/preferences/src/main/res/xml/preferences_user_interface.xml index 3730ca828..a8e276546 100644 --- a/ui/preferences/src/main/res/xml/preferences_user_interface.xml +++ b/ui/preferences/src/main/res/xml/preferences_user_interface.xml @@ -49,11 +49,6 @@ android:title="@string/pref_filter_feed_title" android:key="prefSubscriptionsFilter" android:summary="@string/pref_filter_feed_sum" /> -