Merge "Some more simplification"

This commit is contained in:
Jean Chalard 2012-03-02 05:56:58 -08:00 committed by Android (Google) Code Review
commit e53840d216

View file

@ -980,8 +980,9 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
.setHasMinimalSuggestion(false); .setHasMinimalSuggestion(false);
// When in fullscreen mode, show completions generated by the application // When in fullscreen mode, show completions generated by the application
final SuggestedWords words = builder.build(); final SuggestedWords words = builder.build();
setSuggestions(words); final boolean isAutoCorrection = Utils.willAutoCorrect(words);
setAutoCorrectionIndicator(Utils.willAutoCorrect(words)); setSuggestions(words, isAutoCorrection);
setAutoCorrectionIndicator(isAutoCorrection);
// TODO: is this the right thing to do? What should we auto-correct to in // TODO: is this the right thing to do? What should we auto-correct to in
// this case? This says to keep whatever the user typed. // this case? This says to keep whatever the user typed.
mWordComposer.setAutoCorrection(mWordComposer.getTypedWord()); mWordComposer.setAutoCorrection(mWordComposer.getTypedWord());
@ -1714,15 +1715,14 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
} }
public void clearSuggestions() { public void clearSuggestions() {
setSuggestions(SuggestedWords.EMPTY); setSuggestions(SuggestedWords.EMPTY, false);
setAutoCorrectionIndicator(false); setAutoCorrectionIndicator(false);
} }
public void setSuggestions(final SuggestedWords words) { public void setSuggestions(final SuggestedWords words, final boolean isAutoCorrection) {
if (mSuggestionsView != null) { if (mSuggestionsView != null) {
mSuggestionsView.setSuggestions(words); mSuggestionsView.setSuggestions(words);
mKeyboardSwitcher.onAutoCorrectionStateChanged( mKeyboardSwitcher.onAutoCorrectionStateChanged(isAutoCorrection);
words.hasWordAboveAutoCorrectionScoreThreshold());
} }
} }
@ -1851,8 +1851,9 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
autoCorrection = null; autoCorrection = null;
} }
mWordComposer.setAutoCorrection(autoCorrection); mWordComposer.setAutoCorrection(autoCorrection);
setSuggestions(suggestedWords); final boolean isAutoCorrection = Utils.willAutoCorrect(suggestedWords);
setAutoCorrectionIndicator(Utils.willAutoCorrect(suggestedWords)); setSuggestions(suggestedWords, isAutoCorrection);
setAutoCorrectionIndicator(isAutoCorrection);
setSuggestionStripShown(isSuggestionsStripVisible()); setSuggestionStripShown(isSuggestionsStripVisible());
} }
@ -2025,7 +2026,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
} }
public void setPunctuationSuggestions() { public void setPunctuationSuggestions() {
setSuggestions(mSettingsValues.mSuggestPuncList); setSuggestions(mSettingsValues.mSuggestPuncList, false);
setAutoCorrectionIndicator(false); setAutoCorrectionIndicator(false);
setSuggestionStripShown(isSuggestionsStripVisible()); setSuggestionStripShown(isSuggestionsStripVisible());
} }