add a menu item for stoping temporarily showing hidden items

This commit is contained in:
tibbi 2017-08-07 22:28:57 +02:00
parent b6290c7c5e
commit 5f50da2951
2 changed files with 10 additions and 3 deletions

View file

@ -114,7 +114,9 @@ class MainActivity : SimpleActivity(), ItemsFragment.ItemInteractionListener, Br
findItem(R.id.add_favorite).isVisible = !favorites.contains(currentPath)
findItem(R.id.remove_favorite).isVisible = favorites.contains(currentPath)
findItem(R.id.go_to_favorite).isVisible = favorites.isNotEmpty()
menu.findItem(R.id.temporarily_show_hidden).isVisible = !config.showHidden
findItem(R.id.temporarily_show_hidden).isVisible = !config.shouldShowHidden
findItem(R.id.stop_showing_hidden).isVisible = config.temporarilyShowHidden
}
return true
@ -128,7 +130,8 @@ class MainActivity : SimpleActivity(), ItemsFragment.ItemInteractionListener, Br
R.id.add_favorite -> addFavorite()
R.id.remove_favorite -> removeFavorite()
R.id.set_as_home -> setAsHome()
R.id.temporarily_show_hidden -> temporarilyShowHidden()
R.id.temporarily_show_hidden -> tryToggleTemporarilyShowHidden()
R.id.stop_showing_hidden -> tryToggleTemporarilyShowHidden()
R.id.settings -> startActivity(Intent(this, SettingsActivity::class.java))
R.id.about -> launchAbout()
else -> return super.onOptionsItemSelected(item)
@ -183,7 +186,7 @@ class MainActivity : SimpleActivity(), ItemsFragment.ItemInteractionListener, Br
toast(R.string.home_folder_updated)
}
private fun temporarilyShowHidden() {
private fun tryToggleTemporarilyShowHidden() {
if (config.temporarilyShowHidden) {
toggleTemporarilyShowHidden(false)
} else {

View file

@ -34,6 +34,10 @@
android:id="@+id/temporarily_show_hidden"
android:title="@string/temporarily_show_hidden"
app:showAsAction="never"/>
<item
android:id="@+id/stop_showing_hidden"
android:title="@string/stop_showing_hidden"
app:showAsAction="never"/>
<item
android:id="@+id/settings"
android:title="@string/settings"