aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2012-06-19 09:24:25 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-06-19 09:24:25 -0700
commitc03bd090ea9f5e610d5380a5e0b70f3c60d9b6fe (patch)
tree0cadecc3774cba2de2e1215930c29561d3c3d278 /java/src
parentbd765d33556def42c41a6f36298f28feb01af8e4 (diff)
parent9b233ecef2e6fce4024caa4da4b88d75edfd7b00 (diff)
downloadlatinime-c03bd090ea9f5e610d5380a5e0b70f3c60d9b6fe.tar.gz
latinime-c03bd090ea9f5e610d5380a5e0b70f3c60d9b6fe.tar.xz
latinime-c03bd090ea9f5e610d5380a5e0b70f3c60d9b6fe.zip
Merge "Cleanup, part 4 (C4)"
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java2
-rw-r--r--java/src/com/android/inputmethod/latin/SettingsValues.java8
-rw-r--r--java/src/com/android/inputmethod/latin/Suggest.java16
3 files changed, 18 insertions, 8 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index da4a11433..02b966625 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -1712,7 +1712,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
// 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 d4317de35..53f2dfcdb 100644
--- a/java/src/com/android/inputmethod/latin/SettingsValues.java
+++ b/java/src/com/android/inputmethod/latin/SettingsValues.java
@@ -207,9 +207,11 @@ public class SettingsValues {
}
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 eb854910d..f10ebe047 100644
--- a/java/src/com/android/inputmethod/latin/Suggest.java
+++ b/java/src/com/android/inputmethod/latin/Suggest.java
@@ -249,10 +249,18 @@ public class Suggest implements Dictionary.WordCallback {
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();
@@ -267,7 +275,7 @@ public class Suggest implements Dictionary.WordCallback {
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);
@@ -324,7 +332,7 @@ public class Suggest implements Dictionary.WordCallback {
mIsFirstCharCapitalized, mWhiteListDictionary.getWhitelistedWord(consideredWord));
final boolean hasAutoCorrection;
- if (CORRECTION_FULL == correctionMode) {
+ if (isCorrectionEnabled) {
final CharSequence autoCorrection =
AutoCorrection.computeAutoCorrectionWord(mUnigramDictionaries, wordComposer,
mSuggestions, consideredWord, mAutoCorrectionThreshold,
@@ -374,7 +382,7 @@ public class Suggest implements Dictionary.WordCallback {
&& hasMainDictionary();
boolean autoCorrectionAvailable = hasAutoCorrection;
- if (correctionMode == CORRECTION_FULL) {
+ if (isCorrectionEnabled) {
autoCorrectionAvailable |= !allowsToBeAutoCorrected;
}
// Don't auto-correct words with multiple capital letter