diff options
author | 2012-06-28 19:45:24 +0900 | |
---|---|---|
committer | 2012-07-02 15:45:34 +0900 | |
commit | cd288620ea92580152afe4a6cfe20622a2aeba41 (patch) | |
tree | 7537ce9646fa826bb150c12d4ddc7b2c7f4db8ed /java/src | |
parent | bd1d7114883877ffa1f650ce901e31720199b02a (diff) | |
download | latinime-cd288620ea92580152afe4a6cfe20622a2aeba41.tar.gz latinime-cd288620ea92580152afe4a6cfe20622a2aeba41.tar.xz latinime-cd288620ea92580152afe4a6cfe20622a2aeba41.zip |
Make the autocorrection scheme more straightforward (A37)
Change-Id: I4833ca7e057b8c1f1f22390673cbca0d2433b1bd
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/com/android/inputmethod/latin/Suggest.java | 2 | ||||
-rw-r--r-- | java/src/com/android/inputmethod/latin/SuggestedWords.java | 11 |
2 files changed, 7 insertions, 6 deletions
diff --git a/java/src/com/android/inputmethod/latin/Suggest.java b/java/src/com/android/inputmethod/latin/Suggest.java index 70751c107..1625f515f 100644 --- a/java/src/com/android/inputmethod/latin/Suggest.java +++ b/java/src/com/android/inputmethod/latin/Suggest.java @@ -295,7 +295,7 @@ public class Suggest { // actual word, it says typedWordValid = false, which looks wrong. We should either // rename the attribute or change the value. !isPrediction && !allowsToBeAutoCorrected /* typedWordValid */, - !isPrediction && hasAutoCorrection, /* hasAutoCorrectionCandidate */ + !isPrediction && hasAutoCorrection && allowsToBeAutoCorrected, /* willAutoCorrect */ false /* isPunctuationSuggestions */, false /* isObsoleteSuggestions */, isPrediction); diff --git a/java/src/com/android/inputmethod/latin/SuggestedWords.java b/java/src/com/android/inputmethod/latin/SuggestedWords.java index 8cc284226..94af301a2 100644 --- a/java/src/com/android/inputmethod/latin/SuggestedWords.java +++ b/java/src/com/android/inputmethod/latin/SuggestedWords.java @@ -28,7 +28,9 @@ public class SuggestedWords { new ArrayList<SuggestedWordInfo>(0), false, false, false, false, false); public final boolean mTypedWordValid; - private final boolean mHasAutoCorrectionCandidate; + // Note: this INCLUDES cases where the word will auto-correct to itself. A good definition + // of what this flag means would be "the top suggestion is strong enough to auto-correct", + // whether this exactly matches the user entry or not. public final boolean mWillAutoCorrect; public final boolean mIsPunctuationSuggestions; public final boolean mIsObsoleteSuggestions; @@ -37,14 +39,13 @@ public class SuggestedWords { public SuggestedWords(final ArrayList<SuggestedWordInfo> suggestedWordInfoList, final boolean typedWordValid, - final boolean hasAutoCorrectionCandidate, + final boolean willAutoCorrect, final boolean isPunctuationSuggestions, final boolean isObsoleteSuggestions, final boolean isPrediction) { mSuggestedWordInfoList = suggestedWordInfoList; mTypedWordValid = typedWordValid; - mHasAutoCorrectionCandidate = hasAutoCorrectionCandidate; - mWillAutoCorrect = !mTypedWordValid && mHasAutoCorrectionCandidate; + mWillAutoCorrect = willAutoCorrect; mIsPunctuationSuggestions = isPunctuationSuggestions; mIsObsoleteSuggestions = isObsoleteSuggestions; mIsPrediction = isPrediction; @@ -75,7 +76,7 @@ public class SuggestedWords { // Pretty-print method to help debug return "SuggestedWords:" + " mTypedWordValid=" + mTypedWordValid - + " mHasAutoCorrectionCandidate=" + mHasAutoCorrectionCandidate + + " mWillAutoCorrect=" + mWillAutoCorrect + " mIsPunctuationSuggestions=" + mIsPunctuationSuggestions + " words=" + Arrays.toString(mSuggestedWordInfoList.toArray()); } |