diff options
Diffstat (limited to 'java')
-rw-r--r-- | java/res/values/keycodes.xml | 1 | ||||
-rw-r--r-- | java/res/xml-sw600dp/kbd_key_styles.xml | 4 | ||||
-rw-r--r-- | java/res/xml-sw768dp/kbd_key_styles.xml | 4 | ||||
-rw-r--r-- | java/src/com/android/inputmethod/keyboard/Keyboard.java | 3 | ||||
-rw-r--r-- | java/src/com/android/inputmethod/latin/LatinIME.java | 11 |
5 files changed, 13 insertions, 10 deletions
diff --git a/java/res/values/keycodes.xml b/java/res/values/keycodes.xml index 59cc07531..4f8bfed58 100644 --- a/java/res/values/keycodes.xml +++ b/java/res/values/keycodes.xml @@ -23,6 +23,7 @@ <integer name="key_tab">9</integer> <integer name="key_return">10</integer> <integer name="key_space">32</integer> + <integer name="key_dummy">0</integer> <integer name="key_shift">-1</integer> <integer name="key_switch_alpha_symbol">-2</integer> <integer name="key_delete">-5</integer> diff --git a/java/res/xml-sw600dp/kbd_key_styles.xml b/java/res/xml-sw600dp/kbd_key_styles.xml index aba1a8029..e0171b030 100644 --- a/java/res/xml-sw600dp/kbd_key_styles.xml +++ b/java/res/xml-sw600dp/kbd_key_styles.xml @@ -78,14 +78,14 @@ latin:code="@integer/key_shortcut" latin:keyIcon="iconShortcutKey" latin:keyActionFlags="noKeyPreview|altCodeWhileTyping" - latin:altCode="@integer/key_space" + latin:altCode="@integer/key_dummy" latin:parentStyle="f2PopupStyle" /> <key-style latin:styleName="settingsKeyStyle" latin:code="@integer/key_settings" latin:keyIcon="iconSettingsKey" latin:keyActionFlags="noKeyPreview|altCodeWhileTyping" - latin:altCode="@integer/key_space" + latin:altCode="@integer/key_dummy" latin:backgroundType="functional" /> <key-style latin:styleName="tabKeyStyle" diff --git a/java/res/xml-sw768dp/kbd_key_styles.xml b/java/res/xml-sw768dp/kbd_key_styles.xml index e6ec53dd1..d9266508e 100644 --- a/java/res/xml-sw768dp/kbd_key_styles.xml +++ b/java/res/xml-sw768dp/kbd_key_styles.xml @@ -60,14 +60,14 @@ latin:code="@integer/key_shortcut" latin:keyIcon="iconShortcutKey" latin:keyActionFlags="noKeyPreview|altCodeWhileTyping" - latin:altCode="@integer/key_space" + latin:altCode="@integer/key_dummy" latin:backgroundType="functional" /> <key-style latin:styleName="settingsKeyStyle" latin:code="@integer/key_settings" latin:keyIcon="iconSettingsKey" latin:keyActionFlags="noKeyPreview|altCodeWhileTyping" - latin:altCode="@integer/key_space" + latin:altCode="@integer/key_dummy" latin:backgroundType="functional" /> <key-style latin:styleName="tabKeyStyle" diff --git a/java/src/com/android/inputmethod/keyboard/Keyboard.java b/java/src/com/android/inputmethod/keyboard/Keyboard.java index e267aa65c..e3f219162 100644 --- a/java/src/com/android/inputmethod/keyboard/Keyboard.java +++ b/java/src/com/android/inputmethod/keyboard/Keyboard.java @@ -151,6 +151,9 @@ public class Keyboard { } public Key getKey(int code) { + if (code == CODE_DUMMY) { + return null; + } final Integer keyCode = code; if (mKeyCache.containsKey(keyCode)) { return mKeyCache.get(keyCode); diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index fdbc9d8e2..98fea1b5b 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -1602,7 +1602,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar final boolean shouldAutoCorrect = mSettingsValues.mAutoCorrectEnabled && !mInputTypeNoAutoCorrect; if (shouldAutoCorrect && primaryCode != Keyboard.CODE_SINGLE_QUOTE) { - final boolean didAutoCorrect = commitCurrentAutoCorrection(primaryCode, ic); + commitCurrentAutoCorrection(primaryCode, ic); } else { commitTyped(ic); } @@ -1859,7 +1859,8 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar setSuggestionStripShown(isSuggestionsStripVisible()); } - private boolean commitCurrentAutoCorrection(final int separatorCode, final InputConnection ic) { + private void commitCurrentAutoCorrection(final int separatorCodePoint, + final InputConnection ic) { // Complete any pending suggestions query first if (mHandler.hasPendingUpdateSuggestions()) { mHandler.cancelUpdateSuggestions(); @@ -1872,7 +1873,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar throw new RuntimeException("We have an auto-correction but the typed word " + "is empty? Impossible! I must commit suicide."); } - Utils.Stats.onAutoCorrection(typedWord, autoCorrection.toString(), separatorCode); + Utils.Stats.onAutoCorrection(typedWord, autoCorrection.toString(), separatorCodePoint); mExpectingUpdateSelection = true; commitBestWord(autoCorrection); if (!autoCorrection.equals(typedWord)) { @@ -1881,15 +1882,13 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar // Add the word to the user unigram dictionary if it's not a known word addToUserUnigramAndBigramDictionaries(autoCorrection, UserUnigramDictionary.FREQUENCY_FOR_TYPED); - if (!typedWord.equals(autoCorrection)) { + if (!typedWord.equals(autoCorrection) && null != ic) { // This will make the correction flash for a short while as a visual clue // to the user that auto-correction happened. InputConnectionCompatUtils.commitCorrection(ic, mLastSelectionEnd - typedWord.length(), typedWord, autoCorrection); } - return true; } - return false; } @Override |