Merge "[CS3] Move transformation of words to earlier"
This commit is contained in:
commit
132bdd079c
1 changed files with 15 additions and 15 deletions
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue