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