From ed83d4b14366b9799bf94c3f3486dc14ebd15d0f Mon Sep 17 00:00:00 2001 From: Jean Chalard Date: Thu, 28 Jun 2012 13:52:48 +0900 Subject: [PATCH] Stop special-casing a single suggestion (A6) Treat it like the others Change-Id: Ic24e40ada0e75773c3ece9470ab61c350697be5d --- .../android/inputmethod/latin/Suggest.java | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/java/src/com/android/inputmethod/latin/Suggest.java b/java/src/com/android/inputmethod/latin/Suggest.java index ac73bd76d..d12d81a28 100644 --- a/java/src/com/android/inputmethod/latin/Suggest.java +++ b/java/src/com/android/inputmethod/latin/Suggest.java @@ -221,17 +221,6 @@ public class Suggest { } } - final ArrayList suggestionsContainer = - new ArrayList(suggestionsSet); - for (int i = 0; i < suggestionsContainer.size(); ++i) { - final SuggestedWordInfo wordInfo = suggestionsContainer.get(i); - final SuggestedWordInfo transformedWordInfo = getTransformedSuggestedWordInfo(wordInfo, - mLocale, isAllUpperCase, isFirstCharCapitalized, trailingSingleQuotesCount); - suggestionsContainer.set(i, transformedWordInfo); - LatinImeLogger.onAddSuggestedWord(transformedWordInfo.mWord.toString(), - transformedWordInfo.mSourceDict); - } - final CharSequence whitelistedWord = mWhiteListDictionary.getWhitelistedWord(consideredWord); @@ -253,8 +242,18 @@ public class Suggest { whitelistSuggestion = new SuggestedWordInfo(whitelistedWord, SuggestedWordInfo.MAX_SCORE, SuggestedWordInfo.KIND_WHITELIST, Dictionary.TYPE_WHITELIST); - suggestionsContainer.add(0, getTransformedSuggestedWordInfo(whitelistSuggestion, - mLocale, isAllUpperCase, isFirstCharCapitalized, trailingSingleQuotesCount)); + suggestionsSet.add(whitelistSuggestion); + } + + final ArrayList suggestionsContainer = + new ArrayList(suggestionsSet); + for (int i = 0; i < suggestionsContainer.size(); ++i) { + final SuggestedWordInfo wordInfo = suggestionsContainer.get(i); + final SuggestedWordInfo transformedWordInfo = getTransformedSuggestedWordInfo(wordInfo, + mLocale, isAllUpperCase, isFirstCharCapitalized, trailingSingleQuotesCount); + suggestionsContainer.set(i, transformedWordInfo); + LatinImeLogger.onAddSuggestedWord(transformedWordInfo.mWord.toString(), + transformedWordInfo.mSourceDict); } if (!isPrediction) {