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() {
|
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 =
|
val directions =
|
||||||
HomeFragmentDirections.actionGlobalSearchDialog(
|
HomeFragmentDirections.actionGlobalSearchDialog(
|
||||||
sessionId = null
|
sessionId = null
|
||||||
|
@ -246,13 +246,17 @@ class SearchDialogFragment : AppCompatDialogFragment(), UserInteractionHandler {
|
|||||||
|
|
||||||
setupConstraints(view)
|
setupConstraints(view)
|
||||||
|
|
||||||
// When displayed above browser, dismisses dialog on clicking scrim area
|
// When displayed above browser or home screen, dismisses keyboard when touching scrim area
|
||||||
if (findNavController().previousBackStackEntry?.destination?.id == R.id.browserFragment) {
|
when (findNavController().previousBackStackEntry?.destination?.id) {
|
||||||
binding.searchWrapper.setOnClickListener {
|
R.id.browserFragment, R.id.homeFragment -> {
|
||||||
it.hideKeyboard()
|
binding.searchWrapper.setOnTouchListener { _, _ ->
|
||||||
dismissAllowingStateLoss()
|
binding.searchWrapper.hideKeyboard()
|
||||||
|
toolbarView.view.clearFocus()
|
||||||
|
false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else -> {}
|
||||||
|
}
|
||||||
|
|
||||||
binding.searchEnginesShortcutButton.setOnClickListener {
|
binding.searchEnginesShortcutButton.setOnClickListener {
|
||||||
interactor.onSearchShortcutsButtonClicked()
|
interactor.onSearchShortcutsButtonClicked()
|
||||||
|
Loading…
Reference in New Issue
Block a user