Skip to content

Commit

Permalink
log keypress events from numeric keys
Browse files Browse the repository at this point in the history
  • Loading branch information
fabOnReact committed Jun 3, 2020
1 parent 976f51a commit bd52916
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,14 @@ public boolean deleteSurroundingText(int beforeLength, int afterLength) {
@Override
public boolean sendKeyEvent(KeyEvent event) {
if (event.getAction() == KeyEvent.ACTION_DOWN) {
boolean isNumberKey = event.getUnicodeChar() < 56 &&
event.getUnicodeChar() > 47;
if (event.getKeyCode() == KeyEvent.KEYCODE_DEL) {
dispatchKeyEvent(BACKSPACE_KEY_VALUE);
} else if (event.getKeyCode() == KeyEvent.KEYCODE_ENTER) {
dispatchKeyEvent(ENTER_KEY_VALUE);
} else if (isNumberKey) {
dispatchKeyEvent(String.valueOf(event.getNumber()));
}
}
return super.sendKeyEvent(event);
Expand Down

0 comments on commit bd52916

Please sign in to comment.