parent
3d1d146c94
commit
208a58bc58
|
@ -430,7 +430,7 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session
|
|||
|
||||
if (FeatureFlags.dynamicBottomToolbar) {
|
||||
engineView.setDynamicToolbarMaxHeight(0)
|
||||
// TODO We need to call force expand here to update verticalClipping #8697
|
||||
browserToolbarView.expand()
|
||||
// Without this, fullscreen has a margin at the top.
|
||||
engineView.setVerticalClipping(0)
|
||||
}
|
||||
|
|
|
@ -15,6 +15,11 @@ import androidx.coordinatorlayout.widget.CoordinatorLayout
|
|||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.lifecycle.LifecycleOwner
|
||||
import com.google.android.material.appbar.AppBarLayout
|
||||
import com.google.android.material.appbar.AppBarLayout.LayoutParams.SCROLL_FLAG_ENTER_ALWAYS
|
||||
import com.google.android.material.appbar.AppBarLayout.LayoutParams.SCROLL_FLAG_EXIT_UNTIL_COLLAPSED
|
||||
import com.google.android.material.appbar.AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL
|
||||
import com.google.android.material.appbar.AppBarLayout.LayoutParams.SCROLL_FLAG_SNAP
|
||||
import com.google.android.material.snackbar.Snackbar
|
||||
import kotlinx.android.extensions.LayoutContainer
|
||||
import kotlinx.android.synthetic.main.browser_toolbar_popup_window.view.*
|
||||
|
@ -26,6 +31,7 @@ import mozilla.components.browser.toolbar.behavior.BrowserToolbarBottomBehavior
|
|||
import mozilla.components.browser.toolbar.display.DisplayToolbar
|
||||
import mozilla.components.support.ktx.android.util.dpToFloat
|
||||
import mozilla.components.support.utils.URLStringUtils
|
||||
import org.mozilla.fenix.FeatureFlags
|
||||
import org.mozilla.fenix.R
|
||||
import org.mozilla.fenix.components.FenixSnackbar
|
||||
import org.mozilla.fenix.customtabs.CustomTabToolbarIntegration
|
||||
|
@ -33,7 +39,6 @@ import org.mozilla.fenix.customtabs.CustomTabToolbarMenu
|
|||
import org.mozilla.fenix.ext.bookmarkStorage
|
||||
import org.mozilla.fenix.ext.components
|
||||
import org.mozilla.fenix.ext.settings
|
||||
import org.mozilla.fenix.search.toolbar.setScrollFlagsForTopToolbar
|
||||
import org.mozilla.fenix.theme.ThemeManager
|
||||
|
||||
interface BrowserToolbarViewInteractor {
|
||||
|
@ -240,11 +245,11 @@ class BrowserToolbarView(
|
|||
}
|
||||
|
||||
fun expand() {
|
||||
if (settings.shouldUseBottomToolbar) {
|
||||
if (settings.shouldUseBottomToolbar && FeatureFlags.dynamicBottomToolbar) {
|
||||
(view.layoutParams as CoordinatorLayout.LayoutParams).apply {
|
||||
(behavior as BrowserToolbarBottomBehavior).forceExpand(view)
|
||||
}
|
||||
} else {
|
||||
} else if (!settings.shouldUseBottomToolbar) {
|
||||
layout.app_bar?.setExpanded(true)
|
||||
}
|
||||
}
|
||||
|
@ -253,3 +258,29 @@ class BrowserToolbarView(
|
|||
private const val TOOLBAR_ELEVATION = 16
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Dynamically sets scroll flags for the toolbar when the user does not have a screen reader enabled
|
||||
* Note that the bottom toolbar has a feature flag for being dynamic, so it may not get flags set.
|
||||
*/
|
||||
fun BrowserToolbar.setScrollFlagsForTopToolbar() {
|
||||
// Don't set scroll flags for bottom toolbar
|
||||
if (context.settings().shouldUseBottomToolbar) {
|
||||
if (FeatureFlags.dynamicBottomToolbar && layoutParams is CoordinatorLayout.LayoutParams) {
|
||||
(layoutParams as CoordinatorLayout.LayoutParams).apply {
|
||||
behavior = BrowserToolbarBottomBehavior(context, null)
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
val params = layoutParams as AppBarLayout.LayoutParams
|
||||
params.scrollFlags = when (context.settings().shouldUseFixedTopToolbar) {
|
||||
true -> 0
|
||||
false -> {
|
||||
SCROLL_FLAG_SCROLL or SCROLL_FLAG_ENTER_ALWAYS or SCROLL_FLAG_SNAP or
|
||||
SCROLL_FLAG_EXIT_UNTIL_COLLAPSED
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,21 +13,14 @@ import androidx.annotation.LayoutRes
|
|||
import androidx.appcompat.content.res.AppCompatResources
|
||||
import androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
import androidx.core.content.ContextCompat
|
||||
import com.google.android.material.appbar.AppBarLayout
|
||||
import com.google.android.material.appbar.AppBarLayout.LayoutParams.SCROLL_FLAG_ENTER_ALWAYS
|
||||
import com.google.android.material.appbar.AppBarLayout.LayoutParams.SCROLL_FLAG_EXIT_UNTIL_COLLAPSED
|
||||
import com.google.android.material.appbar.AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL
|
||||
import com.google.android.material.appbar.AppBarLayout.LayoutParams.SCROLL_FLAG_SNAP
|
||||
import kotlinx.android.extensions.LayoutContainer
|
||||
import mozilla.components.browser.domains.autocomplete.ShippedDomainsProvider
|
||||
import mozilla.components.browser.toolbar.BrowserToolbar
|
||||
import mozilla.components.browser.toolbar.behavior.BrowserToolbarBottomBehavior
|
||||
import mozilla.components.concept.engine.Engine
|
||||
import mozilla.components.concept.storage.HistoryStorage
|
||||
import mozilla.components.feature.toolbar.ToolbarAutocompleteFeature
|
||||
import mozilla.components.support.ktx.android.content.getColorFromAttr
|
||||
import mozilla.components.support.ktx.android.util.dpToPx
|
||||
import org.mozilla.fenix.FeatureFlags
|
||||
import org.mozilla.fenix.R
|
||||
import org.mozilla.fenix.ext.settings
|
||||
import org.mozilla.fenix.search.SearchFragmentState
|
||||
|
@ -90,8 +83,6 @@ class ToolbarView(
|
|||
view.apply {
|
||||
editMode()
|
||||
|
||||
setScrollFlagsForTopToolbar()
|
||||
|
||||
elevation = TOOLBAR_ELEVATION_IN_DP.dpToPx(resources.displayMetrics).toFloat()
|
||||
|
||||
setOnUrlCommitListener {
|
||||
|
@ -184,29 +175,3 @@ class ToolbarView(
|
|||
private const val TOOLBAR_ELEVATION_IN_DP = 16
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Dynamically sets scroll flags for the top toolbar when the user does not have a screen reader enabled
|
||||
* Note that the bottom toolbar is currently fixed and will never have scroll flags set
|
||||
*/
|
||||
fun BrowserToolbar.setScrollFlagsForTopToolbar() {
|
||||
// Don't set scroll flags for bottom toolbar
|
||||
if (context.settings().shouldUseBottomToolbar) {
|
||||
if (FeatureFlags.dynamicBottomToolbar && layoutParams is CoordinatorLayout.LayoutParams) {
|
||||
(layoutParams as CoordinatorLayout.LayoutParams).apply {
|
||||
behavior = BrowserToolbarBottomBehavior(context, null)
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
val params = layoutParams as AppBarLayout.LayoutParams
|
||||
params.scrollFlags = when (context.settings().shouldUseFixedTopToolbar) {
|
||||
true -> 0
|
||||
false -> {
|
||||
SCROLL_FLAG_SCROLL or SCROLL_FLAG_ENTER_ALWAYS or SCROLL_FLAG_SNAP or
|
||||
SCROLL_FLAG_EXIT_UNTIL_COLLAPSED
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue