aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2010-11-24 17:02:50 -0800
committerTadashi G. Takaoka <takaoka@google.com>2010-12-01 22:53:06 +0900
commit8d7ecc70a6572c288064e41235e4ae8ad5b1b47e (patch)
tree65edbd36324a054b4608806f72bc07827f79956d /java/src/com/android/inputmethod/latin/KeyboardSwitcher.java
parentdedb26f639083905c05d94cedc426820b2372937 (diff)
downloadlatinime-8d7ecc70a6572c288064e41235e4ae8ad5b1b47e.tar.gz
latinime-8d7ecc70a6572c288064e41235e4ae8ad5b1b47e.tar.xz
latinime-8d7ecc70a6572c288064e41235e4ae8ad5b1b47e.zip
Load keyboard only when subtype is keyboard mode
Bug: 3224990 Change-Id: I1ae1d86dce923464d4474fc7ce02f2ff22067603
Diffstat (limited to 'java/src/com/android/inputmethod/latin/KeyboardSwitcher.java')
-rw-r--r--java/src/com/android/inputmethod/latin/KeyboardSwitcher.java23
1 files changed, 15 insertions, 8 deletions
diff --git a/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java b/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java
index af1575f06..00b6f0a43 100644
--- a/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java
+++ b/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java
@@ -296,7 +296,6 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
final SoftReference<LatinKeyboard> ref = mKeyboardCache.get(id);
LatinKeyboard keyboard = (ref == null) ? null : ref.get();
if (keyboard == null) {
- final Resources res = mInputMethodService.getResources();
final Locale savedLocale = mSubtypeSwitcher.changeSystemLocale(
mSubtypeSwitcher.getInputLocale());
@@ -668,11 +667,12 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
return mInputView;
}
- public void loadKeyboardView() {
- loadKeyboardViewInternal(mLayoutId, true);
+ public LatinKeyboardView onCreateInputView() {
+ createInputViewInternal(mLayoutId, true);
+ return mInputView;
}
- private void loadKeyboardViewInternal(int newLayout, boolean forceReset) {
+ private void createInputViewInternal(int newLayout, boolean forceReset) {
if (mLayoutId != newLayout || mInputView == null || forceReset) {
if (mInputView != null) {
mInputView.closing();
@@ -701,24 +701,31 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
mInputView.setOnKeyboardActionListener(mInputMethodService);
mLayoutId = newLayout;
}
- // TODO: Not to post if this function was called from loadKeyboardView
+ }
+
+ private void postSetInputView() {
mInputMethodService.mHandler.post(new Runnable() {
+ @Override
public void run() {
if (mInputView != null) {
mInputMethodService.setInputView(mInputView);
}
mInputMethodService.updateInputViewShown();
- }});
+ }
+ });
}
+ @Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
if (PREF_KEYBOARD_LAYOUT.equals(key)) {
final int layoutId = Integer.valueOf(
sharedPreferences.getString(key, DEFAULT_LAYOUT_ID));
- loadKeyboardViewInternal(layoutId, false);
+ createInputViewInternal(layoutId, false);
+ postSetInputView();
} else if (LatinIMESettings.PREF_SETTINGS_KEY.equals(key)) {
mHasSettingsKey = getSettingsKeyMode(sharedPreferences, mInputMethodService);
- loadKeyboardViewInternal(mLayoutId, true);
+ createInputViewInternal(mLayoutId, true);
+ postSetInputView();
}
}