diff options
author | 2014-03-20 01:40:07 -0700 | |
---|---|---|
committer | 2014-03-20 01:40:07 -0700 | |
commit | b125f451c21630e0cb2d668493763bc3a2244d9c (patch) | |
tree | 88ef7e0ca857758c6c2ca80260234004211e7365 /java/src/com/android/inputmethod/event/CombinerChain.java | |
parent | 14dc103e6e8c60e1ae87f1f1fdabd100937ba546 (diff) | |
parent | 83372e75e4fc030e77de470e08cf7012436c759a (diff) | |
download | latinime-b125f451c21630e0cb2d668493763bc3a2244d9c.tar.gz latinime-b125f451c21630e0cb2d668493763bc3a2244d9c.tar.xz latinime-b125f451c21630e0cb2d668493763bc3a2244d9c.zip |
am 83372e75: Merge "[CB09] Pass events through the combiner chain"
* commit '83372e75e4fc030e77de470e08cf7012436c759a':
[CB09] Pass events through the combiner chain
Diffstat (limited to 'java/src/com/android/inputmethod/event/CombinerChain.java')
-rw-r--r-- | java/src/com/android/inputmethod/event/CombinerChain.java | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/java/src/com/android/inputmethod/event/CombinerChain.java b/java/src/com/android/inputmethod/event/CombinerChain.java index 1deaed68f..0e01c819a 100644 --- a/java/src/com/android/inputmethod/event/CombinerChain.java +++ b/java/src/com/android/inputmethod/event/CombinerChain.java @@ -51,4 +51,19 @@ public class CombinerChain { // The dead key combiner is always active, and always first mCombiners.add(new DeadKeyCombiner()); } + + // Pass a new event through the whole chain. + public void processEvent(final ArrayList<Event> previousEvents, final Event newEvent) { + final ArrayList<Event> modifiablePreviousEvents = new ArrayList<Event>(previousEvents); + Event event = newEvent; + for (final Combiner combiner : mCombiners) { + // 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 (null == event) { + // Combiners return null if they eat the event. + return; + } + } + } } |