fix: backstack when opening search fragment (#7010)

This commit is contained in:
Thomas W. 2025-01-24 18:58:29 +01:00 committed by GitHub
parent 7c7e69d369
commit e42866de7c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 1 deletions

View File

@ -356,7 +356,7 @@ class MainActivity : BaseActivity() {
override fun onMenuItemActionExpand(item: MenuItem): Boolean {
if (navController.currentDestination?.id != R.id.searchResultFragment) {
searchViewModel.setQuery(null)
navController.navigate(R.id.searchFragment)
navController.navigate(R.id.openSearch)
}
item.setShowAsAction(
MenuItem.SHOW_AS_ACTION_ALWAYS or MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW

View File

@ -119,4 +119,10 @@
<action
android:id="@+id/showSearchResults"
app:destination="@id/searchResultFragment" />
<action
android:id="@+id/openSearch"
app:destination="@id/searchFragment"
app:popUpTo="@id/homeFragment"
app:popUpToSaveState="true"
app:restoreState="false" />
</navigation>