diff options
author | 2012-08-10 03:19:08 -0700 | |
---|---|---|
committer | 2012-08-10 03:19:08 -0700 | |
commit | 407d23ad246cb55e8e6a0138ca39d4d105c5b0a0 (patch) | |
tree | 4628a4c865fee21eff4f595fb00c324854b8996d /java/src | |
parent | b5cb4447cfbc7d397f4da7d3753431bc97ee445e (diff) | |
parent | a5e57d6755c41d8161bd2de3b76cca6922d61202 (diff) | |
download | latinime-407d23ad246cb55e8e6a0138ca39d4d105c5b0a0.tar.gz latinime-407d23ad246cb55e8e6a0138ca39d4d105c5b0a0.tar.xz latinime-407d23ad246cb55e8e6a0138ca39d4d105c5b0a0.zip |
am a5e57d67: Merge "Accept whitelisted entries from any source." into jb-mr1-dev
* commit 'a5e57d6755c41d8161bd2de3b76cca6922d61202':
Accept whitelisted entries from any source.
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/com/android/inputmethod/latin/Suggest.java | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/java/src/com/android/inputmethod/latin/Suggest.java b/java/src/com/android/inputmethod/latin/Suggest.java index ce27ef4af..8a2341d5e 100644 --- a/java/src/com/android/inputmethod/latin/Suggest.java +++ b/java/src/com/android/inputmethod/latin/Suggest.java @@ -208,15 +208,24 @@ public class Suggest { wordComposerForLookup, prevWordForBigram, proximityInfo)); } - final CharSequence whitelistedWord = + final CharSequence whitelistedWordFromWhitelistDictionary = mWhiteListDictionary.getWhitelistedWord(consideredWord); - if (whitelistedWord != null) { + if (whitelistedWordFromWhitelistDictionary != null) { // MAX_SCORE ensures this will be considered strong enough to be auto-corrected - suggestionsSet.add(new SuggestedWordInfo(whitelistedWord, + suggestionsSet.add(new SuggestedWordInfo(whitelistedWordFromWhitelistDictionary, SuggestedWordInfo.MAX_SCORE, SuggestedWordInfo.KIND_WHITELIST, Dictionary.TYPE_WHITELIST)); } + final CharSequence whitelistedWord; + if (suggestionsSet.isEmpty()) { + whitelistedWord = null; + } else if (SuggestedWordInfo.KIND_WHITELIST != suggestionsSet.first().mKind) { + whitelistedWord = null; + } else { + whitelistedWord = suggestionsSet.first().mWord; + } + // 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 |