mirror of
https://gitlab.futo.org/keyboard/latinime.git
synced 2024-09-28 14:54:30 +01:00
am 740d8290
: Merge "Use localized toLowerString in AutoCorrection.isValidWord"
* commit '740d829092c1900e713293e805ae333e29cb2dd0': Use localized toLowerString in AutoCorrection.isValidWord
This commit is contained in:
commit
24b36ef7a5
@ -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
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user