Merge "Fix a bug where autotext would occasionally not work"

main
Jean Chalard 2011-08-31 22:42:11 -07:00 committed by Android (Google) Code Review
commit b17300e2f0
1 changed files with 5 additions and 15 deletions

View File

@ -371,24 +371,14 @@ public class Suggest implements Dictionary.WordCallback {
// Apply quick fix only for the typed word. // Apply quick fix only for the typed word.
if (mQuickFixesEnabled) { if (mQuickFixesEnabled) {
final String lowerCaseTypedWord = typedWordString.toLowerCase(); final String lowerCaseTypedWord = typedWordString.toLowerCase();
CharSequence tempAutoText = capitalizeWord(
mIsAllUpperCase, mIsFirstCharCapitalized, AutoText.get(
lowerCaseTypedWord, 0, lowerCaseTypedWord.length(), view));
// TODO: cleanup canAdd
// Is there an AutoText (also known as Quick Fixes) correction? // Is there an AutoText (also known as Quick Fixes) correction?
// Capitalize as needed // Capitalize as needed
boolean canAdd = tempAutoText != null; autoText = capitalizeWord(mIsAllUpperCase, mIsFirstCharCapitalized, AutoText.get(
// Is that correction already the current prediction (or original word)? lowerCaseTypedWord, 0, lowerCaseTypedWord.length(), view));
canAdd &= !TextUtils.equals(tempAutoText, typedWord); if (DBG) {
// Is that correction already the next predicted word? if (autoText != null) {
if (canAdd && mSuggestions.size() > 0 && mCorrectionMode != CORRECTION_BASIC) { Log.d(TAG, "Auto corrected by AUTOTEXT: " + typedWord + " -> " + autoText);
canAdd &= !TextUtils.equals(tempAutoText, mSuggestions.get(0));
}
if (canAdd) {
if (DBG) {
Log.d(TAG, "Auto corrected by AUTOTEXT.");
} }
autoText = tempAutoText;
} }
} }
} }