mirror of
https://github.com/gedoor/legado.git
synced 2025-08-10 00:52:30 +00:00
优化
This commit is contained in:
@@ -62,8 +62,7 @@ class RemoteBookActivity : VMBaseActivity<ActivityImportBookBinding, RemoteBookV
|
||||
|
||||
private fun initEvent() {
|
||||
binding.tvGoBack.setOnClickListener {
|
||||
viewModel.dirList.removeLastOrNull()
|
||||
upPath()
|
||||
goBackDir()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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() {
|
||||
binding.tvGoBack.isEnabled = viewModel.dirList.isNotEmpty()
|
||||
var path = "books" + File.separator
|
||||
|
||||
Reference in New Issue
Block a user