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

This commit is contained in:
AntsyLich
2025-03-19 02:21:45 +06:00
committed by GitHub
parent 28093935d8
commit ac432e2e94
5 changed files with 22 additions and 11 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
- 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

@ -270,6 +270,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

@ -323,6 +323,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(),
@ -337,16 +338,17 @@ 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,
)
}
}
@ -370,7 +372,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) {
sourceManager.getOrStub(libraryManga.manga.source).lang
@ -704,6 +706,7 @@ class LibraryScreenModel(
@Immutable
private data class ItemPreferences(
val downloadBadge: Boolean,
val unreadBadge: Boolean,
val localBadge: Boolean,
val languageBadge: Boolean,
val skipOutsideReleasePeriod: Boolean,

View File

@ -98,6 +98,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", false)

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>