Move icon swipe gestures to experimental features

Fixes #5297
Closes #5451
This commit is contained in:
SuperDragonXD
2025-05-12 16:06:47 +08:00
parent ca70a6be93
commit 9f874617ef
5 changed files with 16 additions and 2 deletions

View File

@@ -792,4 +792,6 @@
<string name="allapps_use_web_suggestion_icon_label">Show web suggestion provider icon in search bar</string>
<string name="allapps_match_qsb_style_label">Match dock search bar actions</string>
<string name="allapps_match_qsb_style_description">Clicking the dock search bar will now open the app drawer search UI</string>
<string name="icon_swipe_gestures">Icon swipe gestures</string>
<string name="icon_swipe_gestures_description">Perform acttions when swiping left or right on icons instead of moving the home screen</string>
</resources>

View File

@@ -172,7 +172,7 @@ fun CustomizeAppDialog(
)
}
if (context.launcher.stateManager.state != LauncherState.ALL_APPS) {
if (preferenceManager2.iconSwipeGestures.asState().value && context.launcher.stateManager.state != LauncherState.ALL_APPS) {
PreferenceGroup(heading = stringResource(R.string.gestures_label)) {
listOf(
GestureType.SWIPE_LEFT,

View File

@@ -670,6 +670,11 @@ class PreferenceManager2 private constructor(private val context: Context) :
onSet = { reloadHelper.reloadGrid() },
)
val iconSwipeGestures = preference(
key = booleanPreferencesKey(name = "icon_swipe_gestures"),
defaultValue = false,
)
val doubleTapGestureHandler = serializablePreference<GestureHandlerConfig>(
key = stringPreferencesKey("double_tap_gesture_handler"),
defaultValue = GestureHandlerConfig.Sleep,

View File

@@ -46,6 +46,11 @@ fun ExperimentalFeaturesPreferences(
label = stringResource(id = R.string.always_reload_icons_label),
description = stringResource(id = R.string.always_reload_icons_description),
)
SwitchPreference(
adapter = prefs2.iconSwipeGestures.getAdapter(),
label = stringResource(R.string.icon_swipe_gestures),
description = stringResource(R.string.icon_swipe_gestures_description),
)
val enableWallpaperBlur = prefs.enableWallpaperBlur.getAdapter()

View File

@@ -1208,7 +1208,9 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>
public boolean onInterceptTouchEvent(MotionEvent ev) {
if (ev.getAction() == MotionEvent.ACTION_DOWN) {
View touchedView = findViewAtPosition(ev.getX(), ev.getY());
if (touchedView instanceof ShortcutAndWidgetContainer container) {
Boolean iconSwipeGestures = PreferenceExtensionsKt.firstBlocking(mPreferenceManager2.getIconSwipeGestures());
if (iconSwipeGestures && touchedView instanceof ShortcutAndWidgetContainer container) {
container.onTouchEvent(ev);
return false;
}