Browse Source

Fix explorer menu display

master
Hardcore Sushi 2 months ago
parent
commit
c8d266150c
Signed by: hardcoresushi
GPG Key ID: AFE384344A45E13A
  1. 3
      app/src/main/java/sushi/hardcore/droidfs/explorers/BaseExplorerActivity.kt
  2. 5
      app/src/main/java/sushi/hardcore/droidfs/explorers/ExplorerActivity.kt
  3. 4
      app/src/main/java/sushi/hardcore/droidfs/explorers/ExplorerActivityDrop.kt
  4. 4
      app/src/main/java/sushi/hardcore/droidfs/explorers/ExplorerActivityPick.kt

3
app/src/main/java/sushi/hardcore/droidfs/explorers/BaseExplorerActivity.kt

@ -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 {

5
app/src/main/java/sushi/hardcore/droidfs/explorers/ExplorerActivity.kt

@ -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 {

4
app/src/main/java/sushi/hardcore/droidfs/explorers/ExplorerActivityDrop.kt

@ -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 {

4
app/src/main/java/sushi/hardcore/droidfs/explorers/ExplorerActivityPick.kt

@ -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 {

Loading…
Cancel
Save