diff options
author | 2012-03-02 20:33:23 +0900 | |
---|---|---|
committer | 2012-03-02 20:34:10 +0900 | |
commit | dd931c47be1a4fe4cf86c8ad018e479c2cbdf8ce (patch) | |
tree | 8eea0d6d87555c16d053e43d413e73272db20b29 /java/src | |
parent | e2a50bd8049a8bd38a9154b510f9ccd047459e05 (diff) | |
download | latinime-dd931c47be1a4fe4cf86c8ad018e479c2cbdf8ce.tar.gz latinime-dd931c47be1a4fe4cf86c8ad018e479c2cbdf8ce.tar.xz latinime-dd931c47be1a4fe4cf86c8ad018e479c2cbdf8ce.zip |
Some more simplification
I wish "are we autocorrecting?" was not computed in a dozen
places all depending on a hundred code paths
More than likely, this fixes very subtle discrepancies
between auto-correction indicator with the underline and with
the LED on the spacebar - which is not displayed any more in
the current version anyway. Especially, the LED probably
would have been off when the word was caught by the safety net.
Change-Id: Idda3021771081d6155b06915e728ecd64d9e042e
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/com/android/inputmethod/latin/LatinIME.java | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 211b69a44..98bdef606 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -980,8 +980,9 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar .setHasMinimalSuggestion(false); // When in fullscreen mode, show completions generated by the application final SuggestedWords words = builder.build(); - setSuggestions(words); - setAutoCorrectionIndicator(Utils.willAutoCorrect(words)); + final boolean isAutoCorrection = Utils.willAutoCorrect(words); + setSuggestions(words, isAutoCorrection); + setAutoCorrectionIndicator(isAutoCorrection); // 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. mWordComposer.setAutoCorrection(mWordComposer.getTypedWord()); @@ -1714,15 +1715,14 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar } public void clearSuggestions() { - setSuggestions(SuggestedWords.EMPTY); + setSuggestions(SuggestedWords.EMPTY, false); setAutoCorrectionIndicator(false); } - public void setSuggestions(final SuggestedWords words) { + public void setSuggestions(final SuggestedWords words, final boolean isAutoCorrection) { if (mSuggestionsView != null) { mSuggestionsView.setSuggestions(words); - mKeyboardSwitcher.onAutoCorrectionStateChanged( - words.hasWordAboveAutoCorrectionScoreThreshold()); + mKeyboardSwitcher.onAutoCorrectionStateChanged(isAutoCorrection); } } @@ -1851,8 +1851,9 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar autoCorrection = null; } mWordComposer.setAutoCorrection(autoCorrection); - setSuggestions(suggestedWords); - setAutoCorrectionIndicator(Utils.willAutoCorrect(suggestedWords)); + final boolean isAutoCorrection = Utils.willAutoCorrect(suggestedWords); + setSuggestions(suggestedWords, isAutoCorrection); + setAutoCorrectionIndicator(isAutoCorrection); setSuggestionStripShown(isSuggestionsStripVisible()); } @@ -2025,7 +2026,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar } public void setPunctuationSuggestions() { - setSuggestions(mSettingsValues.mSuggestPuncList); + setSuggestions(mSettingsValues.mSuggestPuncList, false); setAutoCorrectionIndicator(false); setSuggestionStripShown(isSuggestionsStripVisible()); } |