mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-24 13:08:46 +00:00
Close search if open on back pressed in stories landing page.
This commit is contained in:
committed by
Greyson Parrelli
parent
f3fabcbe6a
commit
da9dcc794f
@@ -167,7 +167,9 @@ class StoriesLandingFragment : DSLSettingsFragment(layoutId = R.layout.stories_l
|
||||
viewLifecycleOwner,
|
||||
object : OnBackPressedCallback(true) {
|
||||
override fun handleOnBackPressed() {
|
||||
tabsViewModel.onChatsSelected()
|
||||
if (!closeSearchIfOpen()) {
|
||||
tabsViewModel.onChatsSelected()
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
@@ -350,4 +352,25 @@ class StoriesLandingFragment : DSLSettingsFragment(layoutId = R.layout.stories_l
|
||||
viewModel.isTransitioningToAnotherScreen = true
|
||||
startActivity(intent, options)
|
||||
}
|
||||
|
||||
private fun isSearchOpen(): Boolean {
|
||||
return isSearchVisible()
|
||||
}
|
||||
|
||||
private fun isSearchVisible(): Boolean {
|
||||
return requreSearchBinder().getSearchToolbar().resolved() && requreSearchBinder().getSearchToolbar().get().getVisibility() == View.VISIBLE
|
||||
}
|
||||
|
||||
private fun closeSearchIfOpen(): Boolean {
|
||||
if (isSearchOpen()) {
|
||||
requreSearchBinder().getSearchToolbar().get().collapse()
|
||||
requreSearchBinder().onSearchClosed()
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
private fun requreSearchBinder(): SearchBinder {
|
||||
return requireListener()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user