mirror of
https://github.com/gedoor/legado.git
synced 2025-08-10 00:52:30 +00:00
优化
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user