Add back option to hide unread chapter badge in library (#1871)

(cherry picked from commit ac432e2e941f4689caad246bab6aa7d303c83bfa)

# Conflicts:
#	CHANGELOG.md
#	app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryScreenModel.kt
This commit is contained in:
AntsyLich 2025-03-19 02:21:45 +06:00 committed by Jobobby04
parent f8a57ec98c
commit d62a8a138c
4 changed files with 22 additions and 12 deletions

View File

@ -328,6 +328,10 @@ private fun ColumnScope.DisplayPage(
label = stringResource(MR.strings.action_display_download_badge), label = stringResource(MR.strings.action_display_download_badge),
pref = screenModel.libraryPreferences.downloadBadge(), pref = screenModel.libraryPreferences.downloadBadge(),
) )
CheckboxItem(
label = stringResource(MR.strings.action_display_unread_badge),
pref = screenModel.libraryPreferences.unreadBadge(),
)
CheckboxItem( CheckboxItem(
label = stringResource(MR.strings.action_display_local_badge), label = stringResource(MR.strings.action_display_local_badge),
pref = screenModel.libraryPreferences.localBadge(), pref = screenModel.libraryPreferences.localBadge(),

View File

@ -497,6 +497,7 @@ class LibraryScreenModel(
private fun getLibraryItemPreferencesFlow(): Flow<ItemPreferences> { private fun getLibraryItemPreferencesFlow(): Flow<ItemPreferences> {
return combine( return combine(
libraryPreferences.downloadBadge().changes(), libraryPreferences.downloadBadge().changes(),
libraryPreferences.unreadBadge().changes(),
libraryPreferences.localBadge().changes(), libraryPreferences.localBadge().changes(),
libraryPreferences.languageBadge().changes(), libraryPreferences.languageBadge().changes(),
libraryPreferences.autoUpdateMangaRestrictions().changes(), libraryPreferences.autoUpdateMangaRestrictions().changes(),
@ -514,18 +515,19 @@ class LibraryScreenModel(
) { ) {
ItemPreferences( ItemPreferences(
downloadBadge = it[0] as Boolean, downloadBadge = it[0] as Boolean,
localBadge = it[1] as Boolean, unreadBadge = it[1] as Boolean,
languageBadge = it[2] as Boolean, localBadge = it[2] as Boolean,
skipOutsideReleasePeriod = LibraryPreferences.MANGA_OUTSIDE_RELEASE_PERIOD in (it[3] as Set<*>), languageBadge = it[3] as Boolean,
globalFilterDownloaded = it[4] as Boolean, skipOutsideReleasePeriod = LibraryPreferences.MANGA_OUTSIDE_RELEASE_PERIOD in (it[4] as Set<*>),
filterDownloaded = it[5] as TriState, globalFilterDownloaded = it[5] as Boolean,
filterUnread = it[6] as TriState, filterDownloaded = it[6] as TriState,
filterStarted = it[7] as TriState, filterUnread = it[7] as TriState,
filterBookmarked = it[8] as TriState, filterStarted = it[8] as TriState,
filterCompleted = it[9] as TriState, filterBookmarked = it[9] as TriState,
filterIntervalCustom = it[10] as TriState, filterCompleted = it[10] as TriState,
filterIntervalCustom = it[11] as TriState,
// SY --> // SY -->
filterLewd = it[11] as TriState, filterLewd = it[12] as TriState,
// SY <-- // SY <--
) )
} }
@ -558,7 +560,7 @@ class LibraryScreenModel(
} else { } else {
0 0
}, },
unreadCount = libraryManga.unreadCount, unreadCount = if (prefs.unreadBadge) libraryManga.unreadCount else 0,
isLocal = if (prefs.localBadge) libraryManga.manga.isLocal() else false, isLocal = if (prefs.localBadge) libraryManga.manga.isLocal() else false,
sourceLanguage = if (prefs.languageBadge) { sourceLanguage = if (prefs.languageBadge) {
sourceManager.getOrStub(libraryManga.manga.source).lang sourceManager.getOrStub(libraryManga.manga.source).lang
@ -1363,6 +1365,7 @@ class LibraryScreenModel(
@Immutable @Immutable
private data class ItemPreferences( private data class ItemPreferences(
val downloadBadge: Boolean, val downloadBadge: Boolean,
val unreadBadge: Boolean,
val localBadge: Boolean, val localBadge: Boolean,
val languageBadge: Boolean, val languageBadge: Boolean,
val skipOutsideReleasePeriod: Boolean, val skipOutsideReleasePeriod: Boolean,

View File

@ -107,6 +107,8 @@ class LibraryPreferences(
fun downloadBadge() = preferenceStore.getBoolean("display_download_badge", false) fun downloadBadge() = preferenceStore.getBoolean("display_download_badge", false)
fun unreadBadge() = preferenceStore.getBoolean("display_unread_badge", true)
fun localBadge() = preferenceStore.getBoolean("display_local_badge", true) fun localBadge() = preferenceStore.getBoolean("display_local_badge", true)
fun languageBadge() = preferenceStore.getBoolean("display_language_badge", false) fun languageBadge() = preferenceStore.getBoolean("display_language_badge", false)

View File

@ -122,6 +122,7 @@
<string name="action_display_list">List</string> <string name="action_display_list">List</string>
<string name="action_display_cover_only_grid">Cover-only grid</string> <string name="action_display_cover_only_grid">Cover-only grid</string>
<string name="action_display_download_badge">Downloaded chapters</string> <string name="action_display_download_badge">Downloaded chapters</string>
<string name="action_display_unread_badge">Unread chapters</string>
<string name="action_display_local_badge">Local source</string> <string name="action_display_local_badge">Local source</string>
<string name="action_display_language_badge">Language</string> <string name="action_display_language_badge">Language</string>
<string name="action_display_show_tabs">Show category tabs</string> <string name="action_display_show_tabs">Show category tabs</string>