diff options
author | 2014-08-01 14:15:33 +0900 | |
---|---|---|
committer | 2014-08-04 12:41:07 +0900 | |
commit | e0bad8e988a23553181fb670f8a2589a79f22c40 (patch) | |
tree | 6130ed94671d88523622f775d3e0b1cf773ec0e2 /java/src/com/android/inputmethod/event/CombinerChain.java | |
parent | c4696b2eb6b25eea4d5c869683104ab99aec0421 (diff) | |
download | latinime-e0bad8e988a23553181fb670f8a2589a79f22c40.tar.gz latinime-e0bad8e988a23553181fb670f8a2589a79f22c40.tar.xz latinime-e0bad8e988a23553181fb670f8a2589a79f22c40.zip |
[HW12] Use the consumed status of the Event.
Change-Id: I1619f6132f8f71bc1291fd6a5604a5e1e3431ae2
Diffstat (limited to 'java/src/com/android/inputmethod/event/CombinerChain.java')
-rw-r--r-- | java/src/com/android/inputmethod/event/CombinerChain.java | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/java/src/com/android/inputmethod/event/CombinerChain.java b/java/src/com/android/inputmethod/event/CombinerChain.java index f69bf4fd0..2d2731f21 100644 --- a/java/src/com/android/inputmethod/event/CombinerChain.java +++ b/java/src/com/android/inputmethod/event/CombinerChain.java @@ -82,6 +82,13 @@ public class CombinerChain { } } + private void updateStateFeedback() { + mStateFeedback.clear(); + for (int i = mCombiners.size() - 1; i >= 0; --i) { + mStateFeedback.append(mCombiners.get(i).getCombiningStateFeedback()); + } + } + /** * Process an event through the combining chain, and return a processed event to apply. * @param previousEvents the list of previous events in this composition @@ -97,7 +104,13 @@ public class CombinerChain { // A combiner can never return more than one event; it can return several // code points, but they should be encapsulated within one event. event = combiner.processEvent(modifiablePreviousEvents, event); + if (event.isConsumed()) { + // If the event is consumed, then we don't pass it to subsequent combiners: + // they should not see it at all. + break; + } } + updateStateFeedback(); return event; } @@ -121,10 +134,7 @@ public class CombinerChain { } } } - mStateFeedback.clear(); - for (int i = mCombiners.size() - 1; i >= 0; --i) { - mStateFeedback.append(mCombiners.get(i).getCombiningStateFeedback()); - } + updateStateFeedback(); } /** |