diff options
author | 2012-06-28 20:04:00 +0900 | |
---|---|---|
committer | 2012-07-02 15:45:58 +0900 | |
commit | 2631e3b1954eb0f9ddd637f8ad89fd0eff495c77 (patch) | |
tree | 3bd29e01bfe2998f9e370688299986b0cb231fed /java/src | |
parent | 79f531784818115241c660f71f25cbba520d566c (diff) | |
download | latinime-2631e3b1954eb0f9ddd637f8ad89fd0eff495c77.tar.gz latinime-2631e3b1954eb0f9ddd637f8ad89fd0eff495c77.tar.xz latinime-2631e3b1954eb0f9ddd637f8ad89fd0eff495c77.zip |
Small refactoring (A39)
Change-Id: I3c45b5a6571f986acc7adb3a8fe17b210303f7ea
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/com/android/inputmethod/latin/Suggest.java | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/java/src/com/android/inputmethod/latin/Suggest.java b/java/src/com/android/inputmethod/latin/Suggest.java index e4f823791..9e53cfc3c 100644 --- a/java/src/com/android/inputmethod/latin/Suggest.java +++ b/java/src/com/android/inputmethod/latin/Suggest.java @@ -217,6 +217,20 @@ public class Suggest { } } + // TODO: Change this scheme - a boolean is not enough. A whitelisted word may be "valid" + // but still autocorrected from - in the case the whitelist only capitalizes the word. + // The whitelist should be case-insensitive, so it's not possible to be consistent with + // a boolean flag. Right now this is handled with a slight hack in + // WhitelistDictionary#shouldForciblyAutoCorrectFrom. + final boolean allowsToBeAutoCorrected = AutoCorrection.isWhitelistedOrNotAWord( + mDictionaries, consideredWord, wordComposer.isFirstCharCapitalized()) + // If we don't have a main dictionary, we never want to auto-correct. The reason for this + // is, the user may have a contact whose name happens to match a valid word in their + // language, and it will unexpectedly auto-correct. For example, if the user types in + // English with no dictionary and has a "Will" in their contact list, "will" would + // always auto-correct to "Will" which is unwanted. Hence, no main dict => no auto-correct. + && hasMainDictionary(); + final CharSequence whitelistedWord = mWhiteListDictionary.getWhitelistedWord(consideredWord); @@ -276,20 +290,6 @@ public class Suggest { suggestionsList = suggestionsContainer; } - // TODO: Change this scheme - a boolean is not enough. A whitelisted word may be "valid" - // but still autocorrected from - in the case the whitelist only capitalizes the word. - // The whitelist should be case-insensitive, so it's not possible to be consistent with - // a boolean flag. Right now this is handled with a slight hack in - // WhitelistDictionary#shouldForciblyAutoCorrectFrom. - final boolean allowsToBeAutoCorrected = AutoCorrection.isWhitelistedOrNotAWord( - mDictionaries, consideredWord, wordComposer.isFirstCharCapitalized()) - // If we don't have a main dictionary, we never want to auto-correct. The reason for this - // is, the user may have a contact whose name happens to match a valid word in their - // language, and it will unexpectedly auto-correct. For example, if the user types in - // English with no dictionary and has a "Will" in their contact list, "will" would - // always auto-correct to "Will" which is unwanted. Hence, no main dict => no auto-correct. - && hasMainDictionary(); - 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 |