[CS3] Move transformation of words to earlier
Bug: 13238601 Change-Id: I37fe66c6152cdf8c60878d5619bb5dc41f3223df
This commit is contained in:
parent
fdebf4005f
commit
1ec3f158d2
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