mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-19 09:25:34 +00:00
[fenix] For https://github.com/mozilla-mobile/fenix/issues/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.
This commit is contained in:
parent
94e26476c3
commit
737e647c83
@ -21,6 +21,7 @@ import mozilla.components.concept.storage.HistoryStorage
|
|||||||
import mozilla.components.feature.toolbar.ToolbarAutocompleteFeature
|
import mozilla.components.feature.toolbar.ToolbarAutocompleteFeature
|
||||||
import mozilla.components.support.ktx.android.content.getColorFromAttr
|
import mozilla.components.support.ktx.android.content.getColorFromAttr
|
||||||
import mozilla.components.support.ktx.android.util.dpToPx
|
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.R
|
||||||
import org.mozilla.fenix.ext.settings
|
import org.mozilla.fenix.ext.settings
|
||||||
import org.mozilla.fenix.search.SearchFragmentState
|
import org.mozilla.fenix.search.SearchFragmentState
|
||||||
@ -86,6 +87,10 @@ class ToolbarView(
|
|||||||
elevation = TOOLBAR_ELEVATION_IN_DP.dpToPx(resources.displayMetrics).toFloat()
|
elevation = TOOLBAR_ELEVATION_IN_DP.dpToPx(resources.displayMetrics).toFloat()
|
||||||
|
|
||||||
setOnUrlCommitListener {
|
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)
|
interactor.onUrlCommitted(it)
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user