commit f82602e62d85c27f320b3e3f999f961ae363b637
parent 6e74e112384ab402b1a5fa6d3a3c6dea972d05a6
Author: Mugurell <Mugurell@users.noreply.github.com>
Date: Mon, 29 Dec 2025 14:41:09 +0000
Bug 2007893 - Force expand toolbars after keyboard is closed r=android-reviewers,Roger
This effectively restores the functionality initially added in bug 2001536.
Differential Revision: https://phabricator.services.mozilla.com/D277589
Diffstat:
1 file changed, 26 insertions(+), 0 deletions(-)
diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/toolbar/FenixBrowserToolbarView.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/toolbar/FenixBrowserToolbarView.kt
@@ -7,6 +7,9 @@ package org.mozilla.fenix.components.toolbar
import android.view.View
import android.view.ViewGroup
import androidx.annotation.VisibleForTesting
+import androidx.compose.runtime.LaunchedEffect
+import androidx.compose.runtime.getValue
+import androidx.compose.ui.platform.ComposeView
import androidx.coordinatorlayout.widget.CoordinatorLayout
import androidx.core.view.isVisible
import mozilla.components.browser.state.state.CustomTabSessionState
@@ -14,7 +17,9 @@ import mozilla.components.browser.state.state.ExternalAppType
import mozilla.components.concept.engine.EngineView
import mozilla.components.concept.toolbar.ScrollableToolbar
import mozilla.components.support.ktx.android.view.findViewInHierarchy
+import mozilla.components.support.utils.KeyboardState
import mozilla.components.support.utils.ext.isKeyboardVisible
+import mozilla.components.support.utils.keyboardAsState
import mozilla.components.ui.widgets.behavior.DependencyGravity.Bottom
import mozilla.components.ui.widgets.behavior.DependencyGravity.Top
import mozilla.components.ui.widgets.behavior.EngineViewScrollingBehavior
@@ -34,6 +39,12 @@ abstract class FenixBrowserToolbarView(
private val customTabSession: CustomTabSessionState?,
) : ScrollableToolbar {
+ init {
+ if (!settings.shouldUseMinimalBottomToolbarWhenEnteringText) {
+ setupShowingToolbarsAfterKeyboardHidden()
+ }
+ }
+
abstract val layout: View
@VisibleForTesting
@@ -156,4 +167,19 @@ abstract class FenixBrowserToolbarView(
}
protected fun shouldShowTabStrip() = customTabSession == null && settings.isTabStripEnabled
+
+ private fun setupShowingToolbarsAfterKeyboardHidden() {
+ parent.addView(
+ ComposeView(parent.context).apply {
+ setContent {
+ val keyboardState by keyboardAsState()
+ LaunchedEffect(keyboardState) {
+ if (keyboardState == KeyboardState.Closed) {
+ expand()
+ }
+ }
+ }
+ },
+ )
+ }
}