am 132bdd07: Merge "[CS3] Move transformation of words to earlier"

* commit '132bdd079c2d45105263be6e9b7da3106b49a99a':
  [CS3] Move transformation of words to earlier
main
Jean Chalard 2014-06-24 06:18:08 +00:00 committed by Android Git Automerger
commit 2b89efe884
1 changed files with 15 additions and 15 deletions

View File

@ -110,6 +110,21 @@ public final class Suggest {
final boolean isOnlyFirstCharCapitalized =
wordComposer.isOrWillBeOnlyFirstCharCapitalized();
final ArrayList<SuggestedWordInfo> suggestionsContainer =
new ArrayList<>(suggestionResults);
final int suggestionsCount = suggestionsContainer.size();
if (isOnlyFirstCharCapitalized || shouldMakeSuggestionsAllUpperCase
|| 0 != trailingSingleQuotesCount) {
for (int i = 0; i < suggestionsCount; ++i) {
final SuggestedWordInfo wordInfo = suggestionsContainer.get(i);
final SuggestedWordInfo transformedWordInfo = getTransformedSuggestedWordInfo(
wordInfo, suggestionResults.mLocale, shouldMakeSuggestionsAllUpperCase,
isOnlyFirstCharCapitalized, trailingSingleQuotesCount);
suggestionsContainer.set(i, transformedWordInfo);
}
}
SuggestedWordInfo.removeDups(typedWord, suggestionsContainer);
// If resumed, then we don't want to upcase everything: resuming on a fully-capitalized
// words is rarely done to switch to another fully-capitalized word, but usually to a
// normal, non-capitalized suggestion.
@ -167,21 +182,6 @@ public final class Suggest {
suggestionResults.first(), consideredWord, mAutoCorrectionThreshold);
}
final ArrayList<SuggestedWordInfo> suggestionsContainer =
new ArrayList<>(suggestionResults);
final int suggestionsCount = suggestionsContainer.size();
if (isOnlyFirstCharCapitalized || shouldMakeSuggestionsAllUpperCase
|| 0 != trailingSingleQuotesCount) {
for (int i = 0; i < suggestionsCount; ++i) {
final SuggestedWordInfo wordInfo = suggestionsContainer.get(i);
final SuggestedWordInfo transformedWordInfo = getTransformedSuggestedWordInfo(
wordInfo, suggestionResults.mLocale, shouldMakeSuggestionsAllUpperCase,
isOnlyFirstCharCapitalized, trailingSingleQuotesCount);
suggestionsContainer.set(i, transformedWordInfo);
}
}
SuggestedWordInfo.removeDups(typedWord, suggestionsContainer);
if (!TextUtils.isEmpty(typedWord)) {
suggestionsContainer.add(0, new SuggestedWordInfo(typedWord,
SuggestedWordInfo.MAX_SCORE, SuggestedWordInfo.KIND_TYPED,