Move unread chapters badge setting to General section

This commit is contained in:
arkon
2021-10-30 12:42:59 -04:00
parent 90b312a56e
commit 709de81814
9 changed files with 19 additions and 15 deletions

View File

@@ -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 {

View File

@@ -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 })
}
}

View File

@@ -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

View File

@@ -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