Merge "Some readability improvement"
This commit is contained in:
commit
eb5ffdac90
1 changed files with 7 additions and 14 deletions
|
@ -293,8 +293,7 @@ public class Suggest implements Dictionary.WordCallback {
|
||||||
? typedWord.substring(0, typedWord.length() - mTrailingSingleQuotesCount)
|
? typedWord.substring(0, typedWord.length() - mTrailingSingleQuotesCount)
|
||||||
: typedWord;
|
: typedWord;
|
||||||
// Treating USER_TYPED as UNIGRAM suggestion for logging now.
|
// Treating USER_TYPED as UNIGRAM suggestion for logging now.
|
||||||
LatinImeLogger.onAddSuggestedWord(typedWord, Suggest.DIC_USER_TYPED,
|
LatinImeLogger.onAddSuggestedWord(typedWord, Suggest.DIC_USER_TYPED, Dictionary.UNIGRAM);
|
||||||
Dictionary.UNIGRAM);
|
|
||||||
mConsideredWord = consideredWord;
|
mConsideredWord = consideredWord;
|
||||||
|
|
||||||
// TODO: Change this scheme - a boolean is not enough. A whitelisted word may be "valid"
|
// TODO: Change this scheme - a boolean is not enough. A whitelisted word may be "valid"
|
||||||
|
@ -363,12 +362,11 @@ public class Suggest implements Dictionary.WordCallback {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CharSequence whitelistedWord = capitalizeWord(mIsAllUpperCase, mIsFirstCharCapitalized,
|
final CharSequence whitelistedWord = capitalizeWord(mIsAllUpperCase,
|
||||||
mWhiteListDictionary.getWhitelistedWord(consideredWord));
|
mIsFirstCharCapitalized, mWhiteListDictionary.getWhitelistedWord(consideredWord));
|
||||||
|
|
||||||
final boolean hasAutoCorrection;
|
final boolean hasAutoCorrection;
|
||||||
if (CORRECTION_FULL == correctionMode
|
if (CORRECTION_FULL == correctionMode || CORRECTION_FULL_BIGRAM == correctionMode) {
|
||||||
|| CORRECTION_FULL_BIGRAM == correctionMode) {
|
|
||||||
final CharSequence autoCorrection =
|
final CharSequence autoCorrection =
|
||||||
AutoCorrection.computeAutoCorrectionWord(mUnigramDictionaries, wordComposer,
|
AutoCorrection.computeAutoCorrectionWord(mUnigramDictionaries, wordComposer,
|
||||||
mSuggestions, mScores, consideredWord, mAutoCorrectionThreshold,
|
mSuggestions, mScores, consideredWord, mAutoCorrectionThreshold,
|
||||||
|
@ -401,24 +399,19 @@ public class Suggest implements Dictionary.WordCallback {
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean autoCorrectionAvailable = hasAutoCorrection;
|
boolean autoCorrectionAvailable = hasAutoCorrection;
|
||||||
if (correctionMode == Suggest.CORRECTION_FULL
|
if (correctionMode == CORRECTION_FULL || correctionMode == CORRECTION_FULL_BIGRAM) {
|
||||||
|| correctionMode == Suggest.CORRECTION_FULL_BIGRAM) {
|
|
||||||
autoCorrectionAvailable |= !allowsToBeAutoCorrected;
|
autoCorrectionAvailable |= !allowsToBeAutoCorrected;
|
||||||
}
|
}
|
||||||
// Don't auto-correct words with multiple capital letter
|
// Don't auto-correct words with multiple capital letter
|
||||||
autoCorrectionAvailable &= !wordComposer.isMostlyCaps();
|
autoCorrectionAvailable &= !wordComposer.isMostlyCaps();
|
||||||
final boolean shouldBlockAutoCorrectionBySatefyNet;
|
|
||||||
if (allowsToBeAutoCorrected && suggestionsList.size() > 1 && mAutoCorrectionThreshold > 0
|
if (allowsToBeAutoCorrected && suggestionsList.size() > 1 && mAutoCorrectionThreshold > 0
|
||||||
&& Suggest.shouldBlockAutoCorrectionBySafetyNet(typedWord,
|
&& Suggest.shouldBlockAutoCorrectionBySafetyNet(typedWord,
|
||||||
suggestionsList.get(1).mWord)) {
|
suggestionsList.get(1).mWord)) {
|
||||||
shouldBlockAutoCorrectionBySatefyNet = true;
|
autoCorrectionAvailable = false;
|
||||||
} else {
|
|
||||||
shouldBlockAutoCorrectionBySatefyNet = false;
|
|
||||||
}
|
}
|
||||||
return new SuggestedWords(suggestionsList,
|
return new SuggestedWords(suggestionsList,
|
||||||
!allowsToBeAutoCorrected /* typedWordValid */,
|
!allowsToBeAutoCorrected /* typedWordValid */,
|
||||||
autoCorrectionAvailable & !shouldBlockAutoCorrectionBySatefyNet
|
autoCorrectionAvailable /* hasAutoCorrectionCandidate */,
|
||||||
/* hasAutoCorrectionCandidate */,
|
|
||||||
allowsToBeAutoCorrected /* allowsToBeAutoCorrected */,
|
allowsToBeAutoCorrected /* allowsToBeAutoCorrected */,
|
||||||
false /* isPunctuationSuggestions */);
|
false /* isPunctuationSuggestions */);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue