am 407d23ad: am a5e57d67: Merge "Accept whitelisted entries from any source." into jb-mr1-dev

* commit '407d23ad246cb55e8e6a0138ca39d4d105c5b0a0':
  Accept whitelisted entries from any source.
main
Jean Chalard 2012-08-10 03:21:12 -07:00 committed by Android Git Automerger
commit 9e49160687
1 changed files with 12 additions and 3 deletions

View File

@ -208,15 +208,24 @@ public class Suggest {
wordComposerForLookup, prevWordForBigram, proximityInfo)); wordComposerForLookup, prevWordForBigram, proximityInfo));
} }
final CharSequence whitelistedWord = final CharSequence whitelistedWordFromWhitelistDictionary =
mWhiteListDictionary.getWhitelistedWord(consideredWord); mWhiteListDictionary.getWhitelistedWord(consideredWord);
if (whitelistedWord != null) { if (whitelistedWordFromWhitelistDictionary != null) {
// MAX_SCORE ensures this will be considered strong enough to be auto-corrected // 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, SuggestedWordInfo.MAX_SCORE, SuggestedWordInfo.KIND_WHITELIST,
Dictionary.TYPE_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" // 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. // 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 // The whitelist should be case-insensitive, so it's not possible to be consistent with