Skip to content

Commit

Permalink
Update Settings.java
Browse files Browse the repository at this point in the history
  • Loading branch information
Helium314 authored Mar 11, 2024
1 parent bd2cdd6 commit 13e9626
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions app/src/main/java/helium314/keyboard/latin/settings/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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";
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 13e9626

Please sign in to comment.