Bug 2020810 - part 4 - Use a new setting for controlling if the feature is enabled r=android-reviewers,android-l10n-reviewers,flod,skhan

With this feature being worked on years ago we already had a setting for it
but unused until now.

Differential Revision: https://phabricator.services.mozilla.com/D286901
This commit is contained in:
Mugurell
2026-04-20 04:15:03 +00:00
committed by plingurar@mozilla.com
parent 4da4c05887
commit d726ae1db1
5 changed files with 23 additions and 12 deletions
@@ -245,15 +245,18 @@ class BrowserFragment : BaseBrowserFragment(), UserInteractionHandler, SystemIns
),
)
}
binding.gestureLayout.addGestureListener(
ToolbarVerticalGesturesHandler(
appStore = components.appStore,
toolbarLayout = browserToolbarView.layout,
navBarLayout = browserNavigationBar?.layout,
toolbarPosition = settings.toolbarPosition,
navController = findNavController(),
),
)
if (settings.isSwipeToolbarToShowTabsEnabled) {
binding.gestureLayout.addGestureListener(
ToolbarVerticalGesturesHandler(
appStore = components.appStore,
toolbarLayout = browserToolbarView.layout,
navBarLayout = browserNavigationBar?.layout,
toolbarPosition = settings.toolbarPosition,
navController = findNavController(),
),
)
}
}
private fun setupShakeDetection() {
@@ -336,6 +336,10 @@ class CustomizationFragment : PreferenceFragmentCompat(), SystemInsetsPaddedFrag
isVisible = isSwipeToolbarToSwitchTabsVisible
onPreferenceChangeListener = SharedPreferenceUpdater()
}
requirePreference<SwitchPreferenceCompat>(R.string.pref_key_swipe_toolbar_show_tabs).apply {
isChecked = context.settings().isSwipeToolbarToShowTabsEnabled
onPreferenceChangeListener = SharedPreferenceUpdater()
}
requirePreference<SwitchPreferenceCompat>(R.string.pref_key_shake_gesture_enabled).apply {
isVisible = context.settings().shakeToSummarizeFeatureFlagEnabled &&
isSummarizationEnabled
@@ -2120,6 +2120,11 @@ class Settings(
default = true,
)
var isSwipeToolbarToShowTabsEnabled by booleanPreference(
appContext.getPreferenceKey(R.string.pref_key_swipe_toolbar_show_tabs),
default = true,
)
/**
* Address Sync feature.
*/
@@ -1330,7 +1330,7 @@
<!-- Preference for using the dynamic toolbar -->
<string name="preference_gestures_dynamic_toolbar">Scroll to hide toolbar</string>
<!-- Preference for showing the opened tabs by swiping up on the toolbar-->
<string name="preference_gestures_swipe_toolbar_show_tabs">Swipe toolbar up to open tabs</string>
<string name="preference_gestures_swipe_toolbar_show_tabs_2">Swipe toolbar vertically to see open tabs</string>
<!-- Preference for switching tabs by swiping horizontally on the addressbar -->
<string name="preference_gestures_swipe_toolbar_switch_tabs_2">Swipe address bar sideways to switch tabs</string>
<!-- Preference for switching for the shake to summarize toggle in page summaries and customize settings -->
@@ -106,8 +106,7 @@
android:title="@string/preference_gestures_swipe_toolbar_switch_tabs_2" />
<androidx.preference.SwitchPreferenceCompat
android:key="@string/pref_key_swipe_toolbar_show_tabs"
android:title="@string/preference_gestures_swipe_toolbar_show_tabs"
app:isPreferenceVisible="false" />
android:title="@string/preference_gestures_swipe_toolbar_show_tabs_2" />
<androidx.preference.SwitchPreferenceCompat
android:key="@string/pref_key_shake_gesture_enabled"
android:title="@string/preferences_shake_to_summarize"