Remove useless code (A25)
isWhitelistedOrNotAWord takes an 'ignoreCase' argument. By looking at the contents of the wordcomposer here, there is only one case where its output will be different : when the word is typed with a capital, but the lower case version exists in the dictionary. E.g. the user typed "This". In this case, isWhitelistedOrNotAWord in line 235 will return false instead of true, so the test will score a true instead of a false, so hasAutoCorrection may be true instead of false in this specific case and that's the only case where it's different. But in this case, allowsToBeAutoCorrected is certain to be false, which means the result will not have changed if hasAutoCorrection was true in the first place. So in the end this change is sure not to change the behavior. Change-Id: Ic41cf959c20c19165f84d9b8ff006731fa595d84main
parent
b3cfde2cbb
commit
7a94cbd2a4
|
@ -232,7 +232,7 @@ public class Suggest {
|
|||
} else if (null != whitelistedWord) {
|
||||
hasAutoCorrection = true;
|
||||
} else if (!AutoCorrection.isWhitelistedOrNotAWord(
|
||||
mDictionaries, consideredWord, false)) {
|
||||
mDictionaries, consideredWord, wordComposer.isFirstCharCapitalized())) {
|
||||
hasAutoCorrection = true;
|
||||
} else if (suggestionsSet.isEmpty()) {
|
||||
hasAutoCorrection = false;
|
||||
|
@ -296,9 +296,6 @@ public class Suggest {
|
|||
&& hasMainDictionary();
|
||||
|
||||
boolean autoCorrectionAvailable = hasAutoCorrection;
|
||||
if (isCorrectionEnabled) {
|
||||
autoCorrectionAvailable |= !allowsToBeAutoCorrected;
|
||||
}
|
||||
// Don't auto-correct words with multiple capital letter
|
||||
autoCorrectionAvailable &= !wordComposer.isMostlyCaps();
|
||||
autoCorrectionAvailable &= !wordComposer.isResumed();
|
||||
|
|
Loading…
Reference in New Issue