diff options
author | 2014-11-24 13:48:16 -0800 | |
---|---|---|
committer | 2014-12-16 15:56:00 -0800 | |
commit | bc4ae6bdc0249f9282efea5d1fe7ccfefd6f93b0 (patch) | |
tree | c6b34da6729328cd1cab530c5134135a079f09a8 /java/src/com/android/inputmethod/latin/LatinIME.java | |
parent | 2c826fd28eb48bd44e8c3e465f90e99bb22649ac (diff) | |
download | latinime-bc4ae6bdc0249f9282efea5d1fe7ccfefd6f93b0.tar.gz latinime-bc4ae6bdc0249f9282efea5d1fe7ccfefd6f93b0.tar.xz latinime-bc4ae6bdc0249f9282efea5d1fe7ccfefd6f93b0.zip |
Passing account info to dictionaryFacilitator
Attempt to use dictionary facilitor without invoking
preference manager. Instead use account from settings only when
things are being reset/changed. Discussion forked from ag/591663
Overall, the idea here is to maintain an account information
inside dictionary groups. Reset the dictionary groups if
account changes (the way we do for locale). Since only user
history dictionary is currently affected, the check to reset user
history dictionary also includes the check to verify the account.
For other things remain the same.
SettingsValues holds the current account (and is updated if prefs change
due to change in account settings). The updated settings are then
propagated to dictionary facilitator via LatinIME#loadSettings.
Bug:18104749,18469539
Change-Id: I553e776e7ea125d0fb7a1fe70a4c7eb0b2277fb8
Diffstat (limited to 'java/src/com/android/inputmethod/latin/LatinIME.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/LatinIME.java | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index d6ec57fe6..1525a9264 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -633,12 +633,13 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen // been displayed. Opening dictionaries never affects responsivity as dictionaries are // asynchronously loaded. if (!mHandler.hasPendingReopenDictionaries()) { - resetDictionaryFacilitatorForLocale(locales); + resetDictionaryFacilitator(locales); } mDictionaryFacilitator.updateEnabledSubtypes(mRichImm.getMyEnabledInputMethodSubtypeList( true /* allowsImplicitlySelectedSubtypes */)); refreshPersonalizationDictionarySession(currentSettingsValues); mStatsUtilsManager.onLoadSettings(currentSettingsValues); + resetDictionaryFacilitatorIfNecessary(); } private void refreshPersonalizationDictionarySession( @@ -676,7 +677,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen void resetDictionaryFacilitatorIfNecessary() { final Locale[] subtypeSwitcherLocales = mRichImm.getCurrentSubtypeLocales(); - if (mDictionaryFacilitator.isForLocales(subtypeSwitcherLocales)) { + if (mDictionaryFacilitator.isForLocales(subtypeSwitcherLocales) + && mDictionaryFacilitator.isForAccount(mSettings.getCurrent().mAccount)) { return; } final Locale[] subtypeLocales; @@ -690,20 +692,23 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen } else { subtypeLocales = subtypeSwitcherLocales; } - resetDictionaryFacilitatorForLocale(subtypeLocales); + resetDictionaryFacilitator(subtypeLocales); } /** - * Reset the facilitator by loading dictionaries for the locales and the current settings values + * Reset the facilitator by loading dictionaries for the locales and + * the current settings values. * * @param locales the locales */ - // TODO: make sure the current settings always have the right locales, and read from them - private void resetDictionaryFacilitatorForLocale(final Locale[] locales) { + // TODO: make sure the current settings always have the right locales, and read from them. + private void resetDictionaryFacilitator(final Locale[] locales) { final SettingsValues settingsValues = mSettings.getCurrent(); mDictionaryFacilitator.resetDictionaries(this /* context */, locales, settingsValues.mUseContactsDict, settingsValues.mUsePersonalizedDicts, - false /* forceReloadMainDictionary */, this); + false /* forceReloadMainDictionary */, + settingsValues.mAccount, + this /* DictionaryInitializationListener */); if (settingsValues.mAutoCorrectionEnabledPerUserSettings) { mInputLogic.mSuggest.setAutoCorrectionThreshold( settingsValues.mAutoCorrectionThreshold); @@ -718,7 +723,10 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen final SettingsValues settingsValues = mSettings.getCurrent(); mDictionaryFacilitator.resetDictionaries(this /* context */, mDictionaryFacilitator.getLocales(), settingsValues.mUseContactsDict, - settingsValues.mUsePersonalizedDicts, true /* forceReloadMainDictionary */, this); + settingsValues.mUsePersonalizedDicts, + true /* forceReloadMainDictionary */, + settingsValues.mAccount, + this /* DictionaryInitializationListener */); } @Override @@ -1934,7 +1942,9 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen final SettingsValues settingsValues = mSettings.getCurrent(); mDictionaryFacilitator.resetDictionaries(this, new Locale[] { locale }, settingsValues.mUseContactsDict, settingsValues.mUsePersonalizedDicts, - false /* forceReloadMainDictionary */, this /* listener */); + false /* forceReloadMainDictionary */, + settingsValues.mAccount, + this /* DictionaryInitializationListener */); } // DO NOT USE THIS for any other purpose than testing. |