diff --git a/app/src/main/java/helium314/keyboard/latin/settings/Settings.java b/app/src/main/java/helium314/keyboard/latin/settings/Settings.java index 9a70661c6..f9ab36310 100644 --- a/app/src/main/java/helium314/keyboard/latin/settings/Settings.java +++ b/app/src/main/java/helium314/keyboard/latin/settings/Settings.java @@ -26,6 +26,7 @@ import androidx.core.content.ContextCompat; import androidx.preference.PreferenceManager; +import helium314.keyboard.keyboard.KeyboardActionListener; import helium314.keyboard.keyboard.KeyboardTheme; import helium314.keyboard.keyboard.internal.keyboard_parser.LocaleKeyboardInfosKt; import helium314.keyboard.latin.AudioAndHapticFeedbackManager; @@ -98,8 +99,8 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang public static final String PREF_SPLIT_SPACER_SCALE = "split_spacer_scale"; public static final String PREF_KEYBOARD_HEIGHT_SCALE = "keyboard_height_scale"; public static final String PREF_BOTTOM_PADDING_SCALE = "bottom_padding_scale"; - public static final String PREF_SPACE_HORIZONTAL_SWIPE = "horizontal_space_swipe_gesture_key"; - public static final String PREF_SPACE_VERTICAL_SWIPE = "vertical_space_swipe_gesture_key"; + public static final String PREF_SPACE_HORIZONTAL_SWIPE = "horizontal_space_swipe"; + public static final String PREF_SPACE_VERTICAL_SWIPE = "vertical_space_swipe"; public static final String PREF_DELETE_SWIPE = "delete_swipe"; public static final String PREF_AUTOSPACE_AFTER_PUNCTUATION = "autospace_after_punctuation"; public static final String PREF_ALWAYS_INCOGNITO_MODE = "always_incognito_mode"; @@ -384,12 +385,20 @@ public static int readDefaultClipboardHistoryRetentionTime(final Resources res) return res.getInteger(R.integer.config_clipboard_history_retention_time); } - public static String readHorizontalSpaceSwipe(final SharedPreferences prefs) { - return prefs.getString(PREF_SPACE_HORIZONTAL_SWIPE, "None"); + public static int readHorizontalSpaceSwipe(final SharedPreferences prefs) { + return switch (prefs.getString(PREF_SPACE_HORIZONTAL_SWIPE, "none")) { + case "move_cursor" -> KeyboardActionListener.SWIPE_MOVE_CURSOR; + case "switch_language" -> KeyboardActionListener.SWIPE_SWITCH_LANGUAGE; + default -> KeyboardActionListener.SWIPE_NO_ACTION; + }; } - public static String readVerticalSpaceSwipe(final SharedPreferences prefs) { - return prefs.getString(PREF_SPACE_VERTICAL_SWIPE, "None"); + public static int readVerticalSpaceSwipe(final SharedPreferences prefs) { + return switch (prefs.getString(PREF_SPACE_VERTICAL_SWIPE, "none")) { + case "move_cursor" -> KeyboardActionListener.SWIPE_MOVE_CURSOR; + case "switch_language" -> KeyboardActionListener.SWIPE_SWITCH_LANGUAGE; + default -> KeyboardActionListener.SWIPE_NO_ACTION; + }; } public static boolean readDeleteSwipeEnabled(final SharedPreferences prefs) {