Fix a bug with auto-caps entries from personalization

Bug: 13215163
Change-Id: I00099cb4927c96de46e57e14ab906d41c9c2151a
main
Jean Chalard 2014-02-27 14:40:54 +09:00
parent 8c1e3280f9
commit 71e3ecd0a2
1 changed files with 6 additions and 3 deletions

View File

@ -133,12 +133,17 @@ public final class Suggest {
mDictionaryFacilitator.getSuggestions(wordComposerForLookup, prevWordForBigram, mDictionaryFacilitator.getSuggestions(wordComposerForLookup, prevWordForBigram,
proximityInfo, blockOffensiveWords, additionalFeaturesOptions, SESSION_TYPING, proximityInfo, blockOffensiveWords, additionalFeaturesOptions, SESSION_TYPING,
suggestionsSet, rawSuggestions); suggestionsSet, rawSuggestions);
final boolean isFirstCharCapitalized = wordComposer.isFirstCharCapitalized();
final boolean isAllUpperCase = wordComposer.isAllUpperCase();
final String firstSuggestion; final String firstSuggestion;
final String whitelistedWord; final String whitelistedWord;
if (suggestionsSet.isEmpty()) { if (suggestionsSet.isEmpty()) {
whitelistedWord = firstSuggestion = null; whitelistedWord = firstSuggestion = null;
} else { } else {
final SuggestedWordInfo firstSuggestedWordInfo = suggestionsSet.first(); final SuggestedWordInfo firstSuggestedWordInfo = getTransformedSuggestedWordInfo(
suggestionsSet.first(), mLocale, isAllUpperCase, isFirstCharCapitalized,
trailingSingleQuotesCount);
firstSuggestion = firstSuggestedWordInfo.mWord; firstSuggestion = firstSuggestedWordInfo.mWord;
if (SuggestedWordInfo.KIND_WHITELIST != firstSuggestedWordInfo.mKind) { if (SuggestedWordInfo.KIND_WHITELIST != firstSuggestedWordInfo.mKind) {
whitelistedWord = null; whitelistedWord = null;
@ -189,8 +194,6 @@ public final class Suggest {
final ArrayList<SuggestedWordInfo> suggestionsContainer = final ArrayList<SuggestedWordInfo> suggestionsContainer =
CollectionUtils.newArrayList(suggestionsSet); CollectionUtils.newArrayList(suggestionsSet);
final int suggestionsCount = suggestionsContainer.size(); final int suggestionsCount = suggestionsContainer.size();
final boolean isFirstCharCapitalized = wordComposer.isFirstCharCapitalized();
final boolean isAllUpperCase = wordComposer.isAllUpperCase();
if (isFirstCharCapitalized || isAllUpperCase || 0 != trailingSingleQuotesCount) { if (isFirstCharCapitalized || isAllUpperCase || 0 != trailingSingleQuotesCount) {
for (int i = 0; i < suggestionsCount; ++i) { for (int i = 0; i < suggestionsCount; ++i) {
final SuggestedWordInfo wordInfo = suggestionsContainer.get(i); final SuggestedWordInfo wordInfo = suggestionsContainer.get(i);