From 305326e789c3a89517855cc5a023ed1aa3074dc0 Mon Sep 17 00:00:00 2001 From: Jean Chalard Date: Thu, 28 Jun 2012 15:48:23 +0900 Subject: [PATCH] Refactoring and add debug prints (A9) Change-Id: I46497bff107f0def0dfa2b043b20d9a0b0cde040 --- .../com/android/inputmethod/latin/LatinIME.java | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index f806286d9..97665ecf6 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -1685,6 +1685,9 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen } public void updateSuggestions() { + mHandler.cancelUpdateSuggestions(); + mHandler.cancelUpdateBigramPredictions(); + // Check if we have a suggestion engine attached. if ((mSuggest == null || !mCurrentSettings.isSuggestionsRequested(mDisplayOrientation))) { if (mWordComposer.isComposingWord()) { @@ -1694,10 +1697,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen return; } - mHandler.cancelUpdateSuggestions(); - mHandler.cancelUpdateBigramPredictions(); - if (!mWordComposer.isComposingWord()) { + // This is dead code: we can't come here with an empty word composer. setPunctuationSuggestions(); return; } @@ -1908,8 +1909,16 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen } public void updateBigramPredictions() { - if (mSuggest == null || !mCurrentSettings.isSuggestionsRequested(mDisplayOrientation)) + mHandler.cancelUpdateSuggestions(); + mHandler.cancelUpdateBigramPredictions(); + + if (mSuggest == null || !mCurrentSettings.isSuggestionsRequested(mDisplayOrientation)) { + if (mWordComposer.isComposingWord()) { + Log.w(TAG, "Called updateBigramPredictions but suggestions were not requested!"); + mWordComposer.setAutoCorrection(mWordComposer.getTypedWord()); + } return; + } if (!mCurrentSettings.mBigramPredictionEnabled) { setPunctuationSuggestions();