diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SearchActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SearchActivity.kt index 33901c1d4..e87755245 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SearchActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SearchActivity.kt @@ -54,6 +54,14 @@ class SearchActivity : SimpleActivity(), MediaOperationsListener { return true } + override fun onOptionsItemSelected(item: MenuItem): Boolean { + when (item.itemId) { + R.id.toggle_filename -> toggleFilenameVisibility() + else -> return super.onOptionsItemSelected(item) + } + return true + } + private fun setupSearch(menu: Menu) { val searchManager = getSystemService(Context.SEARCH_SERVICE) as SearchManager mSearchMenuItem = menu.findItem(R.id.search) @@ -135,6 +143,11 @@ class SearchActivity : SimpleActivity(), MediaOperationsListener { private fun getMediaAdapter() = media_grid.adapter as? MediaAdapter + private fun toggleFilenameVisibility() { + config.displayFileNames = !config.displayFileNames + getMediaAdapter()?.updateDisplayFilenames(config.displayFileNames) + } + private fun itemClicked(path: String) { val isVideo = path.isVideoFast() if (isVideo) { diff --git a/app/src/main/res/menu/menu_search.xml b/app/src/main/res/menu/menu_search.xml index ac2a96bcb..80fe3f2f4 100644 --- a/app/src/main/res/menu/menu_search.xml +++ b/app/src/main/res/menu/menu_search.xml @@ -7,4 +7,9 @@ android:title="@string/search" app:actionViewClass="androidx.appcompat.widget.SearchView" app:showAsAction="collapseActionView|always"/> +