aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/event/Event.java
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2014-03-13 21:31:29 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2014-03-13 21:31:29 -0700
commitc933ca91ff60a1a36a25e880f50ab18dc92ba7e0 (patch)
tree565f6388435e4dd60e3d495935fd51de62e23053 /java/src/com/android/inputmethod/event/Event.java
parente6b0cf2a28cbdd103f81b966e5165466d63d4217 (diff)
parent5a1e351751deb67f5b11bd7b8c9b601d5bf653d9 (diff)
downloadlatinime-c933ca91ff60a1a36a25e880f50ab18dc92ba7e0.tar.gz
latinime-c933ca91ff60a1a36a25e880f50ab18dc92ba7e0.tar.xz
latinime-c933ca91ff60a1a36a25e880f50ab18dc92ba7e0.zip
am 5a1e3517: Merge "[CB04] Add an event array to WordComposer."
* commit '5a1e351751deb67f5b11bd7b8c9b601d5bf653d9': [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);