mirror of
https://github.com/gedoor/legado.git
synced 2024-07-06 23:47:49 +08:00
优化
This commit is contained in:
parent
0c236847af
commit
a4cbe8539a
@ -180,10 +180,10 @@ class MainViewModel(application: Application) : BaseViewModel(application) {
|
||||
}
|
||||
}
|
||||
|
||||
fun postUpBooksLiveData() {
|
||||
fun postUpBooksLiveData(reset: Boolean = false) {
|
||||
if (AppConfig.showWaitUpCount) {
|
||||
onUpBooksLiveData.postValue(waitUpTocBooks.size + onUpTocBooks.size)
|
||||
} else {
|
||||
} else if (reset) {
|
||||
onUpBooksLiveData.postValue(0)
|
||||
}
|
||||
}
|
||||
|
@ -156,7 +156,7 @@ abstract class BaseBookshelfFragment(layoutId: Int) : VMBaseFragment<BookshelfVi
|
||||
}
|
||||
if (AppConfig.showWaitUpCount != swShowWaitUpBooks.isChecked) {
|
||||
AppConfig.showWaitUpCount = swShowWaitUpBooks.isChecked
|
||||
activityViewModel.postUpBooksLiveData()
|
||||
activityViewModel.postUpBooksLiveData(true)
|
||||
}
|
||||
var changed = false
|
||||
if (bookshelfLayout != rgLayout.getCheckedIndex()) {
|
||||
|
@ -43,7 +43,7 @@ inline fun <reified A : Activity> Context.startActivity(configIntent: Intent.()
|
||||
}
|
||||
|
||||
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() {
|
||||
|
Loading…
Reference in New Issue
Block a user