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