aboutsummaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
Diffstat (limited to 'java')
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java6
-rw-r--r--java/src/com/android/inputmethod/latin/SuggestedWords.java16
2 files changed, 14 insertions, 8 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index f41972e8b..def639dce 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -1769,6 +1769,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
// getSuggestedWordBuilder handles gracefully a null value of prevWord
final SuggestedWords.Builder builder = mSuggest.getSuggestedWordBuilder(mWordComposer,
prevWord, mKeyboardSwitcher.getKeyboard().getProximityInfo(), mCorrectionMode);
+ final SuggestedWords suggestions = builder.build();
// Basically, we update the suggestion strip only when suggestion count > 1. However,
// there is an exception: We update the suggestion strip whenever typed word's length
@@ -1776,9 +1777,10 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
// in most cases, suggestion count is 1 when typed word's length is 1, but we do always
// need to clear the previous state when the user starts typing a word (i.e. typed word's
// length == 1).
- if (builder.size() > 1 || typedWord.length() == 1 || !builder.allowsToBeAutoCorrected()
+ if (suggestions.size() > 1 || typedWord.length() == 1
+ || !suggestions.mAllowsToBeAutoCorrected
|| mSuggestionsView.isShowingAddToDictionaryHint()) {
- showSuggestions(builder.build(), typedWord);
+ showSuggestions(suggestions, typedWord);
} else {
SuggestedWords previousSuggestions = mSuggestionsView.getSuggestions();
if (previousSuggestions == mSettingsValues.mSuggestPuncList) {
diff --git a/java/src/com/android/inputmethod/latin/SuggestedWords.java b/java/src/com/android/inputmethod/latin/SuggestedWords.java
index 144e67482..feb26db5a 100644
--- a/java/src/com/android/inputmethod/latin/SuggestedWords.java
+++ b/java/src/com/android/inputmethod/latin/SuggestedWords.java
@@ -25,21 +25,25 @@ import java.util.List;
public class SuggestedWords {
public static final SuggestedWords EMPTY = new SuggestedWords(false, false, false, false,
- Collections.<SuggestedWordInfo>emptyList());
+ false, Collections.<SuggestedWordInfo>emptyList());
public final boolean mTypedWordValid;
public final boolean mHasAutoCorrectionCandidate;
public final boolean mIsPunctuationSuggestions;
+ public final boolean mAllowsToBeAutoCorrected;
private final List<SuggestedWordInfo> mSuggestedWordInfoList;
- SuggestedWords(boolean typedWordValid,
- boolean hasAutoCorrectionCandidate, boolean isPunctuationSuggestions,
- boolean shouldBlockAutoCorrectionBySafetyNet,
- List<SuggestedWordInfo> suggestedWordInfoList) {
+ SuggestedWords(final boolean typedWordValid,
+ final boolean hasAutoCorrectionCandidate,
+ final boolean isPunctuationSuggestions,
+ final boolean shouldBlockAutoCorrectionBySafetyNet,
+ final boolean allowsToBeAutoCorrected,
+ final List<SuggestedWordInfo> suggestedWordInfoList) {
mTypedWordValid = typedWordValid;
mHasAutoCorrectionCandidate = hasAutoCorrectionCandidate
&& !shouldBlockAutoCorrectionBySafetyNet;
mIsPunctuationSuggestions = isPunctuationSuggestions;
+ mAllowsToBeAutoCorrected = allowsToBeAutoCorrected;
mSuggestedWordInfoList = suggestedWordInfoList;
}
@@ -138,7 +142,7 @@ public class SuggestedWords {
public SuggestedWords build() {
return new SuggestedWords(mTypedWordValid, mHasMinimalSuggestion,
mIsPunctuationSuggestions, mShouldBlockAutoCorrectionBySafetyNet,
- mSuggestedWordInfoList);
+ mAllowsToBeAutoCorrected, mSuggestedWordInfoList);
}
public int size() {