Skip to content

Commit

Permalink
Update LatinIME.java
Browse files Browse the repository at this point in the history
  • Loading branch information
Helium314 authored Mar 11, 2024
1 parent 2e1c0bf commit bd2cdd6
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions app/src/main/java/helium314/keyboard/latin/LatinIME.java
Original file line number Diff line number Diff line change
Expand Up @@ -1390,10 +1390,9 @@ public boolean onCustomRequest(final int requestCode) {

@Override
public boolean onHorizontalSpaceSwipe(final int steps) {
String selectedValue = mSettings.getCurrent().mSpaceHorizontalSwipe;
// more options can be added later
return switch (selectedValue) {
case "move_cursor" -> onMoveCursorHorizontally(steps);
return switch (mSettings.getCurrent().mSpaceSwipeHorizontal) {
case KeyboardActionListener.SWIPE_MOVE_CURSOR -> onMoveCursorHorizontally(steps);
case KeyboardActionListener.SWIPE_SWITCH_LANGUAGE -> onLanguageSlide(steps);
default -> false;
};
}
Expand Down Expand Up @@ -1445,10 +1444,9 @@ private boolean onMoveCursorHorizontally(int steps) {

@Override
public boolean onVerticalSpaceSwipe(final int steps) {
String selectedValue = mSettings.getCurrent().mSpaceVerticalSwipe;
return switch (selectedValue) {
case "move_cursor" -> onMoveCursorVertically(steps);
case "switch_language" -> onLanguageSlide(steps);
return switch (mSettings.getCurrent().mSpaceSwipeVertical) {
case KeyboardActionListener.SWIPE_MOVE_CURSOR -> onMoveCursorVertically(steps);
case KeyboardActionListener.SWIPE_SWITCH_LANGUAGE -> onLanguageSlide(steps);
default -> false;
};
}
Expand All @@ -1470,7 +1468,7 @@ private boolean onLanguageSlide(final int steps) {

private boolean onMoveCursorVertically(int steps) {
if (steps == 0) return false;
int code = (steps < 0) ? Constants.CODE_UP : Constants.CODE_DOWN;
int code = (steps < 0) ? KeyCode.ARROW_UP : KeyCode.ARROW_DOWN;
onCodeInput(code, Constants.NOT_A_COORDINATE, Constants.NOT_A_COORDINATE, false);
return true;
}
Expand Down

0 comments on commit bd2cdd6

Please sign in to comment.