Merge "Use localized toLowerString in AutoCorrection.isValidWord"

main
Tadashi G. Takaoka 2013-05-24 20:00:38 +00:00 committed by Android (Google) Code Review
commit 740d829092
3 changed files with 6 additions and 5 deletions

View File

@ -32,12 +32,13 @@ public final class AutoCorrection {
// Purely static class: can't instantiate.
}
public static boolean isValidWord(final ConcurrentHashMap<String, Dictionary> dictionaries,
final String word, final boolean ignoreCase) {
public static boolean isValidWord(final Suggest suggest, final String word,
final boolean ignoreCase) {
if (TextUtils.isEmpty(word)) {
return false;
}
final String lowerCasedWord = word.toLowerCase();
final ConcurrentHashMap<String, Dictionary> dictionaries = suggest.getUnigramDictionaries();
final String lowerCasedWord = word.toLowerCase(suggest.mLocale);
for (final String key : dictionaries.keySet()) {
final Dictionary dictionary = dictionaries.get(key);
// It's unclear how realistically 'dictionary' can be null, but the monkey is somehow

View File

@ -2371,7 +2371,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
final boolean showingAddToDictionaryHint =
SuggestedWordInfo.KIND_TYPED == suggestionInfo.mKind && mSuggest != null
// If the suggestion is not in the dictionary, the hint should be shown.
&& !AutoCorrection.isValidWord(mSuggest.getUnigramDictionaries(), suggestion, true);
&& !AutoCorrection.isValidWord(mSuggest, suggestion, true);
if (mSettings.isInternal()) {
Stats.onSeparator((char)Constants.CODE_SPACE,

View File

@ -229,7 +229,7 @@ public final class Suggest {
// or if it's a 2+ characters non-word (i.e. it's not in the dictionary).
final boolean allowsToBeAutoCorrected = (null != whitelistedWord
&& !whitelistedWord.equals(consideredWord))
|| (consideredWord.length() > 1 && !AutoCorrection.isValidWord(mDictionaries,
|| (consideredWord.length() > 1 && !AutoCorrection.isValidWord(this,
consideredWord, wordComposer.isFirstCharCapitalized()));
final boolean hasAutoCorrection;