diff options
author | 2014-08-07 00:13:09 +0000 | |
---|---|---|
committer | 2014-08-07 00:13:09 +0000 | |
commit | 95d2c4fbedb0dd9139e12e8c427c957eeaa106b2 (patch) | |
tree | 01a2bdcfda8202941e0825adc309b8184da4130d /java/src | |
parent | d34354ee6727b72cdb00e2895eed7f21e5772b25 (diff) | |
parent | d5e4e367f21407da7a5f62a18e601957b07b6f4d (diff) | |
download | latinime-95d2c4fbedb0dd9139e12e8c427c957eeaa106b2.tar.gz latinime-95d2c4fbedb0dd9139e12e8c427c957eeaa106b2.tar.xz latinime-95d2c4fbedb0dd9139e12e8c427c957eeaa106b2.zip |
am d5e4e367: am 3316dcd4: Merge "Revert "Introduce onEvent() to improve testability"" into lmp-dev
* commit 'd5e4e367f21407da7a5f62a18e601957b07b6f4d':
Revert "Introduce onEvent() to improve testability"
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/com/android/inputmethod/latin/LatinIME.java | 43 |
1 files changed, 17 insertions, 26 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index f67c2a356..3a5f85d63 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -1232,26 +1232,10 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen mSubtypeState.switchSubtype(token, mRichImm); } - // TODO: Instead of checking for alphabetic keyboard here, separate keycodes for - // alphabetic shift and shift while in symbol layout and get rid of this method. - private int getCodePointForKeyboard(final int codePoint) { - if (Constants.CODE_SHIFT == codePoint) { - final Keyboard currentKeyboard = mKeyboardSwitcher.getKeyboard(); - if (null != currentKeyboard && currentKeyboard.mId.isAlphabetKeyboard()) { - return codePoint; - } else { - return Constants.CODE_SYMBOL_SHIFT; - } - } else { - return codePoint; - } - } - // Implementation of {@link KeyboardActionListener}. @Override public void onCodeInput(final int codePoint, final int x, final int y, final boolean isKeyRepeat) { - // TODO: this processing does not belong inside LatinIME, the caller should be doing this. final MainKeyboardView mainKeyboardView = mKeyboardSwitcher.getMainKeyboardView(); // x and y include some padding, but everything down the line (especially native // code) needs the coordinates in the keyboard frame. @@ -1260,23 +1244,30 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen // this transformation, it should be done already before calling onCodeInput. final int keyX = mainKeyboardView.getKeyX(x); final int keyY = mainKeyboardView.getKeyY(y); - final Event event = createSoftwareKeypressEvent(getCodePointForKeyboard(codePoint), - keyX, keyY, isKeyRepeat); - onEvent(event); - } - - // This method is public for testability of LatinIME, but also in the future it should - // completely replace #onCodeInput. - public void onEvent(final Event event) { - if (Constants.CODE_SHORTCUT == event.mCodePoint) { + final int codeToSend; + if (Constants.CODE_SHIFT == codePoint) { + // TODO: Instead of checking for alphabetic keyboard here, separate keycodes for + // alphabetic shift and shift while in symbol layout. + final Keyboard currentKeyboard = mKeyboardSwitcher.getKeyboard(); + if (null != currentKeyboard && currentKeyboard.mId.isAlphabetKeyboard()) { + codeToSend = codePoint; + } else { + codeToSend = Constants.CODE_SYMBOL_SHIFT; + } + } else { + codeToSend = codePoint; + } + if (Constants.CODE_SHORTCUT == codePoint) { mSubtypeSwitcher.switchToShortcutIME(this); + // Still call the *#onCodeInput methods for readability. } + final Event event = createSoftwareKeypressEvent(codeToSend, keyX, keyY, isKeyRepeat); final InputTransaction completeInputTransaction = mInputLogic.onCodeInput(mSettings.getCurrent(), event, mKeyboardSwitcher.getKeyboardShiftMode(), mKeyboardSwitcher.getCurrentKeyboardScriptId(), mHandler); updateStateAfterInputTransaction(completeInputTransaction); - mKeyboardSwitcher.onCodeInput(event.mCodePoint, getCurrentAutoCapsState(), + mKeyboardSwitcher.onCodeInput(codePoint, getCurrentAutoCapsState(), getCurrentRecapitalizeState()); } |