diff options
author | 2011-10-12 23:44:54 -0700 | |
---|---|---|
committer | 2011-10-12 23:44:54 -0700 | |
commit | 605a6fea750c4acc96a5136ecaf7162e0a858b9f (patch) | |
tree | ce110e0665dda3f5a32998361b498f6b00b2380d /java/src/com/android/inputmethod/latin/SuggestedWords.java | |
parent | 8a4472f0ecd774757c7077a40585f2d05e4f9210 (diff) | |
parent | 2aa1dd45c44295e2f7e8ece1b520032d86b9f908 (diff) | |
download | latinime-605a6fea750c4acc96a5136ecaf7162e0a858b9f.tar.gz latinime-605a6fea750c4acc96a5136ecaf7162e0a858b9f.tar.xz latinime-605a6fea750c4acc96a5136ecaf7162e0a858b9f.zip |
Merge "Fix the safety net Bug: 5453150" into ics-mr0
Diffstat (limited to 'java/src/com/android/inputmethod/latin/SuggestedWords.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/SuggestedWords.java | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/java/src/com/android/inputmethod/latin/SuggestedWords.java b/java/src/com/android/inputmethod/latin/SuggestedWords.java index 005db36bd..ed6359cfa 100644 --- a/java/src/com/android/inputmethod/latin/SuggestedWords.java +++ b/java/src/com/android/inputmethod/latin/SuggestedWords.java @@ -29,12 +29,13 @@ public class SuggestedWords { public final List<CharSequence> mWords; public final boolean mTypedWordValid; - public final boolean mHasMinimalSuggestion; + public final boolean mHasAutoCorrectionCandidate; public final boolean mIsPunctuationSuggestions; private final List<SuggestedWordInfo> mSuggestedWordInfoList; + private boolean mShouldBlockAutoCorrection; private SuggestedWords(List<CharSequence> words, boolean typedWordValid, - boolean hasMinimalSuggestion, boolean isPunctuationSuggestions, + boolean hasAutoCorrectionCandidate, boolean isPunctuationSuggestions, List<SuggestedWordInfo> suggestedWordInfoList) { if (words != null) { mWords = words; @@ -42,9 +43,10 @@ public class SuggestedWords { mWords = Collections.emptyList(); } mTypedWordValid = typedWordValid; - mHasMinimalSuggestion = hasMinimalSuggestion; + mHasAutoCorrectionCandidate = hasAutoCorrectionCandidate; mIsPunctuationSuggestions = isPunctuationSuggestions; mSuggestedWordInfoList = suggestedWordInfoList; + mShouldBlockAutoCorrection = false; } public int size() { @@ -60,17 +62,25 @@ public class SuggestedWords { } public boolean hasAutoCorrectionWord() { - return mHasMinimalSuggestion && size() > 1 && !mTypedWordValid; + return mHasAutoCorrectionCandidate && size() > 1 && !mTypedWordValid; } public boolean hasWordAboveAutoCorrectionScoreThreshold() { - return mHasMinimalSuggestion && ((size() > 1 && !mTypedWordValid) || mTypedWordValid); + return mHasAutoCorrectionCandidate && ((size() > 1 && !mTypedWordValid) || mTypedWordValid); } public boolean isPunctuationSuggestions() { return mIsPunctuationSuggestions; } + public void setShouldBlockAutoCorrection() { + mShouldBlockAutoCorrection = true; + } + + public boolean shouldBlockAutoCorrection() { + return mShouldBlockAutoCorrection; + } + public static class Builder { private List<CharSequence> mWords = new ArrayList<CharSequence>(); private boolean mTypedWordValid; @@ -176,6 +186,7 @@ public class SuggestedWords { return mWords.get(pos); } + @Override public String toString() { // Pretty-print method to help debug final StringBuilder sb = new StringBuilder("StringBuilder: mTypedWordValid = " |