Fix explorer menu display

This commit is contained in:
Matéo Duparc 2022-05-01 13:50:37 +02:00
parent 4bbc9360b4
commit c8d266150c
Signed by untrusted user: hardcoresushi
GPG Key ID: AFE384344A45E13A
4 changed files with 9 additions and 7 deletions

View File

@ -497,7 +497,7 @@ open class BaseExplorerActivity : BaseActivity(), ExplorerElementAdapter.Listene
}
}
protected fun handleMenuItems(menu: Menu){
override fun onCreateOptionsMenu(menu: Menu): Boolean {
menu.findItem(R.id.rename).isVisible = false
menu.findItem(R.id.open_as)?.isVisible = false
if (usf_open){
@ -522,6 +522,7 @@ open class BaseExplorerActivity : BaseActivity(), ExplorerElementAdapter.Listene
}
}
}
return super.onCreateOptionsMenu(menu)
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {

View File

@ -258,11 +258,12 @@ class ExplorerActivity : BaseExplorerActivity() {
override fun onCreateOptionsMenu(menu: Menu): Boolean {
menuInflater.inflate(R.menu.explorer, menu)
val result = super.onCreateOptionsMenu(menu)
if (currentItemAction != ItemsActions.NONE) {
menu.findItem(R.id.validate).isVisible = true
menu.findItem(R.id.close).isVisible = false
supportActionBar?.setDisplayHomeAsUpEnabled(true)
} else {
handleMenuItems(menu)
if (usf_share){
menu.findItem(R.id.share).isVisible = false
}
@ -285,7 +286,7 @@ class ExplorerActivity : BaseExplorerActivity() {
}
}
}
return true
return result
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {

View File

@ -21,9 +21,9 @@ class ExplorerActivityDrop : BaseExplorerActivity() {
override fun onCreateOptionsMenu(menu: Menu): Boolean {
menuInflater.inflate(R.menu.explorer_drop, menu)
handleMenuItems(menu)
val result = super.onCreateOptionsMenu(menu)
menu.findItem(R.id.validate).isVisible = explorerAdapter.selectedItems.isEmpty()
return true
return result
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {

View File

@ -45,11 +45,11 @@ class ExplorerActivityPick : BaseExplorerActivity() {
override fun onCreateOptionsMenu(menu: Menu): Boolean {
menuInflater.inflate(R.menu.explorer_pick, menu)
handleMenuItems(menu)
val result = super.onCreateOptionsMenu(menu)
val anyItemSelected = explorerAdapter.selectedItems.isNotEmpty()
menu.findItem(R.id.select_all).isVisible = anyItemSelected
menu.findItem(R.id.validate).isVisible = anyItemSelected
return true
return result
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {