diff options
author | 2014-03-12 16:41:45 +0900 | |
---|---|---|
committer | 2014-03-13 18:41:02 +0900 | |
commit | a79a3265db6482a0bcaf0dfa87036a9243af281d (patch) | |
tree | 3d84062b5b47ed27be7b7c2096a6a10dd04f4ca1 /java/src/com/android/inputmethod/latin/LatinIME.java | |
parent | 66dce6003f8f1e45eb23c6e2cc273ba07e3065cd (diff) | |
download | latinime-a79a3265db6482a0bcaf0dfa87036a9243af281d.tar.gz latinime-a79a3265db6482a0bcaf0dfa87036a9243af281d.tar.xz latinime-a79a3265db6482a0bcaf0dfa87036a9243af281d.zip |
[CB02] Pass an Event to onCodeInput.
Bug: 13406701
Change-Id: Id82e9aab6544ca308e6ac6dee2cfa018b9ce2d8f
Diffstat (limited to 'java/src/com/android/inputmethod/latin/LatinIME.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/LatinIME.java | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index a9e548060..222e73529 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -59,6 +59,7 @@ import com.android.inputmethod.accessibility.AccessibleKeyboardViewProxy; import com.android.inputmethod.annotations.UsedForTesting; import com.android.inputmethod.compat.InputMethodServiceCompatUtils; import com.android.inputmethod.dictionarypack.DictionaryPackConstants; +import com.android.inputmethod.event.Event; import com.android.inputmethod.event.InputTransaction; import com.android.inputmethod.keyboard.Keyboard; import com.android.inputmethod.keyboard.KeyboardActionListener; @@ -1266,8 +1267,9 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen mSubtypeSwitcher.switchToShortcutIME(this); // Still call the *#onCodeInput methods for readability. } + final Event event = createSoftwareKeypressEvent(codeToSend, keyX, keyY); final InputTransaction completeInputTransaction = - mInputLogic.onCodeInput(mSettings.getCurrent(), codeToSend, keyX, keyY, + mInputLogic.onCodeInput(mSettings.getCurrent(), event, mKeyboardSwitcher.getKeyboardShiftMode(), mHandler); switch (completeInputTransaction.getRequiredShiftUpdate()) { case InputTransaction.SHIFT_UPDATE_LATER: @@ -1281,6 +1283,22 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen mKeyboardSwitcher.onCodeInput(codePoint); } + // A helper method to split the code point and the key code. Ultimately, they should not be + // squashed into the same variable, and this method should be removed. + private static Event createSoftwareKeypressEvent(final int keyCodeOrCodePoint, final int keyX, + final int keyY) { + final int keyCode; + final int codePoint; + if (keyCodeOrCodePoint <= 0) { + keyCode = keyCodeOrCodePoint; + codePoint = Event.NOT_A_CODE_POINT; + } else { + keyCode = Event.NOT_A_KEY_CODE; + codePoint = keyCodeOrCodePoint; + } + return Event.createSoftwareKeypressEvent(codePoint, keyCode, keyX, keyY); + } + // Called from PointerTracker through the KeyboardActionListener interface @Override public void onTextInput(final String rawText) { |