diff options
Diffstat (limited to 'java/src/com/android/inputmethod/latin/LatinIME.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/LatinIME.java | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index f41972e8b..9f5931de9 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -924,17 +924,17 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar } final List<SuggestedWords.SuggestedWordInfo> applicationSuggestedWords = - SuggestedWords.Builder.getFromApplicationSpecifiedCompletions( + SuggestedWords.getFromApplicationSpecifiedCompletions( applicationSpecifiedCompletions); - SuggestedWords.Builder builder = new SuggestedWords.Builder(applicationSuggestedWords, + final SuggestedWords suggestedWords = new SuggestedWords( + applicationSuggestedWords, false /* typedWordValid */, - false /* hasMinimalSuggestion */, + false /* hasAutoCorrectionCandidate */, false /* allowsToBeAutoCorrected */, false /* isPunctuationSuggestions */); // When in fullscreen mode, show completions generated by the application - final SuggestedWords words = builder.build(); final boolean isAutoCorrection = false; - setSuggestions(words, isAutoCorrection); + setSuggestions(suggestedWords, isAutoCorrection); setAutoCorrectionIndicator(isAutoCorrection); // TODO: is this the right thing to do? What should we auto-correct to in // this case? This says to keep whatever the user typed. @@ -1767,7 +1767,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar final CharSequence typedWord = mWordComposer.getTypedWord(); // getSuggestedWordBuilder handles gracefully a null value of prevWord - final SuggestedWords.Builder builder = mSuggest.getSuggestedWordBuilder(mWordComposer, + final SuggestedWords suggestedWords = mSuggest.getSuggestedWords(mWordComposer, prevWord, mKeyboardSwitcher.getKeyboard().getProximityInfo(), mCorrectionMode); // Basically, we update the suggestion strip only when suggestion count > 1. However, @@ -1776,24 +1776,25 @@ 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 (suggestedWords.size() > 1 || typedWord.length() == 1 + || !suggestedWords.mAllowsToBeAutoCorrected || mSuggestionsView.isShowingAddToDictionaryHint()) { - showSuggestions(builder.build(), typedWord); + showSuggestions(suggestedWords, typedWord); } else { SuggestedWords previousSuggestions = mSuggestionsView.getSuggestions(); if (previousSuggestions == mSettingsValues.mSuggestPuncList) { previousSuggestions = SuggestedWords.EMPTY; } final ArrayList<SuggestedWords.SuggestedWordInfo> typedWordAndPreviousSuggestions = - SuggestedWords.Builder.getTypedWordAndPreviousSuggestions( + SuggestedWords.getTypedWordAndPreviousSuggestions( typedWord, previousSuggestions); - final SuggestedWords.Builder obsoleteSuggestionsBuilder = - new SuggestedWords.Builder(typedWordAndPreviousSuggestions, + final SuggestedWords obsoleteSuggestedWords = + new SuggestedWords(typedWordAndPreviousSuggestions, false /* typedWordValid */, - false /* hasMinimalSuggestion */, + false /* hasAutoCorrectionCandidate */, false /* allowsToBeAutoCorrected */, false /* isPunctuationSuggestions */); - showSuggestions(obsoleteSuggestionsBuilder.build(), typedWord); + showSuggestions(obsoleteSuggestedWords, typedWord); } } @@ -1973,23 +1974,23 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar return; } - final SuggestedWords.Builder builder; + final SuggestedWords suggestedWords; if (mCorrectionMode == Suggest.CORRECTION_FULL_BIGRAM) { final CharSequence prevWord = EditingUtils.getThisWord(getCurrentInputConnection(), mSettingsValues.mWordSeparators); if (!TextUtils.isEmpty(prevWord)) { - builder = mSuggest.getBigramPredictionWordBuilder(prevWord); + suggestedWords = mSuggest.getBigramPredictions(prevWord); } else { - builder = null; + suggestedWords = null; } } else { - builder = null; + suggestedWords = null; } - if (null != builder && builder.size() > 0) { + if (null != suggestedWords && suggestedWords.size() > 0) { // Explicitly supply an empty typed word (the no-second-arg version of // showSuggestions will retrieve the word near the cursor, we don't want that here) - showSuggestions(builder.build(), ""); + showSuggestions(suggestedWords, ""); } else { if (!isShowingPunctuationList()) setPunctuationSuggestions(); } |