Switch keyboards when configuration changes. Bug 2432435

main
Amith Yamasani 2010-02-21 15:59:15 -08:00
parent a6a6617101
commit a9f4b19ca4
1 changed files with 12 additions and 2 deletions

View File

@ -360,8 +360,18 @@ public class LatinIME extends InputMethodService
@Override @Override
public void onConfigurationChanged(Configuration conf) { public void onConfigurationChanged(Configuration conf) {
// If the system locale changes and is different from the saved
// locale (mLocale), then reload the input locale list from the
// latin ime settings (shared prefs) and reset the input locale
// to the first one.
if (!TextUtils.equals(conf.locale.toString(), mLocale)) { if (!TextUtils.equals(conf.locale.toString(), mLocale)) {
initSuggest(conf.locale.toString()); if (mLanguageSwitcher != null) {
mLanguageSwitcher.loadLocales(
PreferenceManager.getDefaultSharedPreferences(this));
toggleLanguage(true, true);
} else {
reloadKeyboards();
}
} }
// If orientation changed while predicting, commit the change // If orientation changed while predicting, commit the change
if (conf.orientation != mOrientation) { if (conf.orientation != mOrientation) {
@ -369,8 +379,8 @@ public class LatinIME extends InputMethodService
commitTyped(ic); commitTyped(ic);
if (ic != null) ic.finishComposingText(); // For voice input if (ic != null) ic.finishComposingText(); // For voice input
mOrientation = conf.orientation; mOrientation = conf.orientation;
reloadKeyboards();
} }
reloadKeyboards();
super.onConfigurationChanged(conf); super.onConfigurationChanged(conf);
} }