Small refactoring (A3)
This will help make upcoming changes clearer Change-Id: Ida8d4935f7315e5da6007ad364124694da3112d0main
parent
b7cdafd78a
commit
33b3805e79
|
@ -249,13 +249,13 @@ public class Suggest {
|
||||||
transformedWordInfo.mSourceDict);
|
transformedWordInfo.mSourceDict);
|
||||||
}
|
}
|
||||||
|
|
||||||
final SuggestedWordInfo bestSuggestion = suggestionsContainer.isEmpty()
|
|
||||||
? null : suggestionsContainer.get(0);
|
|
||||||
final CharSequence whitelistedWord = capitalizeWord(isAllUpperCase,
|
final CharSequence whitelistedWord = capitalizeWord(isAllUpperCase,
|
||||||
isFirstCharCapitalized, mWhiteListDictionary.getWhitelistedWord(consideredWord));
|
isFirstCharCapitalized, mWhiteListDictionary.getWhitelistedWord(consideredWord));
|
||||||
|
|
||||||
final boolean hasAutoCorrection;
|
final boolean hasAutoCorrection;
|
||||||
if (isCorrectionEnabled) {
|
if (isCorrectionEnabled) {
|
||||||
|
final SuggestedWordInfo bestSuggestion = suggestionsSet.isEmpty()
|
||||||
|
? null : suggestionsSet.first();
|
||||||
final CharSequence autoCorrection =
|
final CharSequence autoCorrection =
|
||||||
AutoCorrection.computeAutoCorrectionWord(mDictionaries, wordComposer,
|
AutoCorrection.computeAutoCorrectionWord(mDictionaries, wordComposer,
|
||||||
bestSuggestion, consideredWord, mAutoCorrectionThreshold,
|
bestSuggestion, consideredWord, mAutoCorrectionThreshold,
|
||||||
|
@ -266,19 +266,21 @@ public class Suggest {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (whitelistedWord != null) {
|
if (whitelistedWord != null) {
|
||||||
|
final SuggestedWordInfo whitelistSuggestion;
|
||||||
if (trailingSingleQuotesCount > 0) {
|
if (trailingSingleQuotesCount > 0) {
|
||||||
final StringBuilder sb = new StringBuilder(whitelistedWord);
|
final StringBuilder sb = new StringBuilder(whitelistedWord);
|
||||||
for (int i = trailingSingleQuotesCount - 1; i >= 0; --i) {
|
for (int i = trailingSingleQuotesCount - 1; i >= 0; --i) {
|
||||||
sb.appendCodePoint(Keyboard.CODE_SINGLE_QUOTE);
|
sb.appendCodePoint(Keyboard.CODE_SINGLE_QUOTE);
|
||||||
}
|
}
|
||||||
suggestionsContainer.add(0, new SuggestedWordInfo(sb.toString(),
|
whitelistSuggestion = new SuggestedWordInfo(sb.toString(),
|
||||||
SuggestedWordInfo.MAX_SCORE, SuggestedWordInfo.KIND_WHITELIST,
|
SuggestedWordInfo.MAX_SCORE, SuggestedWordInfo.KIND_WHITELIST,
|
||||||
Dictionary.TYPE_WHITELIST));
|
Dictionary.TYPE_WHITELIST);
|
||||||
} else {
|
} else {
|
||||||
suggestionsContainer.add(0, new SuggestedWordInfo(whitelistedWord,
|
whitelistSuggestion = new SuggestedWordInfo(whitelistedWord,
|
||||||
SuggestedWordInfo.MAX_SCORE, SuggestedWordInfo.KIND_WHITELIST,
|
SuggestedWordInfo.MAX_SCORE, SuggestedWordInfo.KIND_WHITELIST,
|
||||||
Dictionary.TYPE_WHITELIST));
|
Dictionary.TYPE_WHITELIST);
|
||||||
}
|
}
|
||||||
|
suggestionsContainer.add(0, whitelistSuggestion);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isPrediction) {
|
if (!isPrediction) {
|
||||||
|
|
Loading…
Reference in New Issue