For #8775: Removes feature flag for dynamic bottom toolbar
parent
5200e00c4c
commit
27c7ef5ad4
|
@ -20,11 +20,6 @@ object FeatureFlags {
|
|||
*/
|
||||
const val asFeatureSyncDisabled = false
|
||||
|
||||
/**
|
||||
* Enables dynamic bottom toolbar
|
||||
*/
|
||||
val dynamicBottomToolbar = Config.channel.isNightlyOrDebug
|
||||
|
||||
/**
|
||||
* Integration of push support provided by `feature-push` component into the Gecko engine.
|
||||
*
|
||||
|
|
|
@ -611,21 +611,15 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session
|
|||
}
|
||||
|
||||
private fun initializeEngineView(toolbarHeight: Int) {
|
||||
if (FeatureFlags.dynamicBottomToolbar) {
|
||||
engineView.setDynamicToolbarMaxHeight(toolbarHeight)
|
||||
engineView.setDynamicToolbarMaxHeight(toolbarHeight)
|
||||
|
||||
val behavior = if (requireContext().settings().shouldUseBottomToolbar) {
|
||||
EngineViewBottomBehavior(context, null)
|
||||
} else {
|
||||
SwipeRefreshScrollingViewBehavior(requireContext(), null, engineView, browserToolbarView)
|
||||
}
|
||||
|
||||
(swipeRefresh.layoutParams as CoordinatorLayout.LayoutParams).behavior = behavior
|
||||
val behavior = if (requireContext().settings().shouldUseBottomToolbar) {
|
||||
EngineViewBottomBehavior(context, null)
|
||||
} else {
|
||||
if (!requireContext().settings().shouldUseBottomToolbar) {
|
||||
engineView.setDynamicToolbarMaxHeight(toolbarHeight)
|
||||
}
|
||||
SwipeRefreshScrollingViewBehavior(requireContext(), null, engineView, browserToolbarView)
|
||||
}
|
||||
|
||||
(swipeRefresh.layoutParams as CoordinatorLayout.LayoutParams).behavior = behavior
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -771,35 +765,12 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session
|
|||
|
||||
protected abstract fun navToTrackingProtectionPanel(session: Session)
|
||||
|
||||
/**
|
||||
* Returns the top and bottom margins.
|
||||
*/
|
||||
private fun getEngineMargins(): Pair<Int, Int> =
|
||||
if (context?.settings()?.shouldUseBottomToolbar == true) {
|
||||
val toolbarSize = resources.getDimensionPixelSize(R.dimen.browser_toolbar_height)
|
||||
0 to toolbarSize
|
||||
} else {
|
||||
0 to 0
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the layout [android.view.Gravity] for the quick settings and ETP dialog.
|
||||
*/
|
||||
protected fun getAppropriateLayoutGravity(): Int =
|
||||
if (context?.settings()?.shouldUseBottomToolbar == true) Gravity.BOTTOM else Gravity.TOP
|
||||
|
||||
protected fun updateLayoutMargins(inFullScreen: Boolean) {
|
||||
view?.swipeRefresh?.apply {
|
||||
val (topMargin, bottomMargin) = if (inFullScreen) 0 to 0 else getEngineMargins()
|
||||
(layoutParams as CoordinatorLayout.LayoutParams).setMargins(
|
||||
0,
|
||||
topMargin,
|
||||
0,
|
||||
bottomMargin
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the site permissions rules based on user settings.
|
||||
*/
|
||||
|
@ -942,25 +913,18 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session
|
|||
activity?.enterToImmersiveMode()
|
||||
browserToolbarView.view.visibility = View.GONE
|
||||
|
||||
if (FeatureFlags.dynamicBottomToolbar) {
|
||||
engineView.setDynamicToolbarMaxHeight(0)
|
||||
browserToolbarView.expand()
|
||||
// Without this, fullscreen has a margin at the top.
|
||||
engineView.setVerticalClipping(0)
|
||||
}
|
||||
engineView.setDynamicToolbarMaxHeight(0)
|
||||
browserToolbarView.expand()
|
||||
// Without this, fullscreen has a margin at the top.
|
||||
engineView.setVerticalClipping(0)
|
||||
} else {
|
||||
activity?.exitImmersiveModeIfNeeded()
|
||||
(activity as? HomeActivity)?.let { activity ->
|
||||
activity.themeManager.applyStatusBarTheme(activity)
|
||||
}
|
||||
browserToolbarView.view.visibility = View.VISIBLE
|
||||
if (FeatureFlags.dynamicBottomToolbar) {
|
||||
val toolbarHeight = resources.getDimensionPixelSize(R.dimen.browser_toolbar_height)
|
||||
engineView.setDynamicToolbarMaxHeight(toolbarHeight)
|
||||
}
|
||||
}
|
||||
if (!FeatureFlags.dynamicBottomToolbar) {
|
||||
updateLayoutMargins(inFullScreen)
|
||||
val toolbarHeight = resources.getDimensionPixelSize(R.dimen.browser_toolbar_height)
|
||||
engineView.setDynamicToolbarMaxHeight(toolbarHeight)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@ import android.view.LayoutInflater
|
|||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.appcompat.content.res.AppCompatResources
|
||||
import androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.lifecycle.Observer
|
||||
import androidx.navigation.fragment.findNavController
|
||||
|
@ -31,7 +30,6 @@ import mozilla.components.feature.tab.collections.TabCollection
|
|||
import mozilla.components.feature.tabs.WindowFeature
|
||||
import mozilla.components.support.base.feature.UserInteractionHandler
|
||||
import mozilla.components.support.base.feature.ViewBoundFeatureWrapper
|
||||
import org.mozilla.fenix.FeatureFlags
|
||||
import org.mozilla.fenix.HomeActivity
|
||||
import org.mozilla.fenix.R
|
||||
import org.mozilla.fenix.addons.runIfFragmentIsAttached
|
||||
|
@ -177,16 +175,6 @@ class BrowserFragment : BaseBrowserFragment(), UserInteractionHandler {
|
|||
}
|
||||
|
||||
private fun updateEngineBottomMargin() {
|
||||
if (!FeatureFlags.dynamicBottomToolbar) {
|
||||
val browserEngine = swipeRefresh.layoutParams as CoordinatorLayout.LayoutParams
|
||||
|
||||
browserEngine.bottomMargin = if (requireContext().settings().shouldUseBottomToolbar) {
|
||||
requireContext().resources.getDimensionPixelSize(R.dimen.browser_toolbar_height)
|
||||
} else {
|
||||
0
|
||||
}
|
||||
}
|
||||
|
||||
val toolbarSessionObserver = TrackingProtectionOverlay(
|
||||
context = requireContext(),
|
||||
settings = requireContext().settings()
|
||||
|
|
|
@ -17,7 +17,6 @@ import com.google.android.material.snackbar.BaseTransientBottomBar
|
|||
import com.google.android.material.snackbar.ContentViewCallback
|
||||
import com.google.android.material.snackbar.Snackbar
|
||||
import kotlinx.android.synthetic.main.fenix_snackbar.view.*
|
||||
import org.mozilla.fenix.FeatureFlags
|
||||
import org.mozilla.fenix.R
|
||||
import org.mozilla.fenix.ext.increaseTapArea
|
||||
import org.mozilla.fenix.ext.settings
|
||||
|
@ -137,7 +136,7 @@ class FenixSnackbar private constructor(
|
|||
// can't intelligently position the snackbar on the upper most view.
|
||||
// Ideally we should not pass ContentFrameLayout in, but it's the only
|
||||
// way to display snackbars through a fragment transition.
|
||||
(!FeatureFlags.dynamicBottomToolbar || view is ContentFrameLayout)
|
||||
view is ContentFrameLayout
|
||||
) {
|
||||
toolbarHeight
|
||||
} else {
|
||||
|
|
|
@ -34,7 +34,6 @@ 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
|
||||
|
@ -260,7 +259,7 @@ class BrowserToolbarView(
|
|||
}
|
||||
|
||||
fun expand() {
|
||||
if (settings.shouldUseBottomToolbar && FeatureFlags.dynamicBottomToolbar) {
|
||||
if (settings.shouldUseBottomToolbar) {
|
||||
(view.layoutParams as CoordinatorLayout.LayoutParams).apply {
|
||||
(behavior as BrowserToolbarBottomBehavior).forceExpand(view)
|
||||
}
|
||||
|
@ -275,7 +274,7 @@ class BrowserToolbarView(
|
|||
*/
|
||||
fun setScrollFlags(shouldDisableScroll: Boolean = false) {
|
||||
if (view.context.settings().shouldUseBottomToolbar) {
|
||||
if (FeatureFlags.dynamicBottomToolbar && view.layoutParams is CoordinatorLayout.LayoutParams) {
|
||||
if (view.layoutParams is CoordinatorLayout.LayoutParams) {
|
||||
(view.layoutParams as CoordinatorLayout.LayoutParams).apply {
|
||||
behavior = BrowserToolbarBottomBehavior(view.context, null)
|
||||
}
|
||||
|
|
|
@ -14,7 +14,6 @@ import mozilla.components.browser.toolbar.display.DisplayToolbar
|
|||
import mozilla.components.feature.customtabs.CustomTabsToolbarFeature
|
||||
import mozilla.components.support.base.feature.LifecycleAwareFeature
|
||||
import mozilla.components.support.base.feature.UserInteractionHandler
|
||||
import org.mozilla.fenix.FeatureFlags
|
||||
import org.mozilla.fenix.R
|
||||
import org.mozilla.fenix.components.toolbar.ToolbarMenu
|
||||
import org.mozilla.fenix.ext.settings
|
||||
|
@ -34,13 +33,11 @@ class CustomTabsIntegration(
|
|||
// Remove toolbar shadow
|
||||
toolbar.elevation = 0f
|
||||
|
||||
if (!FeatureFlags.dynamicBottomToolbar) {
|
||||
// Reduce margin height of EngineView from the top for the toolbar
|
||||
engineLayout.run {
|
||||
(layoutParams as ViewGroup.MarginLayoutParams).apply {
|
||||
val toolbarHeight = resources.getDimension(R.dimen.browser_toolbar_height).toInt()
|
||||
setMargins(0, toolbarHeight, 0, 0)
|
||||
}
|
||||
// Reduce margin height of EngineView from the top for the toolbar
|
||||
engineLayout.run {
|
||||
(layoutParams as ViewGroup.MarginLayoutParams).apply {
|
||||
val toolbarHeight = resources.getDimension(R.dimen.browser_toolbar_height).toInt()
|
||||
setMargins(0, toolbarHeight, 0, 0)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,6 @@ import mozilla.components.support.base.feature.UserInteractionHandler
|
|||
import mozilla.components.support.base.feature.ViewBoundFeatureWrapper
|
||||
import mozilla.components.support.ktx.android.arch.lifecycle.addObservers
|
||||
import org.mozilla.fenix.BuildConfig
|
||||
import org.mozilla.fenix.FeatureFlags
|
||||
import org.mozilla.fenix.R
|
||||
import org.mozilla.fenix.browser.BaseBrowserFragment
|
||||
import org.mozilla.fenix.browser.CustomTabContextMenuCandidate
|
||||
|
@ -106,7 +105,6 @@ class ExternalAppBrowserFragment : BaseBrowserFragment(), UserInteractionHandler
|
|||
trustedScopes
|
||||
) { toolbarVisible ->
|
||||
if (!toolbarVisible) { engineView.setDynamicToolbarMaxHeight(0) }
|
||||
if (!FeatureFlags.dynamicBottomToolbar) { updateLayoutMargins(inFullScreen = !toolbarVisible) }
|
||||
},
|
||||
owner = this,
|
||||
view = toolbar
|
||||
|
|
|
@ -12,7 +12,6 @@ import kotlinx.android.synthetic.main.download_dialog_layout.view.*
|
|||
import mozilla.components.browser.state.state.content.DownloadState
|
||||
import mozilla.components.feature.downloads.AbstractFetchDownloadService
|
||||
import mozilla.components.feature.downloads.toMegabyteString
|
||||
import org.mozilla.fenix.FeatureFlags
|
||||
import org.mozilla.fenix.R
|
||||
import org.mozilla.fenix.components.metrics.Event
|
||||
import org.mozilla.fenix.ext.metrics
|
||||
|
@ -47,7 +46,7 @@ class DynamicDownloadDialog(
|
|||
private fun setupDownloadDialog(view: View) {
|
||||
if (downloadState == null) return
|
||||
view.apply {
|
||||
if (FeatureFlags.dynamicBottomToolbar && layoutParams is CoordinatorLayout.LayoutParams) {
|
||||
if (layoutParams is CoordinatorLayout.LayoutParams) {
|
||||
(layoutParams as CoordinatorLayout.LayoutParams).apply {
|
||||
|
||||
behavior =
|
||||
|
@ -126,10 +125,8 @@ class DynamicDownloadDialog(
|
|||
fun show() {
|
||||
view.visibility = View.VISIBLE
|
||||
|
||||
if (FeatureFlags.dynamicBottomToolbar) {
|
||||
(view.layoutParams as CoordinatorLayout.LayoutParams).apply {
|
||||
(behavior as DynamicDownloadDialogBehavior).forceExpand(view)
|
||||
}
|
||||
(view.layoutParams as CoordinatorLayout.LayoutParams).apply {
|
||||
(behavior as DynamicDownloadDialogBehavior).forceExpand(view)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue