This commit is contained in:
Horis 2023-06-23 22:42:52 +08:00
parent 0c236847af
commit a4cbe8539a
3 changed files with 4 additions and 4 deletions

View File

@ -180,10 +180,10 @@ class MainViewModel(application: Application) : BaseViewModel(application) {
} }
} }
fun postUpBooksLiveData() { fun postUpBooksLiveData(reset: Boolean = false) {
if (AppConfig.showWaitUpCount) { if (AppConfig.showWaitUpCount) {
onUpBooksLiveData.postValue(waitUpTocBooks.size + onUpTocBooks.size) onUpBooksLiveData.postValue(waitUpTocBooks.size + onUpTocBooks.size)
} else { } else if (reset) {
onUpBooksLiveData.postValue(0) onUpBooksLiveData.postValue(0)
} }
} }

View File

@ -156,7 +156,7 @@ abstract class BaseBookshelfFragment(layoutId: Int) : VMBaseFragment<BookshelfVi
} }
if (AppConfig.showWaitUpCount != swShowWaitUpBooks.isChecked) { if (AppConfig.showWaitUpCount != swShowWaitUpBooks.isChecked) {
AppConfig.showWaitUpCount = swShowWaitUpBooks.isChecked AppConfig.showWaitUpCount = swShowWaitUpBooks.isChecked
activityViewModel.postUpBooksLiveData() activityViewModel.postUpBooksLiveData(true)
} }
var changed = false var changed = false
if (bookshelfLayout != rgLayout.getCheckedIndex()) { if (bookshelfLayout != rgLayout.getCheckedIndex()) {

View File

@ -43,7 +43,7 @@ inline fun <reified A : Activity> Context.startActivity(configIntent: Intent.()
} }
inline fun <reified T : Service> Context.startService(configIntent: Intent.() -> Unit = {}) { inline fun <reified T : Service> Context.startService(configIntent: Intent.() -> Unit = {}) {
ContextCompat.startForegroundService(this, Intent(this, T::class.java).apply(configIntent)) startService(Intent(this, T::class.java).apply(configIntent))
} }
inline fun <reified T : Service> Context.stopService() { inline fun <reified T : Service> Context.stopService() {