diff options
author | 2010-11-26 13:08:36 +0900 | |
---|---|---|
committer | 2010-11-26 18:48:04 +0900 | |
commit | 27d13713bbb291d25a910f97d88a81fdbabddc0e (patch) | |
tree | 4b801bfc9fc0de6a39a43b834e5aca9d49fbe99e /java/src/com/android/inputmethod/latin/KeyboardSwitcher.java | |
parent | 7f0befe1f0e346ec6468f229f337eda32e19f6d8 (diff) | |
download | latinime-27d13713bbb291d25a910f97d88a81fdbabddc0e.tar.gz latinime-27d13713bbb291d25a910f97d88a81fdbabddc0e.tar.xz latinime-27d13713bbb291d25a910f97d88a81fdbabddc0e.zip |
Preload SharedPreferences at start.
bug: 3207554
Change-Id: I84072461aee9675cc67897de03f89e9c0036bc1f
Diffstat (limited to 'java/src/com/android/inputmethod/latin/KeyboardSwitcher.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/KeyboardSwitcher.java | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java b/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java index b08b97a81..3f7715329 100644 --- a/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java +++ b/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java @@ -60,6 +60,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha private static final int SYMBOLS_MODE_STATE_SYMBOL = 2; private SubtypeSwitcher mSubtypeSwitcher; + private SharedPreferences mPrefs; private LatinKeyboardView mInputView; private LatinIME mInputMethodService; @@ -105,11 +106,11 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha private KeyboardSwitcher() { } - public static void init(LatinIME ims) { + public static void init(LatinIME ims, SharedPreferences prefs) { sInstance.mInputMethodService = ims; + sInstance.mPrefs = prefs; sInstance.mSubtypeSwitcher = SubtypeSwitcher.getInstance(); - final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(ims); sInstance.mLayoutId = Integer.valueOf( prefs.getString(PREF_KEYBOARD_LAYOUT, DEFAULT_LAYOUT_ID)); prefs.registerOnSharedPreferenceChangeListener(sInstance); @@ -282,9 +283,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha mVoiceButtonOnPrimary = voiceButtonOnPrimary; mIsSymbols = isSymbols; // Update the settings key state because number of enabled IMEs could have been changed - mHasSettingsKey = getSettingsKeyMode( - PreferenceManager.getDefaultSharedPreferences(mInputMethodService), - mInputMethodService); + mHasSettingsKey = getSettingsKeyMode(mPrefs, mInputMethodService); makeSymbolsKeyboardIds(); KeyboardId id = getKeyboardId(mode, imeOptions, isSymbols); |