Skip to content

Commit

Permalink
feat: Use a list instead of too much condition check
Browse files Browse the repository at this point in the history
  • Loading branch information
frknkrc44 committed Sep 9, 2024
1 parent dc0fa37 commit 8187bc5
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions app/src/main/java/org/blinksd/board/views/SuperBoard.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ public class SuperBoard extends FrameLayout implements OnTouchListener {
private boolean shiftDetect = true;
private boolean enforcedShiftDetect = true;
private final ListedMap<String, String> specialCases = new ListedMap<>();
private final List<Integer> enforcedShiftRestrictedEvents = Arrays.asList(
KEYCODE_TOGGLE_CTRL,
KEYCODE_TOGGLE_ALT,
Keyboard.KEYCODE_SHIFT
);

// key states
private int ctrl = 0;
Expand Down Expand Up @@ -538,9 +543,7 @@ private void defaultKeyboardEvent(Key v) {
playSound(currentKey.first);

if (getEnforcedShiftDetection() &&
currentKey.first != KEYCODE_TOGGLE_CTRL &&
currentKey.first != KEYCODE_TOGGLE_ALT &&
currentKey.first != Keyboard.KEYCODE_SHIFT) {
!enforcedShiftRestrictedEvents.contains(currentKey.first)) {
updateKeyState();
}
} else {
Expand Down

0 comments on commit 8187bc5

Please sign in to comment.