Cleanup, part 4 (C4)
Change-Id: I2821ae71ec49e4b6b512157d17b80198f74321e4
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index fc4d115..29ebe39 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -1716,7 +1716,7 @@
// getSuggestedWords handles gracefully a null value of prevWord
final SuggestedWords suggestedWords = mSuggest.getSuggestedWords(mWordComposer,
prevWord, mKeyboardSwitcher.getKeyboard().getProximityInfo(),
- mCurrentSettings.mCorrectionMode);
+ mCurrentSettings.isCorrectionOn());
// Basically, we update the suggestion strip only when suggestion count > 1. However,
// there is an exception: We update the suggestion strip whenever typed word's length
diff --git a/java/src/com/android/inputmethod/latin/SettingsValues.java b/java/src/com/android/inputmethod/latin/SettingsValues.java
index 106cd2c..84e66a0 100644
--- a/java/src/com/android/inputmethod/latin/SettingsValues.java
+++ b/java/src/com/android/inputmethod/latin/SettingsValues.java
@@ -208,9 +208,11 @@
}
private int createCorrectionMode() {
- final boolean shouldAutoCorrect = mAutoCorrectEnabled
- && !mInputAttributes.mInputTypeNoAutoCorrect;
- return shouldAutoCorrect ? Suggest.CORRECTION_FULL : Suggest.CORRECTION_NONE;
+ if (mAutoCorrectEnabled && !mInputAttributes.mInputTypeNoAutoCorrect) {
+ return Suggest.CORRECTION_FULL;
+ } else {
+ return Suggest.CORRECTION_NONE;
+ }
}
private int createSuggestionVisibility(final Resources res) {
diff --git a/java/src/com/android/inputmethod/latin/Suggest.java b/java/src/com/android/inputmethod/latin/Suggest.java
index 958b453..c203e52 100644
--- a/java/src/com/android/inputmethod/latin/Suggest.java
+++ b/java/src/com/android/inputmethod/latin/Suggest.java
@@ -245,10 +245,18 @@
true /* isPrediction */);
}
- // TODO: cleanup dictionaries looking up and suggestions building with SuggestedWords.Builder
+ // Wrapper for test compatibility. TODO: remove this method
public SuggestedWords getSuggestedWords(
final WordComposer wordComposer, CharSequence prevWordForBigram,
final ProximityInfo proximityInfo, final int correctionMode) {
+ return getSuggestedWords(wordComposer, prevWordForBigram, proximityInfo,
+ Suggest.CORRECTION_FULL == correctionMode);
+ }
+
+ // TODO: cleanup dictionaries looking up and suggestions building with SuggestedWords.Builder
+ public SuggestedWords getSuggestedWords(
+ final WordComposer wordComposer, CharSequence prevWordForBigram,
+ final ProximityInfo proximityInfo, final boolean isCorrectionEnabled) {
LatinImeLogger.onStartSuggestion(prevWordForBigram);
mIsFirstCharCapitalized = wordComposer.isFirstCharCapitalized();
mIsAllUpperCase = wordComposer.isAllUpperCase();
@@ -263,7 +271,7 @@
LatinImeLogger.onAddSuggestedWord(typedWord, Suggest.DIC_USER_TYPED, Dictionary.UNIGRAM);
mConsideredWord = consideredWord;
- if (wordComposer.size() <= 1 && (correctionMode == CORRECTION_FULL)) {
+ if (wordComposer.size() <= 1 && isCorrectionEnabled) {
// At first character typed, search only the bigrams
mBigramSuggestions = new ArrayList<SuggestedWordInfo>(PREF_MAX_BIGRAMS);
@@ -320,7 +328,7 @@
mIsFirstCharCapitalized, mWhiteListDictionary.getWhitelistedWord(consideredWord));
final boolean hasAutoCorrection;
- if (CORRECTION_FULL == correctionMode) {
+ if (isCorrectionEnabled) {
final CharSequence autoCorrection =
AutoCorrection.computeAutoCorrectionWord(mUnigramDictionaries, wordComposer,
mSuggestions, consideredWord, mAutoCorrectionThreshold,
@@ -369,7 +377,7 @@
&& mHasMainDictionary;
boolean autoCorrectionAvailable = hasAutoCorrection;
- if (correctionMode == CORRECTION_FULL) {
+ if (isCorrectionEnabled) {
autoCorrectionAvailable |= !allowsToBeAutoCorrected;
}
// Don't auto-correct words with multiple capital letter