mirror of
https://github.com/mihonapp/mihon.git
synced 2025-11-14 21:18:56 +01:00
Move unread chapters badge setting to General section
This commit is contained in:
@@ -228,7 +228,7 @@ class MainActivity : BaseViewBindingActivity<MainActivityBinding>() {
|
||||
}
|
||||
}
|
||||
|
||||
merge(preferences.libraryUpdateShowTabBadge().asFlow(), preferences.libraryUnreadUpdatesCount().asFlow())
|
||||
merge(preferences.showUpdatesNavBadge().asFlow(), preferences.unreadUpdatesCount().asFlow())
|
||||
.onEach { setUnreadUpdatesBadge() }
|
||||
.launchIn(lifecycleScope)
|
||||
|
||||
@@ -355,7 +355,7 @@ class MainActivity : BaseViewBindingActivity<MainActivityBinding>() {
|
||||
}
|
||||
|
||||
private fun setUnreadUpdatesBadge() {
|
||||
val updates = if (preferences.libraryUpdateShowTabBadge().get()) preferences.libraryUnreadUpdatesCount().get() else 0
|
||||
val updates = if (preferences.showUpdatesNavBadge().get()) preferences.unreadUpdatesCount().get() else 0
|
||||
if (updates > 0) {
|
||||
nav.getOrCreateBadge(R.id.nav_updates).number = updates
|
||||
} else {
|
||||
|
||||
@@ -106,8 +106,8 @@ class UpdatesPresenter : BasePresenter<UpdatesController>() {
|
||||
setDownloadedChapters(list)
|
||||
chapters = list
|
||||
|
||||
//Set unread chapter count for bottom bar badge
|
||||
preferences.libraryUnreadUpdatesCount().set(list.count { !it.read })
|
||||
// Set unread chapter count for bottom bar badge
|
||||
preferences.unreadUpdatesCount().set(list.count { !it.read })
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -32,6 +32,11 @@ class SettingsGeneralController : SettingsController() {
|
||||
defaultValue = "1"
|
||||
summary = "%s"
|
||||
}
|
||||
switchPreference {
|
||||
key = Keys.showUpdatesNavBadge
|
||||
titleRes = R.string.pref_library_update_show_tab_badge
|
||||
defaultValue = true
|
||||
}
|
||||
switchPreference {
|
||||
key = Keys.confirmExit
|
||||
titleRes = R.string.pref_confirm_exit
|
||||
|
||||
@@ -199,11 +199,6 @@ class SettingsLibraryController : SettingsController() {
|
||||
titleRes = R.string.pref_update_only_non_completed
|
||||
defaultValue = false
|
||||
}
|
||||
switchPreference {
|
||||
key = Keys.libraryUpdateShowTabBadge
|
||||
titleRes = R.string.pref_library_update_show_tab_badge
|
||||
defaultValue = true
|
||||
}
|
||||
preference {
|
||||
key = Keys.libraryUpdateCategories
|
||||
titleRes = R.string.categories
|
||||
|
||||
Reference in New Issue
Block a user