pull/1994/head 3.22.062320
kunfei 2 years ago
parent 890706fa34
commit 6026b45aac
  1. 18
      app/src/main/java/io/legado/app/ui/book/remote/RemoteBookActivity.kt

@ -62,8 +62,7 @@ class RemoteBookActivity : VMBaseActivity<ActivityImportBookBinding, RemoteBookV
private fun initEvent() { private fun initEvent() {
binding.tvGoBack.setOnClickListener { binding.tvGoBack.setOnClickListener {
viewModel.dirList.removeLastOrNull() goBackDir()
upPath()
} }
} }
@ -97,6 +96,21 @@ class RemoteBookActivity : VMBaseActivity<ActivityImportBookBinding, RemoteBookV
} }
} }
override fun onBackPressed() {
if (!goBackDir()) {
super.onBackPressed()
}
}
private fun goBackDir(): Boolean {
if (viewModel.dirList.isEmpty()) {
return false
}
viewModel.dirList.removeLastOrNull()
upPath()
return true
}
private fun upPath() { private fun upPath() {
binding.tvGoBack.isEnabled = viewModel.dirList.isNotEmpty() binding.tvGoBack.isEnabled = viewModel.dirList.isNotEmpty()
var path = "books" + File.separator var path = "books" + File.separator

Loading…
Cancel
Save