diff options
author | 2012-08-08 20:00:18 -0700 | |
---|---|---|
committer | 2012-08-08 20:00:19 -0700 | |
commit | 9abea49dd4f3428acb60f35ea7a8ff53aa2e2af7 (patch) | |
tree | 217196eaa01c111e48e05774b5e6f23a5116bf7e /java/src/com/android/inputmethod/latin/LatinIME.java | |
parent | 60d4961f346dadf274f49e0f15c87dcffe8f5820 (diff) | |
parent | 8335c59ea7715f3dbc6625f128a7a038f314a89f (diff) | |
download | latinime-9abea49dd4f3428acb60f35ea7a8ff53aa2e2af7.tar.gz latinime-9abea49dd4f3428acb60f35ea7a8ff53aa2e2af7.tar.xz latinime-9abea49dd4f3428acb60f35ea7a8ff53aa2e2af7.zip |
Merge "Fix NPE and don't call UI API from non-UI thread" into jb-mr1-dev
Diffstat (limited to 'java/src/com/android/inputmethod/latin/LatinIME.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/LatinIME.java | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 43901bab4..894b69b79 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -433,10 +433,14 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen resetContactsDictionary(null == mSuggest ? null : mSuggest.getContactsDictionary()); } + // Note that this method is called from a non-UI thread. @Override public void onUpdateMainDictionaryAvailability(boolean isMainDictionaryAvailable) { mIsMainDictionaryAvailable = isMainDictionaryAvailable; - updateKeyboardViewGestureHandlingModeByMainDictionaryAvailability(); + final MainKeyboardView mainKeyboardView = mKeyboardSwitcher.getMainKeyboardView(); + if (mainKeyboardView != null) { + mainKeyboardView.setMainDictionaryAvailability(isMainDictionaryAvailable); + } } private void initSuggest() { @@ -701,7 +705,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen } switcher.loadKeyboard(editorInfo, mCurrentSettings); - updateKeyboardViewGestureHandlingModeByMainDictionaryAvailability(); } setSuggestionStripShownInternal( isSuggestionsStripVisible(), /* needsInputViewShown */ false); @@ -721,6 +724,9 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen mainKeyboardView.setKeyPreviewPopupEnabled(mCurrentSettings.mKeyPreviewPopupOn, mCurrentSettings.mKeyPreviewPopupDismissDelay); + mainKeyboardView.setGestureHandlingEnabledByUser(mCurrentSettings.mGestureInputEnabled); + mainKeyboardView.setGesturePreviewMode(mCurrentSettings.mGesturePreviewTrailEnabled, + mCurrentSettings.mGestureFloatingPreviewTextEnabled); if (TRACE) Debug.startMethodTracing("/data/trace/latinime"); } @@ -2103,7 +2109,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen if (mKeyboardSwitcher.getMainKeyboardView() != null) { // Reload keyboard because the current language has been changed. mKeyboardSwitcher.loadKeyboard(getCurrentInputEditorInfo(), mCurrentSettings); - updateKeyboardViewGestureHandlingModeByMainDictionaryAvailability(); } // Since we just changed languages, we should re-evaluate suggestions with whatever word // we are currently composing. If we are not composing anything, we may want to display @@ -2111,17 +2116,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen mHandler.postUpdateSuggestionStrip(); } - private void updateKeyboardViewGestureHandlingModeByMainDictionaryAvailability() { - final MainKeyboardView mainKeyboardView = mKeyboardSwitcher.getMainKeyboardView(); - if (mainKeyboardView != null) { - final boolean shouldHandleGesture = mCurrentSettings.mGestureInputEnabled - && mIsMainDictionaryAvailable; - mainKeyboardView.setGestureHandlingMode(shouldHandleGesture, - mCurrentSettings.mGesturePreviewTrailEnabled, - mCurrentSettings.mGestureFloatingPreviewTextEnabled); - } - } - // TODO: Remove this method from {@link LatinIME} and move {@link FeedbackManager} to // {@link KeyboardSwitcher}. Called from KeyboardSwitcher public void hapticAndAudioFeedback(final int primaryCode) { |