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

(cherry picked from commit ac432e2e941f4689caad246bab6aa7d303c83bfa)
This commit is contained in:
AntsyLich 2025-03-19 02:21:45 +06:00 committed by Cuong-Tran
parent fb959a33e3
commit 9c25e3dede
No known key found for this signature in database
GPG key ID: 733AA7624B9315C2
5 changed files with 25 additions and 14 deletions

View file

@ -24,6 +24,7 @@ The format is a modified version of [Keep a Changelog](https://keepachangelog.co
- Add option to mark duplicate read chapters as read after library update or while reading ([@AntsyLich](https://github.com/AntsyLich)) ([#1785](https://github.com/mihonapp/mihon/pull/1785), [#1791](https://github.com/mihonapp/mihon/pull/1791), [#1870](https://github.com/mihonapp/mihon/pull/1870))
- Display staff information on Anilist tracker search results ([@NarwhalHorns](https://github.com/NarwhalHorns)) ([#1810](https://github.com/mihonapp/mihon/pull/1810))
- Add `id:` prefix search to library to search by internal DB ID ([@MajorTanya](https://github.com/MajorTanya)) ([#1856](https://github.com/mihonapp/mihon/pull/1856))
- Add back option to disable unread chapter badge in library ([@AntsyLich](https://github.com/AntsyLich)) ([#1871](https://github.com/mihonapp/mihon/pull/1871))
### Changed
- Sliders UI

View file

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

View file

@ -506,6 +506,7 @@ class LibraryScreenModel(
private fun getLibraryItemPreferencesFlow(): Flow<ItemPreferences> {
return combine(
libraryPreferences.downloadBadge().changes(),
libraryPreferences.unreadBadge().changes(),
libraryPreferences.localBadge().changes(),
libraryPreferences.languageBadge().changes(),
libraryPreferences.autoUpdateMangaRestrictions().changes(),
@ -527,22 +528,23 @@ class LibraryScreenModel(
) {
ItemPreferences(
downloadBadge = it[0] as Boolean,
localBadge = it[1] as Boolean,
languageBadge = it[2] as Boolean,
skipOutsideReleasePeriod = LibraryPreferences.MANGA_OUTSIDE_RELEASE_PERIOD in (it[3] as Set<*>),
globalFilterDownloaded = it[4] as Boolean,
filterDownloaded = it[5] as TriState,
filterUnread = it[6] as TriState,
filterStarted = it[7] as TriState,
filterBookmarked = it[8] as TriState,
filterCompleted = it[9] as TriState,
filterIntervalCustom = it[10] as TriState,
unreadBadge = it[1] as Boolean,
localBadge = it[2] as Boolean,
languageBadge = it[3] as Boolean,
skipOutsideReleasePeriod = LibraryPreferences.MANGA_OUTSIDE_RELEASE_PERIOD in (it[4] as Set<*>),
globalFilterDownloaded = it[5] as Boolean,
filterDownloaded = it[6] as TriState,
filterUnread = it[7] as TriState,
filterStarted = it[8] as TriState,
filterBookmarked = it[9] as TriState,
filterCompleted = it[10] as TriState,
filterIntervalCustom = it[11] as TriState,
// SY -->
filterLewd = it[11] as TriState,
filterLewd = it[12] as TriState,
// SY <--
// KMK -->
sourceBadge = it[12] as Boolean,
useLangIcon = it[13] as Boolean,
sourceBadge = it[13] as Boolean,
useLangIcon = it[14] as Boolean,
// KMK <--
)
}
@ -578,7 +580,7 @@ class LibraryScreenModel(
} else {
0
},
unreadCount = libraryManga.unreadCount,
unreadCount = if (prefs.unreadBadge) libraryManga.unreadCount else 0,
isLocal = if (prefs.localBadge) libraryManga.manga.isLocal() else false,
sourceLanguage = if (prefs.languageBadge) {
source.lang
@ -1414,6 +1416,7 @@ class LibraryScreenModel(
@Immutable
private data class ItemPreferences(
val downloadBadge: Boolean,
val unreadBadge: Boolean,
val localBadge: Boolean,
val languageBadge: Boolean,
// KMK -->

View file

@ -127,6 +127,8 @@ class LibraryPreferences(
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 languageBadge() = preferenceStore.getBoolean("display_language_badge", true)

View file

@ -122,6 +122,7 @@
<string name="action_display_list">List</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_unread_badge">Unread chapters</string>
<string name="action_display_local_badge">Local source</string>
<string name="action_display_language_badge">Language</string>
<string name="action_display_show_tabs">Show category tabs</string>