diff options
Diffstat (limited to 'java/src/com/android/inputmethod/latin/LatinIME.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/LatinIME.java | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 904574519..59fa66ded 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -980,7 +980,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar .setHasMinimalSuggestion(false); // When in fullscreen mode, show completions generated by the application final SuggestedWords words = builder.build(); - final boolean isAutoCorrection = Utils.willAutoCorrect(words); + final boolean isAutoCorrection = false; setSuggestions(words, isAutoCorrection); setAutoCorrectionIndicator(isAutoCorrection); // TODO: is this the right thing to do? What should we auto-correct to in @@ -1737,10 +1737,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar if (DEBUG) { Log.d(TAG, "Flip the indicator. " + oldAutoCorrectionIndicator + " -> " + newAutoCorrectionIndicator); - if (mComposingStateManager.isComposing() && newAutoCorrectionIndicator - != mComposingStateManager.isAutoCorrectionIndicatorOn()) { - throw new RuntimeException("Couldn't flip the indicator!"); - } } if (mWordComposer.isComposingWord()) { final CharSequence textWithUnderline = @@ -1831,18 +1827,18 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar builder.addTypedWordAndPreviousSuggestions(typedWord, previousSuggestions); } } + final SuggestedWords suggestedWords = builder.build(); + if (Utils.shouldBlockAutoCorrectionBySafetyNet(suggestedWords, mSuggest)) { + suggestedWords.setShouldBlockAutoCorrectionBySatefyNet(); + } showSuggestions(builder.build(), typedWord); } public void showSuggestions(final SuggestedWords suggestedWords, final CharSequence typedWord) { - final boolean shouldBlockAutoCorrectionBySafetyNet = - Utils.shouldBlockAutoCorrectionBySafetyNet(suggestedWords, mSuggest); - if (shouldBlockAutoCorrectionBySafetyNet) { - suggestedWords.setShouldBlockAutoCorrectionBySatefyNet(); - } final CharSequence autoCorrection; if (suggestedWords.size() > 0) { - if (!shouldBlockAutoCorrectionBySafetyNet && suggestedWords.hasAutoCorrectionWord()) { + if (!suggestedWords.shouldBlockAutoCorrectionBySafetyNet() + && suggestedWords.hasAutoCorrectionWord()) { autoCorrection = suggestedWords.getWord(1); } else { autoCorrection = typedWord; @@ -1851,7 +1847,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar autoCorrection = null; } mWordComposer.setAutoCorrection(autoCorrection); - final boolean isAutoCorrection = Utils.willAutoCorrect(suggestedWords); + final boolean isAutoCorrection = suggestedWords.willAutoCorrect(); setSuggestions(suggestedWords, isAutoCorrection); setAutoCorrectionIndicator(isAutoCorrection); setSuggestionStripShown(isSuggestionsStripVisible()); @@ -2420,7 +2416,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar switch (position) { case 0: Intent intent = CompatUtils.getInputLanguageSelectionIntent( - Utils.getInputMethodId(mImm, getPackageName()), + Utils.getInputMethodId(getPackageName()), Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED | Intent.FLAG_ACTIVITY_CLEAR_TOP); |