diff options
Diffstat (limited to 'java/src/com/android/inputmethod/event/EventInterpreter.java')
-rw-r--r-- | java/src/com/android/inputmethod/event/EventInterpreter.java | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/java/src/com/android/inputmethod/event/EventInterpreter.java b/java/src/com/android/inputmethod/event/EventInterpreter.java index f9185788e..6efe899bb 100644 --- a/java/src/com/android/inputmethod/event/EventInterpreter.java +++ b/java/src/com/android/inputmethod/event/EventInterpreter.java @@ -19,9 +19,12 @@ package com.android.inputmethod.event; import android.util.SparseArray; import android.view.KeyEvent; +import com.android.inputmethod.latin.CollectionUtils; import com.android.inputmethod.latin.Constants; import com.android.inputmethod.latin.LatinIME; +import java.util.ArrayList; + /** * This class implements the logic between receiving events and generating code points. * @@ -40,6 +43,7 @@ public class EventInterpreter { final SparseArray<HardwareEventDecoder> mHardwareEventDecoders; final SoftwareEventDecoder mSoftwareEventDecoder; final LatinIME mLatinIme; + final ArrayList<Combiner> mCombiners; /** * Create a default interpreter. @@ -74,6 +78,8 @@ public class EventInterpreter { // capacity of 1. mHardwareEventDecoders = new SparseArray<HardwareEventDecoder>(1); mSoftwareEventDecoder = new SoftwareKeyboardEventDecoder(); + mCombiners = CollectionUtils.newArrayList(); + mCombiners.add(new DeadKeyCombiner()); mLatinIme = latinIme; } @@ -106,19 +112,22 @@ public class EventInterpreter { } private boolean onEvent(final Event event) { - if (event.isCommittable()) { - mLatinIme.onCodeInput(event.mCodePoint, - Constants.EXTERNAL_KEYBOARD_COORDINATE, Constants.EXTERNAL_KEYBOARD_COORDINATE); - return true; + Event currentlyProcessingEvent = event; + boolean processed = false; + for (int i = 0; i < mCombiners.size(); ++i) { + currentlyProcessingEvent = mCombiners.get(i).combine(event); + } + while (null != currentlyProcessingEvent) { + if (currentlyProcessingEvent.isCommittable()) { + mLatinIme.onCodeInput(currentlyProcessingEvent.mCodePoint, + Constants.EXTERNAL_KEYBOARD_COORDINATE, + Constants.EXTERNAL_KEYBOARD_COORDINATE); + processed = true; + } else if (event.isDead()) { + processed = true; + } + currentlyProcessingEvent = currentlyProcessingEvent.mNextEvent; } - // TODO: Classify the event - input or non-input (see design doc) - // TODO: IF action event - // Send decoded action back to LatinIME - // ELSE - // Send input event to the combiner - // Get back new input material + visual feedback + combiner state - // Route the event to Latin IME - // ENDIF - return false; + return processed; } } |