diff --git a/app/src/main/java/org/mozilla/fenix/browser/BaseBrowserFragment.kt b/app/src/main/java/org/mozilla/fenix/browser/BaseBrowserFragment.kt index ac8a773acb..3fb7bcd0ab 100644 --- a/app/src/main/java/org/mozilla/fenix/browser/BaseBrowserFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/browser/BaseBrowserFragment.kt @@ -376,6 +376,18 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session view = view ) + session.register(observer = object : Session.Observer { + override fun onLoadRequest( + session: Session, + url: String, + triggeredByRedirect: Boolean, + triggeredByWebContent: Boolean + ): Boolean { + browserToolbarView.expand() + return false + } + }, owner = viewLifecycleOwner) + @Suppress("ConstantConditionIf") if (FeatureFlags.pullToRefreshEnabled) { val primaryTextColor = diff --git a/app/src/main/java/org/mozilla/fenix/components/toolbar/BrowserToolbarView.kt b/app/src/main/java/org/mozilla/fenix/components/toolbar/BrowserToolbarView.kt index a1e9ce8da2..05f3eaafe2 100644 --- a/app/src/main/java/org/mozilla/fenix/components/toolbar/BrowserToolbarView.kt +++ b/app/src/main/java/org/mozilla/fenix/components/toolbar/BrowserToolbarView.kt @@ -17,6 +17,7 @@ import androidx.core.view.isVisible import com.google.android.material.snackbar.Snackbar import kotlinx.android.extensions.LayoutContainer import kotlinx.android.synthetic.main.browser_toolbar_popup_window.view.* +import kotlinx.android.synthetic.main.component_browser_top_toolbar.view.* import mozilla.components.browser.domains.autocomplete.ShippedDomainsProvider import mozilla.components.browser.session.Session import mozilla.components.browser.toolbar.BrowserToolbar @@ -58,8 +59,10 @@ class BrowserToolbarView( else -> R.layout.component_browser_top_toolbar } - val view: BrowserToolbar = LayoutInflater.from(container.context) + private val layout = LayoutInflater.from(container.context) .inflate(toolbarLayout, container, true) + + val view: BrowserToolbar = layout .findViewById(R.id.toolbar) val toolbarIntegration: ToolbarIntegration @@ -216,6 +219,12 @@ class BrowserToolbarView( // Intentionally leaving this as a stub for now since we don't actually want to update currently } + fun expand() { + if (!settings.shouldUseBottomToolbar) { + layout.app_bar?.setExpanded(true) + } + } + companion object { private const val TOOLBAR_ELEVATION = 16 } diff --git a/app/src/main/res/layout/component_browser_top_toolbar.xml b/app/src/main/res/layout/component_browser_top_toolbar.xml index 5abc533b22..b108648616 100644 --- a/app/src/main/res/layout/component_browser_top_toolbar.xml +++ b/app/src/main/res/layout/component_browser_top_toolbar.xml @@ -3,6 +3,7 @@ - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->