diff options
author | 2011-05-24 20:30:30 +0900 | |
---|---|---|
committer | 2011-05-25 17:48:31 +0900 | |
commit | 1fef530ec7626fa16777f52b48191e61db8f46d4 (patch) | |
tree | fb4f436bebe0f723bf41bb44fc9a34e1a9ee513f /java/src/com/android/inputmethod/latin/LatinIME.java | |
parent | bde078fe0dcefdd77c7e77080dedb4bece081e73 (diff) | |
download | latinime-1fef530ec7626fa16777f52b48191e61db8f46d4.tar.gz latinime-1fef530ec7626fa16777f52b48191e61db8f46d4.tar.xz latinime-1fef530ec7626fa16777f52b48191e61db8f46d4.zip |
Put SuggestionSpan at commitText
Bug: 4346045
Change-Id: Iaabdb8a148b2601bb9cbc2b08509adac164105a4
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 6cb928321..2afee1f29 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; @@ -1508,7 +1509,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; @@ -1575,7 +1576,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); @@ -1632,18 +1633,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(); |