Use a SwitchPreferenceCompat for the hide feeds preference

This commit is contained in:
Shinokuni 2021-11-01 23:44:46 +01:00
parent 11f87d14a5
commit 8a5fae5411
6 changed files with 11 additions and 27 deletions

View File

@ -163,8 +163,8 @@ public class DrawerManager {
addDefaultPlaces();
Map<SecondaryDrawerItem, Feed> feedsWithoutFolder = new HashMap<>();
boolean showFeedsWithNoUnreadItems = Boolean.parseBoolean(SharedPreferencesManager
.readString(SharedPreferencesManager.SharedPrefKey.HIDE_SHOW_FEEDS));
boolean hideFeeds = SharedPreferencesManager
.readBoolean(SharedPreferencesManager.SharedPrefKey.HIDE_FEEDS);
for (Map.Entry<Folder, List<Feed>> entry : folderListMap.entrySet()) {
Folder folder = entry.getKey();
@ -182,7 +182,7 @@ public class DrawerManager {
SecondaryDrawerItem secondaryDrawerItem = createSecondaryItem(feed);
if (!showFeedsWithNoUnreadItems) {
if (hideFeeds) {
if (feed.getUnreadCount() > 0) {
secondaryDrawerItems.add(secondaryDrawerItem);
}
@ -194,7 +194,7 @@ public class DrawerManager {
}
boolean showItem;
if (!showFeedsWithNoUnreadItems) {
if (hideFeeds) {
showItem = expandableUnreadCount > 0;
} else {
showItem = true;

View File

@ -58,7 +58,7 @@ public final class SharedPreferencesManager {
OPEN_ITEMS_IN("open_items_in", "0"),
DARK_THEME("dark_theme", "false"),
AUTO_SYNCHRO("auto_synchro", "0"),
HIDE_SHOW_FEEDS("show_hide_feeds", "true"),
HIDE_FEEDS("hide_feeds", false),
MARK_ITEMS_READ_ON_SCROLL("mark_items_read", false);
@NonNull

View File

@ -138,9 +138,7 @@
<string name="changelog">Journal des modifications</string>
<string name="app_description">App distribuée sous la licence GPLv3</string>
<string name="system">Thème du système</string>
<string name="hide">Cacher</string>
<string name="show">Afficher</string>
<string name="show_hide_feeds">Afficher ou cacher les flux sans nouveaux items</string>
<string name="hide_feeds">Cacher les flux sans nouveaux items</string>
<string name="mark_items_read">Marquer les items comme lus pendant le défilement</string>
</resources>

View File

@ -76,14 +76,4 @@
<item>24</item>
</string-array>
<string-array name="show_hide_read_feeds">
<item>@string/hide</item>
<item>@string/show</item>
</string-array>
<string-array name="show_hide_read_feeds_values">
<item>false</item>
<item>true</item>
</string-array>
</resources>

View File

@ -144,8 +144,6 @@
<string name="theme_value_light" translatable="false">light</string>
<string name="theme_value_dark" translatable="false">dark</string>
<string name="theme_value_system" translatable="false">system</string>
<string name="hide">Hide</string>
<string name="show">Show</string>
<string name="show_hide_feeds">Show or hide feeds without new items</string>
<string name="hide_feeds">Hide feeds without new items</string>
<string name="mark_items_read">Mark items read on scroll</string>
</resources>

View File

@ -36,12 +36,10 @@
android:key="auto_synchro"
android:title="@string/auto_synchro" />
<ListPreference
android:defaultValue="true"
android:entries="@array/show_hide_read_feeds"
android:entryValues="@array/show_hide_read_feeds_values"
android:key="show_hide_feeds"
android:title="@string/show_hide_feeds" />
<SwitchPreferenceCompat
android:defaultValue="false"
android:key="hide_feeds"
android:title="@string/hide_feeds" />
<SwitchPreferenceCompat
android:defaultValue="false"