Move a computation closer to where it's used.
Change-Id: I5aee4c36ceaacbb1dbfc47c011f1e4aec4b9dca6
This commit is contained in:
parent
eb5ffdac90
commit
ca3e7cbdf4
1 changed files with 8 additions and 8 deletions
|
@ -296,14 +296,6 @@ public class Suggest implements Dictionary.WordCallback {
|
|||
LatinImeLogger.onAddSuggestedWord(typedWord, Suggest.DIC_USER_TYPED, Dictionary.UNIGRAM);
|
||||
mConsideredWord = consideredWord;
|
||||
|
||||
// TODO: Change this scheme - a boolean is not enough. A whitelisted word may be "valid"
|
||||
// but still autocorrected from - in the case the whitelist only capitalizes the word.
|
||||
// The whitelist should be case-insensitive, so it's not possible to be consistent with
|
||||
// a boolean flag. Right now this is handled with a slight hack in
|
||||
// WhitelistDictionary#shouldForciblyAutoCorrectFrom.
|
||||
final boolean allowsToBeAutoCorrected = AutoCorrection.allowsToBeAutoCorrected(
|
||||
getUnigramDictionaries(), consideredWord, wordComposer.isFirstCharCapitalized());
|
||||
|
||||
if (wordComposer.size() <= 1 && (correctionMode == CORRECTION_FULL_BIGRAM)) {
|
||||
// At first character typed, search only the bigrams
|
||||
Arrays.fill(mBigramScores, 0);
|
||||
|
@ -398,6 +390,14 @@ public class Suggest implements Dictionary.WordCallback {
|
|||
suggestionsList = SuggestedWords.getFromCharSequenceList(mSuggestions);
|
||||
}
|
||||
|
||||
// TODO: Change this scheme - a boolean is not enough. A whitelisted word may be "valid"
|
||||
// but still autocorrected from - in the case the whitelist only capitalizes the word.
|
||||
// The whitelist should be case-insensitive, so it's not possible to be consistent with
|
||||
// a boolean flag. Right now this is handled with a slight hack in
|
||||
// WhitelistDictionary#shouldForciblyAutoCorrectFrom.
|
||||
final boolean allowsToBeAutoCorrected = AutoCorrection.allowsToBeAutoCorrected(
|
||||
getUnigramDictionaries(), consideredWord, wordComposer.isFirstCharCapitalized());
|
||||
|
||||
boolean autoCorrectionAvailable = hasAutoCorrection;
|
||||
if (correctionMode == CORRECTION_FULL || correctionMode == CORRECTION_FULL_BIGRAM) {
|
||||
autoCorrectionAvailable |= !allowsToBeAutoCorrected;
|
||||
|
|
Loading…
Reference in a new issue