Move 'show subscription title' setting to subscription page (#7097)

This commit is contained in:
ByteHamster 2024-04-27 10:42:54 +02:00 committed by GitHub
parent dbbb21bd3b
commit d9d48674ed
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 18 additions and 7 deletions

View File

@ -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;
}

View File

@ -49,4 +49,10 @@
</group>
</menu>
</item>
<item
android:id="@+id/pref_show_subscription_title"
android:title="@string/pref_show_subscription_title"
android:checkable="true"
custom:showAsAction="never" />
</menu>

View File

@ -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();
}

View File

@ -525,8 +525,7 @@
<string name="new_episode_notification_disabled">Notification disabled</string>
<string name="pref_feed_settings_dialog_msg">This setting is unique to each podcast. You can change it by opening the podcast page.</string>
<string name="pref_contribute">Contribute</string>
<string name="pref_show_subscription_title">Show subscription title</string>
<string name="pref_show_subscription_title_summary">Display the subscription title below the cover image</string>
<string name="pref_show_subscription_title">Show titles</string>
<string name="pref_new_episodes_action_title">New episodes action</string>
<string name="pref_new_episodes_action_sum">Action to take for new episodes</string>

View File

@ -49,11 +49,6 @@
android:title="@string/pref_filter_feed_title"
android:key="prefSubscriptionsFilter"
android:summary="@string/pref_filter_feed_sum" />
<SwitchPreferenceCompat
android:title="@string/pref_show_subscription_title"
android:key="prefSubscriptionTitle"
android:summary="@string/pref_show_subscription_title_summary"
android:defaultValue="false" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/external_elements">
<SwitchPreferenceCompat