Loading app/src/main/java/org/mozilla/fenix/browser/BaseBrowserFragment.kt +3 −3 Original line number Diff line number Diff line Loading @@ -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) Loading app/src/main/java/org/mozilla/fenix/browser/BrowserFragment.kt +8 −10 Original line number Diff line number Diff line Loading @@ -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(), Loading @@ -83,7 +82,6 @@ class BrowserFragment : BaseBrowserFragment(), UserInteractionHandler { sessionManager = components.core.sessionManager ) ) } val readerModeAction = BrowserToolbar.ToggleButton( Loading app/src/main/java/org/mozilla/fenix/components/toolbar/BrowserToolbarView.kt +5 −14 Original line number Diff line number Diff line Loading @@ -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 -> { Loading @@ -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 Loading app/src/main/java/org/mozilla/fenix/settings/CustomizationFragment.kt +0 −17 Original line number Diff line number Diff line Loading @@ -51,7 +51,6 @@ class CustomizationFragment : PreferenceFragmentCompat() { setupRadioGroups() setupToolbarCategory() setupHomeCategory() setupGesturesCategory() } private fun setupRadioGroups() { Loading Loading @@ -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() } } } app/src/main/java/org/mozilla/fenix/utils/Settings.kt +0 −15 Original line number Diff line number Diff line Loading @@ -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
app/src/main/java/org/mozilla/fenix/browser/BaseBrowserFragment.kt +3 −3 Original line number Diff line number Diff line Loading @@ -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) Loading
app/src/main/java/org/mozilla/fenix/browser/BrowserFragment.kt +8 −10 Original line number Diff line number Diff line Loading @@ -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(), Loading @@ -83,7 +82,6 @@ class BrowserFragment : BaseBrowserFragment(), UserInteractionHandler { sessionManager = components.core.sessionManager ) ) } val readerModeAction = BrowserToolbar.ToggleButton( Loading
app/src/main/java/org/mozilla/fenix/components/toolbar/BrowserToolbarView.kt +5 −14 Original line number Diff line number Diff line Loading @@ -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 -> { Loading @@ -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 Loading
app/src/main/java/org/mozilla/fenix/settings/CustomizationFragment.kt +0 −17 Original line number Diff line number Diff line Loading @@ -51,7 +51,6 @@ class CustomizationFragment : PreferenceFragmentCompat() { setupRadioGroups() setupToolbarCategory() setupHomeCategory() setupGesturesCategory() } private fun setupRadioGroups() { Loading Loading @@ -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() } } }
app/src/main/java/org/mozilla/fenix/utils/Settings.kt +0 −15 Original line number Diff line number Diff line Loading @@ -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 ) }