aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/LatinIME.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/src/com/android/inputmethod/latin/LatinIME.java')
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java27
1 files changed, 19 insertions, 8 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index dc5bd2efc..def639dce 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -72,6 +72,7 @@ import com.android.inputmethod.latin.suggestions.SuggestionsView;
import java.io.FileDescriptor;
import java.io.PrintWriter;
+import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
@@ -925,10 +926,11 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
final List<SuggestedWords.SuggestedWordInfo> applicationSuggestedWords =
SuggestedWords.Builder.getFromApplicationSpecifiedCompletions(
applicationSpecifiedCompletions);
- SuggestedWords.Builder builder = new SuggestedWords.Builder()
- .addWords(applicationSuggestedWords)
- .setTypedWordValid(false)
- .setHasMinimalSuggestion(false);
+ SuggestedWords.Builder builder = new SuggestedWords.Builder(applicationSuggestedWords,
+ false /* typedWordValid */,
+ false /* hasMinimalSuggestion */,
+ false /* allowsToBeAutoCorrected */,
+ false /* isPunctuationSuggestions */);
// When in fullscreen mode, show completions generated by the application
final SuggestedWords words = builder.build();
final boolean isAutoCorrection = false;
@@ -1767,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
@@ -1774,16 +1777,24 @@ 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) {
previousSuggestions = SuggestedWords.EMPTY;
}
- final SuggestedWords.Builder obsoleteSuggestionsBuilder = new SuggestedWords.Builder()
- .addTypedWordAndPreviousSuggestions(typedWord, previousSuggestions);
+ final ArrayList<SuggestedWords.SuggestedWordInfo> typedWordAndPreviousSuggestions =
+ SuggestedWords.Builder.getTypedWordAndPreviousSuggestions(
+ typedWord, previousSuggestions);
+ final SuggestedWords.Builder obsoleteSuggestionsBuilder =
+ new SuggestedWords.Builder(typedWordAndPreviousSuggestions,
+ false /* typedWordValid */,
+ false /* hasMinimalSuggestion */,
+ false /* allowsToBeAutoCorrected */,
+ false /* isPunctuationSuggestions */);
showSuggestions(obsoleteSuggestionsBuilder.build(), typedWord);
}
}