diff options
author | 2012-06-28 13:11:55 +0900 | |
---|---|---|
committer | 2012-06-28 19:10:24 +0900 | |
commit | 33b3805e79ab168500ac3bba2c349ef6ea0755f5 (patch) | |
tree | 5c638c33eac8cfba8bfa43b677cb0281624d2a69 /java/src | |
parent | b7cdafd78a7e97c70ceaa3349197eb012e69cc3f (diff) | |
download | latinime-33b3805e79ab168500ac3bba2c349ef6ea0755f5.tar.gz latinime-33b3805e79ab168500ac3bba2c349ef6ea0755f5.tar.xz latinime-33b3805e79ab168500ac3bba2c349ef6ea0755f5.zip |
Small refactoring (A3)
This will help make upcoming changes clearer
Change-Id: Ida8d4935f7315e5da6007ad364124694da3112d0
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/com/android/inputmethod/latin/Suggest.java | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/java/src/com/android/inputmethod/latin/Suggest.java b/java/src/com/android/inputmethod/latin/Suggest.java index baf24c8ae..a1f1ea4a5 100644 --- a/java/src/com/android/inputmethod/latin/Suggest.java +++ b/java/src/com/android/inputmethod/latin/Suggest.java @@ -249,13 +249,13 @@ public class Suggest { transformedWordInfo.mSourceDict); } - final SuggestedWordInfo bestSuggestion = suggestionsContainer.isEmpty() - ? null : suggestionsContainer.get(0); final CharSequence whitelistedWord = capitalizeWord(isAllUpperCase, isFirstCharCapitalized, mWhiteListDictionary.getWhitelistedWord(consideredWord)); final boolean hasAutoCorrection; if (isCorrectionEnabled) { + final SuggestedWordInfo bestSuggestion = suggestionsSet.isEmpty() + ? null : suggestionsSet.first(); final CharSequence autoCorrection = AutoCorrection.computeAutoCorrectionWord(mDictionaries, wordComposer, bestSuggestion, consideredWord, mAutoCorrectionThreshold, @@ -266,19 +266,21 @@ public class Suggest { } if (whitelistedWord != null) { + final SuggestedWordInfo whitelistSuggestion; if (trailingSingleQuotesCount > 0) { final StringBuilder sb = new StringBuilder(whitelistedWord); for (int i = trailingSingleQuotesCount - 1; i >= 0; --i) { sb.appendCodePoint(Keyboard.CODE_SINGLE_QUOTE); } - suggestionsContainer.add(0, new SuggestedWordInfo(sb.toString(), + whitelistSuggestion = new SuggestedWordInfo(sb.toString(), SuggestedWordInfo.MAX_SCORE, SuggestedWordInfo.KIND_WHITELIST, - Dictionary.TYPE_WHITELIST)); + Dictionary.TYPE_WHITELIST); } else { - suggestionsContainer.add(0, new SuggestedWordInfo(whitelistedWord, + whitelistSuggestion = new SuggestedWordInfo(whitelistedWord, SuggestedWordInfo.MAX_SCORE, SuggestedWordInfo.KIND_WHITELIST, - Dictionary.TYPE_WHITELIST)); + Dictionary.TYPE_WHITELIST); } + suggestionsContainer.add(0, whitelistSuggestion); } if (!isPrediction) { |