From 08c01ea8a8765234a470bb4d4b887fe4786ee26f Mon Sep 17 00:00:00 2001 From: Jean Chalard Date: Mon, 30 Jun 2014 21:19:51 +0900 Subject: [HW4] Move a reference to WordComposer out of LatinIME Change-Id: I5436432c0da86ed1e33b3c9d40204f4ea013ff55 --- .../com/android/inputmethod/latin/inputlogic/InputLogic.java | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java') diff --git a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java index 7719c6db6..b2af50466 100644 --- a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java +++ b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java @@ -620,6 +620,17 @@ public final class InputLogic { // TODO: on the long term, this method should become private, but it will be difficult. // Especially, how do we deal with InputMethodService.onDisplayCompletions? public void setSuggestedWords(final SuggestedWords suggestedWords) { + if (SuggestedWords.EMPTY != suggestedWords) { + final String autoCorrection; + if (suggestedWords.mWillAutoCorrect) { + autoCorrection = suggestedWords.getWord(SuggestedWords.INDEX_OF_AUTO_CORRECTION); + } else { + // We can't use suggestedWords.getWord(SuggestedWords.INDEX_OF_TYPED_WORD) + // because it may differ from mWordComposer.mTypedWord. + autoCorrection = suggestedWords.mTypedWord; + } + mWordComposer.setAutoCorrection(autoCorrection); + } mSuggestedWords = suggestedWords; final boolean newAutoCorrectionIndicator = suggestedWords.mWillAutoCorrect; // Put a blue underline to a word in TextView which will be auto-corrected. -- cgit v1.2.3-83-g751a