fix: search action view not properly collapsed when pressing navbar item

This commit is contained in:
Bnyro 2025-01-24 19:04:15 +01:00
parent 95525dd8ce
commit 0db6635998

View File

@ -254,17 +254,6 @@ class MainActivity : BaseActivity() {
}
}
/**
* Remove the focus of the search view in the toolbar
*/
private fun removeSearchFocus() {
searchView.setQuery("", false)
searchView.clearFocus()
searchView.isIconified = true
searchItem.collapseActionView()
searchView.onActionViewCollapsed()
}
private fun isSearchInProgress(): Boolean {
if (!this::navController.isInitialized) return false
val id = navController.currentDestination?.id ?: return false
@ -560,9 +549,7 @@ class MainActivity : BaseActivity() {
}
// Remove focus from search view when navigating to bottom view.
// Call only after navigate to destination, so it can be used in
// onMenuItemActionCollapse for backstack management
removeSearchFocus()
searchItem.collapseActionView()
return item.onNavDestinationSelected(navController)
}