Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -115,6 +115,7 @@ class ImportBookActivity : VMBaseActivity<ActivityImportBookBinding, ImportBookV
|
|||||||
|
|
||||||
private fun initView() {
|
private fun initView() {
|
||||||
binding.layTop.setBackgroundColor(backgroundColor)
|
binding.layTop.setBackgroundColor(backgroundColor)
|
||||||
|
binding.tvEmptyMsg.setText(R.string.empty_msg_import_book)
|
||||||
binding.recyclerView.layoutManager = LinearLayoutManager(this)
|
binding.recyclerView.layoutManager = LinearLayoutManager(this)
|
||||||
binding.recyclerView.adapter = adapter
|
binding.recyclerView.adapter = adapter
|
||||||
binding.selectActionBar.setMainActionText(R.string.add_to_shelf)
|
binding.selectActionBar.setMainActionText(R.string.add_to_shelf)
|
||||||
|
|||||||
@@ -122,7 +122,13 @@ class RemoteBookActivity : VMBaseActivity<ActivityImportBookBinding, RemoteBookV
|
|||||||
adapter.selected.clear()
|
adapter.selected.clear()
|
||||||
viewModel.loadRemoteBookList(
|
viewModel.loadRemoteBookList(
|
||||||
viewModel.dirList.lastOrNull()?.path ?: RemoteBookWebDav.rootBookUrl
|
viewModel.dirList.lastOrNull()?.path ?: RemoteBookWebDav.rootBookUrl
|
||||||
)
|
) {
|
||||||
|
if (it) {
|
||||||
|
waitDialog.show()
|
||||||
|
} else {
|
||||||
|
waitDialog.dismiss()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun openDir(remoteBook: RemoteBook) {
|
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 {
|
execute {
|
||||||
dataCallback?.clear()
|
dataCallback?.clear()
|
||||||
val bookList = RemoteBookWebDav.getRemoteBookList(path)
|
val bookList = RemoteBookWebDav.getRemoteBookList(path)
|
||||||
@@ -60,6 +60,10 @@ class RemoteBookViewModel(application: Application): BaseViewModel(application){
|
|||||||
}.onError {
|
}.onError {
|
||||||
AppLog.put("获取webDav书籍出错\n${it.localizedMessage}", it)
|
AppLog.put("获取webDav书籍出错\n${it.localizedMessage}", it)
|
||||||
context.toastOnUi("获取webDav书籍出错\n${it.localizedMessage}")
|
context.toastOnUi("获取webDav书籍出错\n${it.localizedMessage}")
|
||||||
|
}.onStart {
|
||||||
|
loadCallback.invoke(true)
|
||||||
|
}.onFinally {
|
||||||
|
loadCallback.invoke(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -78,7 +78,7 @@
|
|||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:layout_margin="16dp"
|
android:layout_margin="16dp"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:text="@string/empty_msg_import_book"
|
android:text="@string/empty"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
tools:text="TextView" />
|
tools:text="TextView" />
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user