Skip to content

Commit 5f50da2

Browse files
committed
add a menu item for stoping temporarily showing hidden items
1 parent b6290c7 commit 5f50da2

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

app/src/main/kotlin/com/simplemobiletools/filemanager/activities/MainActivity.kt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,9 @@ class MainActivity : SimpleActivity(), ItemsFragment.ItemInteractionListener, Br
114114
findItem(R.id.add_favorite).isVisible = !favorites.contains(currentPath)
115115
findItem(R.id.remove_favorite).isVisible = favorites.contains(currentPath)
116116
findItem(R.id.go_to_favorite).isVisible = favorites.isNotEmpty()
117-
menu.findItem(R.id.temporarily_show_hidden).isVisible = !config.showHidden
117+
118+
findItem(R.id.temporarily_show_hidden).isVisible = !config.shouldShowHidden
119+
findItem(R.id.stop_showing_hidden).isVisible = config.temporarilyShowHidden
118120
}
119121

120122
return true
@@ -128,7 +130,8 @@ class MainActivity : SimpleActivity(), ItemsFragment.ItemInteractionListener, Br
128130
R.id.add_favorite -> addFavorite()
129131
R.id.remove_favorite -> removeFavorite()
130132
R.id.set_as_home -> setAsHome()
131-
R.id.temporarily_show_hidden -> temporarilyShowHidden()
133+
R.id.temporarily_show_hidden -> tryToggleTemporarilyShowHidden()
134+
R.id.stop_showing_hidden -> tryToggleTemporarilyShowHidden()
132135
R.id.settings -> startActivity(Intent(this, SettingsActivity::class.java))
133136
R.id.about -> launchAbout()
134137
else -> return super.onOptionsItemSelected(item)
@@ -183,7 +186,7 @@ class MainActivity : SimpleActivity(), ItemsFragment.ItemInteractionListener, Br
183186
toast(R.string.home_folder_updated)
184187
}
185188

186-
private fun temporarilyShowHidden() {
189+
private fun tryToggleTemporarilyShowHidden() {
187190
if (config.temporarilyShowHidden) {
188191
toggleTemporarilyShowHidden(false)
189192
} else {

app/src/main/res/menu/menu.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@
3434
android:id="@+id/temporarily_show_hidden"
3535
android:title="@string/temporarily_show_hidden"
3636
app:showAsAction="never"/>
37+
<item
38+
android:id="@+id/stop_showing_hidden"
39+
android:title="@string/stop_showing_hidden"
40+
app:showAsAction="never"/>
3741
<item
3842
android:id="@+id/settings"
3943
android:title="@string/settings"

0 commit comments

Comments
 (0)