aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/event/Event.java
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2014-03-14 04:29:58 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-03-14 04:29:59 +0000
commit5a1e351751deb67f5b11bd7b8c9b601d5bf653d9 (patch)
tree565f6388435e4dd60e3d495935fd51de62e23053 /java/src/com/android/inputmethod/event/Event.java
parenta9c1a3da63c83dd68424a0851079a55d110cc63a (diff)
parentf8accd8839d291f10b218e64aa6b8eb154c92c4c (diff)
downloadlatinime-5a1e351751deb67f5b11bd7b8c9b601d5bf653d9.tar.gz
latinime-5a1e351751deb67f5b11bd7b8c9b601d5bf653d9.tar.xz
latinime-5a1e351751deb67f5b11bd7b8c9b601d5bf653d9.zip
Merge "[CB04] Add an event array to WordComposer."
Diffstat (limited to 'java/src/com/android/inputmethod/event/Event.java')
-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);