Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -115,6 +115,7 @@ class ImportBookActivity : VMBaseActivity<ActivityImportBookBinding, ImportBookV
|
||||
|
||||
private fun initView() {
|
||||
binding.layTop.setBackgroundColor(backgroundColor)
|
||||
binding.tvEmptyMsg.setText(R.string.empty_msg_import_book)
|
||||
binding.recyclerView.layoutManager = LinearLayoutManager(this)
|
||||
binding.recyclerView.adapter = adapter
|
||||
binding.selectActionBar.setMainActionText(R.string.add_to_shelf)
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@
|
||||
android:layout_gravity="center"
|
||||
android:layout_margin="16dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/empty_msg_import_book"
|
||||
android:text="@string/empty"
|
||||
android:visibility="gone"
|
||||
tools:text="TextView" />
|
||||
|
||||
|
||||
Reference in New Issue
Block a user