author | Chaomin Zheng <chaomin.zheng@amlogic.com> | 2016-12-23 11:11:48 (GMT) |
---|---|---|
committer | Chaomin Zheng <chaomin.zheng@amlogic.com> | 2016-12-23 11:15:37 (GMT) |
commit | 120e57956386e48f1f31a0c0db8fa0394f8d6ab9 (patch) | |
tree | d16b67ca30a503d964ca50955d4d7748a7034a72 | |
parent | 5b044f490ddbedd34221aca1af451550dd7273e7 (diff) | |
download | RemoteIME-120e57956386e48f1f31a0c0db8fa0394f8d6ab9.zip RemoteIME-120e57956386e48f1f31a0c0db8fa0394f8d6ab9.tar.gz RemoteIME-120e57956386e48f1f31a0c0db8fa0394f8d6ab9.tar.bz2 |
PD #136858:when shift tag false,reset last keycode unknow
Change-Id: I26150c18ee327dcc5a29538a6529e32bdfee0703
-rw-r--r-- | src/com/droidlogic/inputmethod/remote/EnglishInputProcessor.java | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/com/droidlogic/inputmethod/remote/EnglishInputProcessor.java b/src/com/droidlogic/inputmethod/remote/EnglishInputProcessor.java index 3a7e04e..5265e90 100644 --- a/src/com/droidlogic/inputmethod/remote/EnglishInputProcessor.java +++ b/src/com/droidlogic/inputmethod/remote/EnglishInputProcessor.java @@ -25,12 +25,19 @@ import android.view.inputmethod.InputConnection; public class EnglishInputProcessor { private int mLastKeyCode = KeyEvent.KEYCODE_UNKNOWN; + private boolean mShiftTag = false; + public boolean processKey ( InputConnection inputContext, KeyEvent event, boolean upperCase, boolean realAction ) { if ( null == inputContext || null == event ) { return false; } int keyCode = event.getKeyCode(); CharSequence prefix = null; prefix = inputContext.getTextBeforeCursor ( 2, 0 ); + + if (!realAction && keyCode == KeyEvent.KEYCODE_SHIFT_LEFT) { + mShiftTag = true; + } + int keyChar; keyChar = 0; if ( keyCode >= KeyEvent.KEYCODE_A && keyCode <= KeyEvent.KEYCODE_Z ) { @@ -53,6 +60,11 @@ public class EnglishInputProcessor { } else if ( keyCode == KeyEvent.KEYCODE_AT ) { keyChar = '@'; } else if ( keyCode == KeyEvent.KEYCODE_SLASH ) { keyChar = '/'; } + + if (mShiftTag) { + keyChar = 0; + } + if ( 0 == keyChar ) { mLastKeyCode = keyCode; String insert = null; @@ -75,6 +87,12 @@ public class EnglishInputProcessor { if ( !realAction ) { return true; } + + if (realAction && keyCode == KeyEvent.KEYCODE_SHIFT_LEFT) { + mShiftTag = false; + mLastKeyCode = KeyEvent.KEYCODE_UNKNOWN; + } + if ( KeyEvent.KEYCODE_SHIFT_LEFT == mLastKeyCode || KeyEvent.KEYCODE_SHIFT_LEFT == mLastKeyCode ) { if ( keyChar >= 'a' && keyChar <= 'z' ) { |