am 28196662: Merge "[IL99] Migrate some code to InputLogic."
* commit '281966621705caf9240af4156e62d26d43d40ccb': [IL99] Migrate some code to InputLogic.main
commit
ec725d1421
|
@ -1324,25 +1324,12 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO[IL]: Define a clear interface for this
|
// TODO[IL]: Define a clear interface for this
|
||||||
public void setSuggestedWords(final SuggestedWords words, final boolean shouldShow) {
|
public void setSuggestedWords(final SuggestedWords suggestedWords, final boolean shouldShow) {
|
||||||
mInputLogic.mSuggestedWords = words;
|
mInputLogic.setSuggestedWords(suggestedWords);
|
||||||
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);
|
|
||||||
}
|
|
||||||
if (mSuggestionStripView != null) {
|
if (mSuggestionStripView != null) {
|
||||||
mSuggestionStripView.setSuggestions(
|
mSuggestionStripView.setSuggestions(suggestedWords,
|
||||||
words, SubtypeLocaleUtils.isRtlLanguage(mSubtypeSwitcher.getCurrentSubtype()));
|
SubtypeLocaleUtils.isRtlLanguage(mSubtypeSwitcher.getCurrentSubtype()));
|
||||||
mKeyboardSwitcher.onAutoCorrectionStateChanged(words.mWillAutoCorrect);
|
mKeyboardSwitcher.onAutoCorrectionStateChanged(suggestedWords.mWillAutoCorrect);
|
||||||
setSuggestionStripShownInternal(shouldShow, true /* needsInputViewShown */);
|
setSuggestionStripShownInternal(shouldShow, true /* needsInputViewShown */);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -478,6 +478,25 @@ public final class InputLogic {
|
||||||
SuggestedWords.EMPTY, true /* dismissGestureFloatingPreviewText */);
|
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.
|
* Handle inputting a code point to the editor.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue