diff options
author | 2011-05-25 02:00:05 -0700 | |
---|---|---|
committer | 2011-05-25 02:00:05 -0700 | |
commit | f4c9e9d359ea1f3b81020f046b9e88584baff07d (patch) | |
tree | c9cadc5c9c6d257f41fec52ab125e817eede3af4 /java/src/com/android/inputmethod/latin/LatinIME.java | |
parent | 3e17686c682f4e320d46048d99e07eea2d38e7cf (diff) | |
parent | 1fef530ec7626fa16777f52b48191e61db8f46d4 (diff) | |
download | latinime-f4c9e9d359ea1f3b81020f046b9e88584baff07d.tar.gz latinime-f4c9e9d359ea1f3b81020f046b9e88584baff07d.tar.xz latinime-f4c9e9d359ea1f3b81020f046b9e88584baff07d.zip |
Merge "Put SuggestionSpan at commitText"
Diffstat (limited to 'java/src/com/android/inputmethod/latin/LatinIME.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/LatinIME.java | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index dc2fe4c53..346af3a2e 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.compat.InputConnectionCompatUtils; import com.android.inputmethod.compat.InputMethodManagerCompatWrapper; import com.android.inputmethod.compat.InputMethodServiceCompatWrapper; import com.android.inputmethod.compat.InputTypeCompatUtils; +import com.android.inputmethod.compat.SuggestionSpanUtils; import com.android.inputmethod.deprecated.LanguageSwitcherProxy; import com.android.inputmethod.deprecated.VoiceProxy; import com.android.inputmethod.deprecated.recorrection.Recorrection; @@ -1509,7 +1510,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar if (mBestWord != null && mBestWord.length() > 0) { TextEntryState.acceptedDefault(mWord.getTypedWord(), mBestWord, separatorCode); mJustAccepted = true; - pickSuggestion(mBestWord); + commitBestWord(mBestWord); // Add the word to the auto dictionary if it's not a known word addToAutoAndUserBigramDictionaries(mBestWord, AutoDictionary.FREQUENCY_FOR_TYPED); return true; @@ -1576,7 +1577,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar mWord.reset(); } mJustAccepted = true; - pickSuggestion(suggestion); + commitBestWord(suggestion); // Add the word to the auto dictionary if it's not a known word if (index == 0) { addToAutoAndUserBigramDictionaries(suggestion, AutoDictionary.FREQUENCY_FOR_PICKED); @@ -1633,18 +1634,20 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar * @param suggestion the suggestion picked by the user to be committed to * the text field */ - private void pickSuggestion(CharSequence suggestion) { + private void commitBestWord(CharSequence bestWord) { KeyboardSwitcher switcher = mKeyboardSwitcher; if (!switcher.isKeyboardAvailable()) return; InputConnection ic = getCurrentInputConnection(); if (ic != null) { - mVoiceProxy.rememberReplacedWord(suggestion, mSettingsValues.mWordSeparators); - ic.commitText(suggestion, 1); + mVoiceProxy.rememberReplacedWord(bestWord, mSettingsValues.mWordSeparators); + SuggestedWords suggestedWords = mCandidateView.getSuggestions(); + ic.commitText(SuggestionSpanUtils.getTextWithSuggestionSpan( + this, bestWord, suggestedWords), 1); } - mRecorrection.saveRecorrectionSuggestion(mWord, suggestion); + mRecorrection.saveRecorrectionSuggestion(mWord, bestWord); mHasUncommittedTypedChars = false; - mCommittedLength = suggestion.length(); + mCommittedLength = bestWord.length(); } private static final WordComposer sEmptyWordComposer = new WordComposer(); |