Unverified Commit 39d391c3 authored by ekager's avatar ekager Committed by GitHub
Browse files

Reverts Disabling Gestures from 81.1.1 (#15005)

* Revert "For #10240 - New preferences to control gesture based features"

This reverts commit d8d896c5.

* Revert "For #14902 - Disabling bottom toolbar animation now works (#14927)"

This reverts commit b54949e5.
parent 3520a075
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -658,9 +658,9 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session
                }
            }

            view.swipeRefresh.isEnabled =
                FeatureFlags.pullToRefreshEnabled && context.settings().isPullToRefreshEnabledInBrowser
            if (view.swipeRefresh.isEnabled) {
            view.swipeRefresh.isEnabled = FeatureFlags.pullToRefreshEnabled
            @Suppress("ConstantConditionIf")
            if (FeatureFlags.pullToRefreshEnabled) {
                val primaryTextColor =
                    ThemeManager.resolveAttribute(R.attr.primaryText, context)
                view.swipeRefresh.setColorSchemeColors(primaryTextColor)
+8 −10
Original line number Diff line number Diff line
@@ -73,7 +73,6 @@ class BrowserFragment : BaseBrowserFragment(), UserInteractionHandler {
        val components = context.components

        return super.initializeUI(view)?.also {
            if (context.settings().isSwipeToolbarToSwitchTabsEnabled) {
            gestureLayout.addGestureListener(
                ToolbarGestureHandler(
                    activity = requireActivity(),
@@ -83,7 +82,6 @@ class BrowserFragment : BaseBrowserFragment(), UserInteractionHandler {
                    sessionManager = components.core.sessionManager
                )
            )
            }

            val readerModeAction =
                BrowserToolbar.ToggleButton(
+5 −14
Original line number Diff line number Diff line
@@ -209,8 +209,7 @@ class BrowserToolbarView(
        when (settings.toolbarPosition) {
            ToolbarPosition.BOTTOM -> {
                (view.layoutParams as CoordinatorLayout.LayoutParams).apply {
                    // behavior can be null if the "Scroll to hide toolbar" setting is toggled off.
                    (behavior as? BrowserToolbarBottomBehavior)?.forceExpand(view)
                    (behavior as BrowserToolbarBottomBehavior).forceExpand(view)
                }
            }
            ToolbarPosition.TOP -> {
@@ -221,26 +220,18 @@ class BrowserToolbarView(

    /**
     * Dynamically sets scroll flags for the toolbar when the user does not have a screen reader enabled
     * Note that the toolbar will have the flags set and be able to be hidden
     * only if the user didn't disabled this behavior in app's settings.
     * Note that the bottom toolbar has a feature flag for being dynamic, so it may not get flags set.
     */
    fun setScrollFlags(shouldDisableScroll: Boolean = false) {
        when (settings.toolbarPosition) {
            ToolbarPosition.BOTTOM -> {
                if (settings.isDynamicToolbarEnabled) {
                (view.layoutParams as? CoordinatorLayout.LayoutParams)?.apply {
                    behavior = BrowserToolbarBottomBehavior(view.context, null)
                }
                } else {
                    expand()
                }
            }
            ToolbarPosition.TOP -> {
                view.updateLayoutParams<AppBarLayout.LayoutParams> {
                    scrollFlags =
                        if (settings.shouldUseFixedTopToolbar ||
                            !settings.isDynamicToolbarEnabled ||
                            shouldDisableScroll) {
                    scrollFlags = if (settings.shouldUseFixedTopToolbar || shouldDisableScroll) {
                        // Force expand the toolbar so the user is not stuck with a hidden toolbar
                        expand()
                        0
+0 −17
Original line number Diff line number Diff line
@@ -51,7 +51,6 @@ class CustomizationFragment : PreferenceFragmentCompat() {
        setupRadioGroups()
        setupToolbarCategory()
        setupHomeCategory()
        setupGesturesCategory()
    }

    private fun setupRadioGroups() {
@@ -145,20 +144,4 @@ class CustomizationFragment : PreferenceFragmentCompat() {
            onPreferenceChangeListener = SharedPreferenceUpdater()
        }
    }

    private fun setupGesturesCategory() {
        requirePreference<SwitchPreference>(R.string.pref_key_website_pull_to_refresh).apply {
            isVisible = FeatureFlags.pullToRefreshEnabled
            isChecked = context.settings().isPullToRefreshEnabledInBrowser
            onPreferenceChangeListener = SharedPreferenceUpdater()
        }
        requirePreference<SwitchPreference>(R.string.pref_key_dynamic_toolbar).apply {
            isChecked = context.settings().isDynamicToolbarEnabled
            onPreferenceChangeListener = SharedPreferenceUpdater()
        }
        requirePreference<SwitchPreference>(R.string.pref_key_swipe_toolbar_switch_tabs).apply {
            isChecked = context.settings().isSwipeToolbarToSwitchTabsEnabled
            onPreferenceChangeListener = SharedPreferenceUpdater()
        }
    }
}
+0 −15
Original line number Diff line number Diff line
@@ -893,19 +893,4 @@ class Settings(private val appContext: Context) : PreferencesHolder {
                    SavedLoginsSortingStrategyMenu.Item.LastUsedSort.strategyString
            }
        }

    var isPullToRefreshEnabledInBrowser by booleanPreference(
        appContext.getPreferenceKey(R.string.pref_key_website_pull_to_refresh),
        default = true
    )

    var isDynamicToolbarEnabled by booleanPreference(
        appContext.getPreferenceKey(R.string.pref_key_dynamic_toolbar),
        default = true
    )

    var isSwipeToolbarToSwitchTabsEnabled by booleanPreference(
        appContext.getPreferenceKey(R.string.pref_key_swipe_toolbar_switch_tabs),
        default = true
    )
}
Loading