diff options
| author | juloo | 2015-08-01 21:36:40 +0200 |
|---|---|---|
| committer | juloo | 2015-08-01 21:36:40 +0200 |
| commit | 349f0bee6fc203975aeb3dc1f6324cc5f671265e (patch) | |
| tree | 1a3327db80427bac9e9f596b6c14de08d91d03d7 /srcs/juloo.keyboard2/Keyboard2.java | |
| parent | 3b7141e3a05e44a907ab403ec5de52a1ad988224 (diff) | |
| download | unexpected-keyboard-349f0bee6fc203975aeb3dc1f6324cc5f671265e.tar.gz unexpected-keyboard-349f0bee6fc203975aeb3dc1f6324cc5f671265e.zip | |
Send keys to the application
Diffstat (limited to 'srcs/juloo.keyboard2/Keyboard2.java')
| -rw-r--r-- | srcs/juloo.keyboard2/Keyboard2.java | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/srcs/juloo.keyboard2/Keyboard2.java b/srcs/juloo.keyboard2/Keyboard2.java index 38a9294..ce2f011 100644 --- a/srcs/juloo.keyboard2/Keyboard2.java +++ b/srcs/juloo.keyboard2/Keyboard2.java @@ -27,9 +27,26 @@ public class Keyboard2 extends InputMethodService return (_inputView); } - public void handleKey(KeyValue key) + public void handleKeyUp(KeyValue key) { - Keyboard2.log("Key up " + key.getName()); + int eventCode = key.getEventCode(); + + switch (eventCode) + { + case KeyValue.EVENT_NONE: + sendKeyChar(key.getChar()); + break ; + case KeyValue.EVENT_DELETE: + getCurrentInputConnection().deleteSurroundingText(0, 1); + break ; + case KeyValue.EVENT_BACKSPACE: + getCurrentInputConnection().deleteSurroundingText(1, 0); + break ; + default: + getCurrentInputConnection().sendKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, eventCode)); + getCurrentInputConnection().sendKeyEvent(new KeyEvent(KeyEvent.ACTION_UP, eventCode)); + break ; + } } public static void log(String str) |
