mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-17 15:26:23 +00:00
[fenix] Close https://github.com/mozilla-mobile/fenix/issues/20701: Dismiss keyboard when scrolling home screen
This commit is contained in:
parent
a39062eb9b
commit
9534fa2356
@ -877,20 +877,6 @@ class HomeFragment : Fragment() {
|
||||
}
|
||||
|
||||
private fun navigateToSearch() {
|
||||
// Dismisses the search dialog when the home content is scrolled
|
||||
val recyclerView = sessionControlView!!.view
|
||||
val listener = object : RecyclerView.OnScrollListener() {
|
||||
override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) {
|
||||
super.onScrollStateChanged(recyclerView, newState)
|
||||
if (newState == RecyclerView.SCROLL_STATE_DRAGGING || newState == RecyclerView.SCROLL_STATE_SETTLING) {
|
||||
findNavController().navigateUp()
|
||||
recyclerView.removeOnScrollListener(this)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
recyclerView.addOnScrollListener(listener)
|
||||
|
||||
val directions =
|
||||
HomeFragmentDirections.actionGlobalSearchDialog(
|
||||
sessionId = null
|
||||
|
@ -246,13 +246,17 @@ class SearchDialogFragment : AppCompatDialogFragment(), UserInteractionHandler {
|
||||
|
||||
setupConstraints(view)
|
||||
|
||||
// When displayed above browser, dismisses dialog on clicking scrim area
|
||||
if (findNavController().previousBackStackEntry?.destination?.id == R.id.browserFragment) {
|
||||
binding.searchWrapper.setOnClickListener {
|
||||
it.hideKeyboard()
|
||||
dismissAllowingStateLoss()
|
||||
// When displayed above browser or home screen, dismisses keyboard when touching scrim area
|
||||
when (findNavController().previousBackStackEntry?.destination?.id) {
|
||||
R.id.browserFragment, R.id.homeFragment -> {
|
||||
binding.searchWrapper.setOnTouchListener { _, _ ->
|
||||
binding.searchWrapper.hideKeyboard()
|
||||
toolbarView.view.clearFocus()
|
||||
false
|
||||
}
|
||||
}
|
||||
else -> {}
|
||||
}
|
||||
|
||||
binding.searchEnginesShortcutButton.setOnClickListener {
|
||||
interactor.onSearchShortcutsButtonClicked()
|
||||
|
Loading…
Reference in New Issue
Block a user