diff options
author | 2012-03-23 21:35:56 +0900 | |
---|---|---|
committer | 2012-03-23 21:40:07 +0900 | |
commit | 71f9d30b18e05d7d97d607d1aac3f81c6724abd9 (patch) | |
tree | 0f5d4e99895c542e7b6a814692c391e33733647e /java/src/com/android/inputmethod/latin/LatinIME.java | |
parent | 3ee7d97587ccbbeb8003d2142478337e8d60b2b7 (diff) | |
download | latinime-71f9d30b18e05d7d97d607d1aac3f81c6724abd9.tar.gz latinime-71f9d30b18e05d7d97d607d1aac3f81c6724abd9.tar.xz latinime-71f9d30b18e05d7d97d607d1aac3f81c6724abd9.zip |
Correct a shaky processing and move it to a better place
The old code would remove caps from the first letter if
auto-capsed but that makes very little sense when the word
is camel-cased. Also, it would not correctly handle
surrogate pairs, and would require a direct reference to
LatinIME and a specific method to do the processing in an
unexpected place.
Change-Id: I416d6a805242788a2473f007ca7452c9fe3f5205
Diffstat (limited to 'java/src/com/android/inputmethod/latin/LatinIME.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/LatinIME.java | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 2ee5a3819..e07bba065 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -528,7 +528,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar resetContactsDictionary(oldContactsDictionary); mUserHistoryDictionary - = new UserHistoryDictionary(this, this, localeStr, Suggest.DIC_USER_HISTORY); + = new UserHistoryDictionary(this, localeStr, Suggest.DIC_USER_HISTORY); mSuggest.setUserHistoryDictionary(mUserHistoryDictionary); LocaleUtils.setSystemLocale(res, savedLocale); @@ -2012,8 +2012,14 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar } else { prevWord = null; } + final String secondWord; + if (mWordComposer.isAutoCapitalized() && !mWordComposer.isMostlyCaps()) { + secondWord = suggestion.toString().toLowerCase(mSubtypeSwitcher.getInputLocale()); + } else { + secondWord = suggestion.toString(); + } mUserHistoryDictionary.addToUserHistory(null == prevWord ? null : prevWord.toString(), - suggestion.toString()); + secondWord); } } @@ -2254,10 +2260,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar mFeedbackManager.vibrate(mKeyboardSwitcher.getKeyboardView()); } - public boolean isAutoCapitalized() { - return mWordComposer.isAutoCapitalized(); - } - private void updateCorrectionMode() { // TODO: cleanup messy flags final boolean shouldAutoCorrect = mSettingsValues.mAutoCorrectEnabled |