am 74224f2c: [QRP2] Small refactor

* commit '74224f2c5c1b54b459d885eb9695e10fb5f24ede':
  [QRP2] Small refactor
This commit is contained in:
Jean Chalard 2014-02-25 00:18:43 -08:00 committed by Android Git Automerger
commit 030b22c1db

View file

@ -147,6 +147,8 @@ public final class Suggest {
} }
} }
final boolean isPrediction = !wordComposer.isComposingWord();
// We allow auto-correction if we have a whitelisted word, or if the word is not a valid // We allow auto-correction if we have a whitelisted word, or if the word is not a valid
// word of more than 1 char, except if the first suggestion is the same as the typed string // word of more than 1 char, except if the first suggestion is the same as the typed string
// because in this case if it's strong enough to auto-correct that will mistakenly designate // because in this case if it's strong enough to auto-correct that will mistakenly designate
@ -165,7 +167,7 @@ public final class Suggest {
// same time, it feels wrong that the SuggestedWord object includes information about // same time, it feels wrong that the SuggestedWord object includes information about
// the current settings. It may also be useful to know, when the setting is off, whether // the current settings. It may also be useful to know, when the setting is off, whether
// the word *would* have been auto-corrected. // the word *would* have been auto-corrected.
if (!isCorrectionEnabled || !allowsToBeAutoCorrected || !wordComposer.isComposingWord() if (!isCorrectionEnabled || !allowsToBeAutoCorrected || isPrediction
|| suggestionsSet.isEmpty() || wordComposer.hasDigits() || suggestionsSet.isEmpty() || wordComposer.hasDigits()
|| wordComposer.isMostlyCaps() || wordComposer.isResumed() || wordComposer.isMostlyCaps() || wordComposer.isResumed()
|| !mDictionaryFacilitator.hasMainDictionary() || !mDictionaryFacilitator.hasMainDictionary()
@ -227,8 +229,7 @@ public final class Suggest {
// rename the attribute or change the value. // rename the attribute or change the value.
!allowsToBeAutoCorrected /* typedWordValid */, !allowsToBeAutoCorrected /* typedWordValid */,
hasAutoCorrection, /* willAutoCorrect */ hasAutoCorrection, /* willAutoCorrect */
false /* isObsoleteSuggestions */, false /* isObsoleteSuggestions */, isPrediction, sequenceNumber));
!wordComposer.isComposingWord() /* isPrediction */, sequenceNumber));
} }
// Retrieves suggestions for the batch input // Retrieves suggestions for the batch input