mirror of
https://github.com/gedoor/legado.git
synced 2024-07-04 23:36:56 +08:00
优化
This commit is contained in:
parent
e5adb67083
commit
9242dfe476
|
@ -283,8 +283,9 @@ class ChangeBookSourceDialog() : BaseDialogFragment(R.layout.dialog_book_change_
|
|||
}
|
||||
upGroupMenuName()
|
||||
lifecycleScope.launch(IO) {
|
||||
viewModel.stopSearch()
|
||||
if (viewModel.refresh()) {
|
||||
viewModel.startOrStopSearch()
|
||||
viewModel.startSearch()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -167,8 +167,10 @@ open class ChangeBookSourceViewModel(application: Application) : BaseViewModel(a
|
|||
fun startSearch() {
|
||||
execute {
|
||||
stopSearch()
|
||||
appDb.searchBookDao.clear(name, author)
|
||||
searchBooks.clear()
|
||||
if (searchBooks.isNotEmpty()) {
|
||||
appDb.searchBookDao.delete(*searchBooks.toTypedArray())
|
||||
searchBooks.clear()
|
||||
}
|
||||
searchCallback?.upAdapter()
|
||||
bookSourceParts.clear()
|
||||
val searchGroup = AppConfig.searchGroup
|
||||
|
|
|
@ -45,6 +45,7 @@ import io.legado.app.utils.startActivity
|
|||
import io.legado.app.utils.toastOnUi
|
||||
import io.legado.app.utils.viewbindingdelegate.viewBinding
|
||||
import io.legado.app.utils.visible
|
||||
import kotlinx.coroutines.Dispatchers.IO
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.flow.conflate
|
||||
import kotlinx.coroutines.launch
|
||||
|
@ -282,8 +283,12 @@ class ChangeChapterSourceDialog() : BaseDialogFragment(R.layout.dialog_chapter_c
|
|||
} else {
|
||||
AppConfig.searchGroup = item.title.toString()
|
||||
}
|
||||
viewModel.startOrStopSearch()
|
||||
viewModel.refresh()
|
||||
lifecycleScope.launch(IO) {
|
||||
viewModel.stopSearch()
|
||||
if (viewModel.refresh()) {
|
||||
viewModel.startSearch()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false
|
||||
|
|
Loading…
Reference in New Issue
Block a user