diff options
Diffstat (limited to 'java/src/com/android/inputmethod/latin/Suggest.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/Suggest.java | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/java/src/com/android/inputmethod/latin/Suggest.java b/java/src/com/android/inputmethod/latin/Suggest.java index 69f37dd94..70751c107 100644 --- a/java/src/com/android/inputmethod/latin/Suggest.java +++ b/java/src/com/android/inputmethod/latin/Suggest.java @@ -38,8 +38,6 @@ import java.util.concurrent.ConcurrentHashMap; public class Suggest { public static final String TAG = Suggest.class.getSimpleName(); - public static final int APPROX_MAX_WORD_LENGTH = 32; - // TODO: rename this to CORRECTION_OFF public static final int CORRECTION_NONE = 0; // TODO: rename this to CORRECTION_ON @@ -132,10 +130,6 @@ public class Suggest { return mDictionaries; } - public static int getApproxMaxWordLength() { - return APPROX_MAX_WORD_LENGTH; - } - /** * Sets an optional user dictionary resource to be loaded. The user dictionary is consulted * before the main dictionary, if set. This refers to the system-managed user dictionary. @@ -227,7 +221,7 @@ public class Suggest { mWhiteListDictionary.getWhitelistedWord(consideredWord); final boolean hasAutoCorrection; - if (!isCorrectionEnabled) { + if (!isCorrectionEnabled || wordComposer.isMostlyCaps() || wordComposer.isResumed()) { hasAutoCorrection = false; } else if (null != whitelistedWord) { hasAutoCorrection = true; @@ -296,17 +290,12 @@ public class Suggest { // always auto-correct to "Will" which is unwanted. Hence, no main dict => no auto-correct. && hasMainDictionary(); - boolean autoCorrectionAvailable = hasAutoCorrection; - // Don't auto-correct words with multiple capital letter - autoCorrectionAvailable &= !wordComposer.isMostlyCaps(); - autoCorrectionAvailable &= !wordComposer.isResumed(); return new SuggestedWords(suggestionsList, // TODO: this first argument is lying. If this is a whitelisted word which is an // actual word, it says typedWordValid = false, which looks wrong. We should either // rename the attribute or change the value. !isPrediction && !allowsToBeAutoCorrected /* typedWordValid */, - !isPrediction && autoCorrectionAvailable /* hasAutoCorrectionCandidate */, - !isPrediction && allowsToBeAutoCorrected /* allowsToBeAutoCorrected */, + !isPrediction && hasAutoCorrection, /* hasAutoCorrectionCandidate */ false /* isPunctuationSuggestions */, false /* isObsoleteSuggestions */, isPrediction); @@ -356,7 +345,7 @@ public class Suggest { private static SuggestedWordInfo getTransformedSuggestedWordInfo( final SuggestedWordInfo wordInfo, final Locale locale, final boolean isAllUpperCase, final boolean isFirstCharCapitalized, final int trailingSingleQuotesCount) { - final StringBuilder sb = new StringBuilder(getApproxMaxWordLength()); + final StringBuilder sb = new StringBuilder(wordInfo.mWord.length()); if (isAllUpperCase) { sb.append(wordInfo.mWord.toString().toUpperCase(locale)); } else if (isFirstCharCapitalized) { |