diff options
author | 2014-07-30 04:13:26 +0000 | |
---|---|---|
committer | 2014-07-24 16:04:26 +0000 | |
commit | 0f6807bfb44ca82e224921af1f16f18cdaa8b4e1 (patch) | |
tree | d2a36bd74683e29dcdd3f2cae9fd1766c8be3293 /java/src/com/android/inputmethod/event/Event.java | |
parent | bf2a32100568a01d25edb56d3d9d46b5f5d2c0eb (diff) | |
parent | 8e38b12e9ccc48bcb18b2eeec4d53d19cf7a29c9 (diff) | |
download | latinime-0f6807bfb44ca82e224921af1f16f18cdaa8b4e1.tar.gz latinime-0f6807bfb44ca82e224921af1f16f18cdaa8b4e1.tar.xz latinime-0f6807bfb44ca82e224921af1f16f18cdaa8b4e1.zip |
Merge "[HW7] Introduce consumed events" into lmp-dev
Diffstat (limited to 'java/src/com/android/inputmethod/event/Event.java')
-rw-r--r-- | java/src/com/android/inputmethod/event/Event.java | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/java/src/com/android/inputmethod/event/Event.java b/java/src/com/android/inputmethod/event/Event.java index d257441e0..98c827423 100644 --- a/java/src/com/android/inputmethod/event/Event.java +++ b/java/src/com/android/inputmethod/event/Event.java @@ -67,6 +67,8 @@ public class Event { final private static int FLAG_DEAD = 0x1; // This event is coming from a key repeat, software or hardware. final private static int FLAG_REPEAT = 0x2; + // This event has already been consumed. + final private static int FLAG_CONSUMED = 0x4; final private int mEventType; // The type of event - one of the constants above // The code point associated with the event, if relevant. This is a unicode code point, and @@ -219,6 +221,17 @@ public class Event { null /* next */); } + /** + * Creates an event identical to the passed event, but that has already been consumed. + * @param source the event to copy the properties of. + * @return an identical event marked as consumed. + */ + public static Event createConsumedEvent(final Event source) { + return new Event(source.mEventType, source.mText, source.mCodePoint, source.mKeyCode, + source.mX, source.mY, source.mSuggestedWordInfo, source.mFlags | FLAG_CONSUMED, + source.mNextEvent); + } + public static Event createNotHandledEvent() { return new Event(EVENT_TYPE_NOT_HANDLED, null /* text */, NOT_A_CODE_POINT, NOT_A_KEY_CODE, Constants.NOT_A_COORDINATE, Constants.NOT_A_COORDINATE, @@ -241,6 +254,8 @@ public class Event { return 0 != (FLAG_REPEAT & mFlags); } + public boolean isConsumed() { return 0 != (FLAG_CONSUMED & mFlags); } + // Returns whether this is a fake key press from the suggestion strip. This happens with // punctuation signs selected from the suggestion strip. public boolean isSuggestionStripPress() { |