aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2012-08-10 14:50:30 +0900
committerJean Chalard <jchalard@google.com>2012-08-10 19:02:19 +0900
commit7b258e512dc2a8c821eb9f435e5719b8a967b441 (patch)
tree2fdcb89b4156353c06213f55b3eff12a592a3fb3 /java/src
parentcaed149b67be378adf49f3db16a2cfbb8dd15d84 (diff)
downloadlatinime-7b258e512dc2a8c821eb9f435e5719b8a967b441.tar.gz
latinime-7b258e512dc2a8c821eb9f435e5719b8a967b441.tar.xz
latinime-7b258e512dc2a8c821eb9f435e5719b8a967b441.zip
Accept whitelisted entries from any source.
...not only the WhitelistDictionary. Bug: 6906525 Change-Id: I7f181eb6936ec17bbccdc4e736fd09292af24e9c
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/latin/Suggest.java15
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