1
0
Fork 0

For #8399: Hide keyboard to prevent content resizes

This hides the keyboard after committing a URL in the
Toolbar right before we navigate from the SearchFragment
to the BrowserFragment. If the BrowserFragment is being
displayed before the keyboard is gone an expensive
resize of the engine view (content) is triggered when the
keyboard finally goes away. This is to prevent that.
master
Christian Sadilek 2020-04-17 14:20:12 -04:00 committed by Emily Kager
parent d3093e4afe
commit ec1d4e8fca
1 changed files with 5 additions and 0 deletions

View File

@ -21,6 +21,7 @@ import mozilla.components.concept.storage.HistoryStorage
import mozilla.components.feature.toolbar.ToolbarAutocompleteFeature
import mozilla.components.support.ktx.android.content.getColorFromAttr
import mozilla.components.support.ktx.android.util.dpToPx
import mozilla.components.support.ktx.android.view.hideKeyboard
import org.mozilla.fenix.R
import org.mozilla.fenix.ext.settings
import org.mozilla.fenix.search.SearchFragmentState
@ -86,6 +87,10 @@ class ToolbarView(
elevation = TOOLBAR_ELEVATION_IN_DP.dpToPx(resources.displayMetrics).toFloat()
setOnUrlCommitListener {
// We're hiding the keyboard as early as possible to prevent the engine view
// from resizing in case the BrowserFragment is being displayed before the
// keyboard is gone: https://github.com/mozilla-mobile/fenix/issues/8399
hideKeyboard()
interactor.onUrlCommitted(it)
false
}