Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Jan 24, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
}
Expand Down
Loading