@ -770,20 +770,35 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session
}
private fun initializeEngineView ( toolbarHeight : Int ) {
engineView . setDynamicToolbarMaxHeight ( toolbarHeight )
val context = requireContext ( )
val behavior = when ( context . settings ( ) . toolbarPosition ) {
ToolbarPosition . BOTTOM -> EngineViewBottomBehavior ( context , null )
ToolbarPosition . TOP -> SwipeRefreshScrollingViewBehavior (
context ,
null ,
engineView ,
browserToolbarView
)
}
( swipeRefresh . layoutParams as CoordinatorLayout . LayoutParams ) . behavior = behavior
if ( context . settings ( ) . isDynamicToolbarEnabled ) {
engineView . setDynamicToolbarMaxHeight ( toolbarHeight )
val behavior = when ( context . settings ( ) . toolbarPosition ) {
// Set engineView dynamic vertical clipping depending on the toolbar position.
ToolbarPosition . BOTTOM -> EngineViewBottomBehavior ( context , null )
// Set scroll flags depending on if if the browser or the website is doing the scroll.
ToolbarPosition . TOP -> SwipeRefreshScrollingViewBehavior (
context ,
null ,
engineView ,
browserToolbarView
)
}
( swipeRefresh . layoutParams as CoordinatorLayout . LayoutParams ) . behavior = behavior
} else {
// Ensure webpage's bottom elements are aligned to the very bottom of the engineView.
engineView . setDynamicToolbarMaxHeight ( 0 )
// Effectively place the engineView on top of the toolbar if that is not dynamic.
if ( context . settings ( ) . shouldUseBottomToolbar ) {
val browserEngine = swipeRefresh . layoutParams as CoordinatorLayout . LayoutParams
browserEngine . bottomMargin =
requireContext ( ) . resources . getDimensionPixelSize ( R . dimen . browser _toolbar _height )
}
}
}
/ * *
@ -1097,7 +1112,7 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session
if ( webAppToolbarShouldBeVisible ) {
browserToolbarView . view . isVisible = true
val toolbarHeight = resources . getDimensionPixelSize ( R . dimen . browser _toolbar _height )
engineView. setDynamicToolbarMaxHeight ( toolbarHeight )
initializ eE ngineView( toolbarHeight )
}
}
}