aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/event
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2014-03-13 17:37:16 +0900
committerJean Chalard <jchalard@google.com>2014-03-14 12:44:49 +0900
commitf8accd8839d291f10b218e64aa6b8eb154c92c4c (patch)
treefb28ac4319eb6cc49791bb50cb9aedc9f6b32a69 /java/src/com/android/inputmethod/event
parent309773c322adb383a05cf673fd8d8a8339dcb076 (diff)
downloadlatinime-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.java28
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);