For #18034 - Don't animate the toolbar while the tab is loading

Use the new controller offered by AC to resolve some browser layout issues and
also offer an experience consistent with that of other browsers.
This commit is contained in:
Mugurell 2021-02-24 19:27:27 +02:00
parent 57b7601752
commit cf483ef580

View File

@ -19,6 +19,7 @@ import mozilla.components.concept.engine.Engine
import mozilla.components.concept.storage.HistoryStorage import mozilla.components.concept.storage.HistoryStorage
import mozilla.components.feature.tabs.toolbar.TabCounterToolbarButton import mozilla.components.feature.tabs.toolbar.TabCounterToolbarButton
import mozilla.components.feature.toolbar.ToolbarAutocompleteFeature import mozilla.components.feature.toolbar.ToolbarAutocompleteFeature
import mozilla.components.feature.toolbar.ToolbarBehaviorController
import mozilla.components.feature.toolbar.ToolbarFeature import mozilla.components.feature.toolbar.ToolbarFeature
import mozilla.components.feature.toolbar.ToolbarPresenter import mozilla.components.feature.toolbar.ToolbarPresenter
import mozilla.components.support.base.feature.LifecycleAwareFeature import mozilla.components.support.base.feature.LifecycleAwareFeature
@ -53,6 +54,8 @@ abstract class ToolbarIntegration(
private val menuPresenter = private val menuPresenter =
MenuPresenter(toolbar, context.components.core.store, sessionId) MenuPresenter(toolbar, context.components.core.store, sessionId)
private val toolbarController = ToolbarBehaviorController(toolbar, store, sessionId)
init { init {
toolbar.display.menuBuilder = toolbarMenu.menuBuilder toolbar.display.menuBuilder = toolbarMenu.menuBuilder
toolbar.private = isPrivate toolbar.private = isPrivate
@ -61,11 +64,13 @@ abstract class ToolbarIntegration(
override fun start() { override fun start() {
menuPresenter.start() menuPresenter.start()
toolbarPresenter.start() toolbarPresenter.start()
toolbarController.start()
} }
override fun stop() { override fun stop() {
menuPresenter.stop() menuPresenter.stop()
toolbarPresenter.stop() toolbarPresenter.stop()
toolbarController.stop()
} }
fun invalidateMenu() { fun invalidateMenu() {