优化
This commit is contained in:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user