diff options
author | 2014-01-24 21:57:34 +0900 | |
---|---|---|
committer | 2014-01-28 17:18:01 +0900 | |
commit | 4761d2fb002bddd487a24de5965c09538598813c (patch) | |
tree | 826d7357625b55df37ffd785df122b6fd697b8d8 /java/src | |
parent | 675f1dbaf0c9a2e01fe04c07ceb23f6b79721fd0 (diff) | |
download | latinime-4761d2fb002bddd487a24de5965c09538598813c.tar.gz latinime-4761d2fb002bddd487a24de5965c09538598813c.tar.xz latinime-4761d2fb002bddd487a24de5965c09538598813c.zip |
[IL99] Migrate some code to InputLogic.
Bug: 8636060
Change-Id: Ibf1f9c7bdc3fdd872d6c15447fa555434485cc52
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/com/android/inputmethod/latin/LatinIME.java | 23 | ||||
-rw-r--r-- | java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java | 19 |
2 files changed, 24 insertions, 18 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index adebfc08c..18c22b94c 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -1324,25 +1324,12 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen } // TODO[IL]: Define a clear interface for this - public void setSuggestedWords(final SuggestedWords words, final boolean shouldShow) { - mInputLogic.mSuggestedWords = words; - final boolean newAutoCorrectionIndicator = words.mWillAutoCorrect; - // Put a blue underline to a word in TextView which will be auto-corrected. - if (mInputLogic.mIsAutoCorrectionIndicatorOn != newAutoCorrectionIndicator - && mInputLogic.mWordComposer.isComposingWord()) { - mInputLogic.mIsAutoCorrectionIndicatorOn = newAutoCorrectionIndicator; - final CharSequence textWithUnderline = - mInputLogic.getTextWithUnderline(mInputLogic.mWordComposer.getTypedWord()); - // TODO: when called from an updateSuggestionStrip() call that results from a posted - // message, this is called outside any batch edit. Potentially, this may result in some - // janky flickering of the screen, although the display speed makes it unlikely in - // the practice. - mInputLogic.mConnection.setComposingText(textWithUnderline, 1); - } + public void setSuggestedWords(final SuggestedWords suggestedWords, final boolean shouldShow) { + mInputLogic.setSuggestedWords(suggestedWords); if (mSuggestionStripView != null) { - mSuggestionStripView.setSuggestions( - words, SubtypeLocaleUtils.isRtlLanguage(mSubtypeSwitcher.getCurrentSubtype())); - mKeyboardSwitcher.onAutoCorrectionStateChanged(words.mWillAutoCorrect); + mSuggestionStripView.setSuggestions(suggestedWords, + SubtypeLocaleUtils.isRtlLanguage(mSubtypeSwitcher.getCurrentSubtype())); + mKeyboardSwitcher.onAutoCorrectionStateChanged(suggestedWords.mWillAutoCorrect); setSuggestionStripShownInternal(shouldShow, true /* needsInputViewShown */); } } diff --git a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java index 43d75330d..98cce0d24 100644 --- a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java +++ b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java @@ -478,6 +478,25 @@ public final class InputLogic { SuggestedWords.EMPTY, true /* dismissGestureFloatingPreviewText */); } + // 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) { + mSuggestedWords = suggestedWords; + final boolean newAutoCorrectionIndicator = suggestedWords.mWillAutoCorrect; + // Put a blue underline to a word in TextView which will be auto-corrected. + if (mIsAutoCorrectionIndicatorOn != newAutoCorrectionIndicator + && mWordComposer.isComposingWord()) { + mIsAutoCorrectionIndicatorOn = newAutoCorrectionIndicator; + final CharSequence textWithUnderline = + getTextWithUnderline(mWordComposer.getTypedWord()); + // TODO: when called from an updateSuggestionStrip() call that results from a posted + // message, this is called outside any batch edit. Potentially, this may result in some + // janky flickering of the screen, although the display speed makes it unlikely in + // the practice. + mConnection.setComposingText(textWithUnderline, 1); + } + } + /** * Handle inputting a code point to the editor. * |