diff options
author | 2014-03-18 11:09:41 +0900 | |
---|---|---|
committer | 2014-03-20 16:59:29 +0900 | |
commit | f2bb15b0ab212e1ef45be2d2ea6610cfa9c9f15c (patch) | |
tree | ce85ba137ea3f8b9b681d5e000241eddad78967d /java/src/com/android/inputmethod/event/CombinerChain.java | |
parent | 7ede642df417c0f732573f639970b138f0bee18c (diff) | |
download | latinime-f2bb15b0ab212e1ef45be2d2ea6610cfa9c9f15c.tar.gz latinime-f2bb15b0ab212e1ef45be2d2ea6610cfa9c9f15c.tar.xz latinime-f2bb15b0ab212e1ef45be2d2ea6610cfa9c9f15c.zip |
[CB09] Pass events through the combiner chain
Bug: 13406701
Change-Id: I4696f145478afdd132314b7d3c148c3a9ca11c9c
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; + } + } + } } |