From 7575ac70546c6a19331102a7719337614f5e3a0f Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Mon, 23 Jul 2012 11:59:11 +0900 Subject: [PATCH] Update gesture suggestions even when suggestions strip is off Bug: 6852483 Change-Id: I873ae0f2e3bc863e989629f8bc0cc90ee33a4920 --- .../android/inputmethod/latin/LatinIME.java | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index fa027f996..83159cba8 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -1332,13 +1332,15 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen @Override public void onUpdateBatchInput(InputPointers batchPointers) { mWordComposer.setBatchInputPointers(batchPointers); - updateSuggestionStrip(); + final SuggestedWords suggestedWords = getSuggestedWords(); + showSuggestionStrip(suggestedWords, null); } @Override public void onEndBatchInput(InputPointers batchPointers) { mWordComposer.setBatchInputPointers(batchPointers); - final SuggestedWords suggestedWords = updateSuggestionStrip(); + final SuggestedWords suggestedWords = getSuggestedWords(); + showSuggestionStrip(suggestedWords, null); if (suggestedWords == null || suggestedWords.size() == 0) { return; } @@ -1691,8 +1693,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen } } - // TODO: rename this method to updateSuggestionStrip or simply updateSuggestions - private SuggestedWords updateSuggestionStrip() { + private void updateSuggestionStrip() { mHandler.cancelUpdateSuggestionStrip(); // Check if we have a suggestion engine attached. @@ -1702,15 +1703,21 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen + "requested!"); mWordComposer.setAutoCorrection(mWordComposer.getTypedWord()); } - return null; + return; } - final String typedWord = mWordComposer.getTypedWord(); if (!mWordComposer.isComposingWord() && !mCurrentSettings.mBigramPredictionEnabled) { setPunctuationSuggestions(); - return null; + return; } + final SuggestedWords suggestedWords = getSuggestedWords(); + final String typedWord = mWordComposer.getTypedWord(); + showSuggestionStrip(suggestedWords, typedWord); + } + + private SuggestedWords getSuggestedWords() { + final String typedWord = mWordComposer.getTypedWord(); // Get the word on which we should search the bigrams. If we are composing a word, it's // whatever is *before* the half-committed word in the buffer, hence 2; if we aren't, we // should just skip whitespace if any, so 1. @@ -1718,13 +1725,10 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen final CharSequence prevWord = mConnection.getNthPreviousWord(mCurrentSettings.mWordSeparators, mWordComposer.isComposingWord() ? 2 : 1); - SuggestedWords suggestedWords = mSuggest.getSuggestedWords(mWordComposer, + final SuggestedWords suggestedWords = mSuggest.getSuggestedWords(mWordComposer, prevWord, mKeyboardSwitcher.getKeyboard().getProximityInfo(), mCurrentSettings.mCorrectionEnabled); - suggestedWords = maybeRetrieveOlderSuggestions(typedWord, suggestedWords); - - showSuggestionStrip(suggestedWords, typedWord); - return suggestedWords; + return maybeRetrieveOlderSuggestions(typedWord, suggestedWords); } private SuggestedWords maybeRetrieveOlderSuggestions(final CharSequence typedWord,