pull/1999/head
kunfei 2 years ago
parent 99f2bc4b08
commit da23114aa8
  1. 8
      app/src/main/java/io/legado/app/ui/book/remote/RemoteBookActivity.kt
  2. 6
      app/src/main/java/io/legado/app/ui/book/remote/RemoteBookViewModel.kt

@ -122,7 +122,13 @@ class RemoteBookActivity : VMBaseActivity<ActivityImportBookBinding, RemoteBookV
adapter.selected.clear()
viewModel.loadRemoteBookList(
viewModel.dirList.lastOrNull()?.path ?: RemoteBookWebDav.rootBookUrl
)
) {
if (it) {
waitDialog.show()
} else {
waitDialog.dismiss()
}
}
}
override fun openDir(remoteBook: RemoteBook) {

@ -52,7 +52,7 @@ class RemoteBookViewModel(application: Application): BaseViewModel(application){
}
}
fun loadRemoteBookList(path: String) {
fun loadRemoteBookList(path: String, loadCallback: (loading: Boolean) -> Unit) {
execute {
dataCallback?.clear()
val bookList = RemoteBookWebDav.getRemoteBookList(path)
@ -60,6 +60,10 @@ class RemoteBookViewModel(application: Application): BaseViewModel(application){
}.onError {
AppLog.put("获取webDav书籍出错\n${it.localizedMessage}", it)
context.toastOnUi("获取webDav书籍出错\n${it.localizedMessage}")
}.onStart {
loadCallback.invoke(true)
}.onFinally {
loadCallback.invoke(false)
}
}

Loading…
Cancel
Save