aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/LatinIME.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/src/com/android/inputmethod/latin/LatinIME.java')
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java37
1 files changed, 19 insertions, 18 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index d6ec57fe6..45156a31e 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -166,7 +166,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
private RichInputMethodManager mRichImm;
@UsedForTesting final KeyboardSwitcher mKeyboardSwitcher;
- final SubtypeSwitcher mSubtypeSwitcher;
private final SubtypeState mSubtypeState = new SubtypeState();
private final EmojiAltPhysicalKeyDetector mEmojiAltPhysicalKeyDetector =
new EmojiAltPhysicalKeyDetector();
@@ -563,7 +562,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
public LatinIME() {
super();
mSettings = Settings.getInstance();
- mSubtypeSwitcher = SubtypeSwitcher.getInstance();
mKeyboardSwitcher = KeyboardSwitcher.getInstance();
mStatsUtilsManager = StatsUtilsManager.getInstance();
mIsHardwareAcceleratedDrawingEnabled =
@@ -577,7 +575,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
DebugFlags.init(PreferenceManager.getDefaultSharedPreferences(this));
RichInputMethodManager.init(this);
mRichImm = RichInputMethodManager.getInstance();
- SubtypeSwitcher.init(this);
KeyboardSwitcher.init(this);
AudioAndHapticFeedbackManager.init(this);
AccessibilityUtils.init(this);
@@ -633,12 +630,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 +674,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 +689,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 +720,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
@@ -869,7 +874,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
// Note that the calling sequence of onCreate() and onCurrentInputMethodSubtypeChanged()
// is not guaranteed. It may even be called at the same time on a different thread.
mRichImm.onSubtypeChanged(subtype);
- mSubtypeSwitcher.onSubtypeChanged(mRichImm.getCurrentSubtype());
mInputLogic.onSubtypeChanged(SubtypeLocaleUtils.getCombiningRulesExtraValue(subtype),
mSettings.getCurrent());
loadKeyboard();
@@ -886,7 +890,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
// also wouldn't be consuming gesture data.
mGestureConsumer = GestureConsumer.NULL_GESTURE_CONSUMER;
mRichImm.refreshSubtypeCaches();
- mSubtypeSwitcher.onSubtypeChanged(mRichImm.getCurrentSubtype());
final KeyboardSwitcher switcher = mKeyboardSwitcher;
switcher.updateKeyboardTheme();
final MainKeyboardView mainKeyboardView = switcher.getMainKeyboardView();
@@ -948,10 +951,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
Settings.getInstance().getCurrent().mDisplayOrientation,
!isDifferentTextField);
- if (isDifferentTextField) {
- mSubtypeSwitcher.updateParametersOnStartInputView();
- }
-
// The EditorInfo might have a flag that affects fullscreen mode.
// Note: This call should be done by InputMethodService?
updateFullscreenMode();
@@ -1934,7 +1933,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.