diff options
author | 2014-03-13 17:37:16 +0900 | |
---|---|---|
committer | 2014-03-14 12:44:49 +0900 | |
commit | f8accd8839d291f10b218e64aa6b8eb154c92c4c (patch) | |
tree | fb28ac4319eb6cc49791bb50cb9aedc9f6b32a69 /java/src/com/android/inputmethod/event | |
parent | 309773c322adb383a05cf673fd8d8a8339dcb076 (diff) | |
download | latinime-f8accd8839d291f10b218e64aa6b8eb154c92c4c.tar.gz latinime-f8accd8839d291f10b218e64aa6b8eb154c92c4c.tar.xz latinime-f8accd8839d291f10b218e64aa6b8eb154c92c4c.zip |
[CB04] Add an event array to WordComposer.
Bug: 13406701
Change-Id: I9ecd2709c8f1c678a85b0cfaf7c5ed4f78459821
Diffstat (limited to 'java/src/com/android/inputmethod/event')
-rw-r--r-- | java/src/com/android/inputmethod/event/Event.java | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/java/src/com/android/inputmethod/event/Event.java b/java/src/com/android/inputmethod/event/Event.java index a4a17e12d..ed487e13f 100644 --- a/java/src/com/android/inputmethod/event/Event.java +++ b/java/src/com/android/inputmethod/event/Event.java @@ -120,6 +120,34 @@ public class Event { FLAG_DEAD, next); } + /** + * Create an input event with nothing but a code point. This is the most basic possible input + * event; it contains no information on many things the IME requires to function correctly, + * so avoid using it unless really nothing is known about this input. + * @param codePoint the code point. + * @return an event for this code point. + */ + public static Event createEventForCodePointFromUnknownSource(final int codePoint) { + // TODO: should we have a different type of event for this? After all, it's not a key press. + return new Event(EVENT_INPUT_KEYPRESS, codePoint, NOT_A_KEY_CODE, + Constants.NOT_A_COORDINATE, Constants.NOT_A_COORDINATE, FLAG_NONE, null /* next */); + } + + /** + * Creates an input event with a code point and x, y coordinates. This is typically used when + * resuming a previously-typed word, when the coordinates are still known. + * @param codePoint the code point to input. + * @param x the X coordinate. + * @param y the Y coordinate. + * @return an event for this code point and coordinates. + */ + public static Event createEventForCodePointFromAlreadyTypedText(final int codePoint, + final int x, final int y) { + // TODO: should we have a different type of event for this? After all, it's not a key press. + return new Event(EVENT_INPUT_KEYPRESS, codePoint, NOT_A_KEY_CODE, x, y, FLAG_NONE, + null /* next */); + } + public static Event createNotHandledEvent() { return new Event(EVENT_NOT_HANDLED, NOT_A_CODE_POINT, NOT_A_KEY_CODE, Constants.NOT_A_COORDINATE, Constants.NOT_A_COORDINATE, FLAG_NONE, null); |