Loading java/src/com/android/inputmethod/latin/InputLanguageSelection.java +0 −5 Original line number Diff line number Diff line Loading @@ -89,11 +89,6 @@ public class InputLanguageSelection extends PreferenceActivity { for (int i = 0; i < list.length; i++) { if (lang.equalsIgnoreCase(list[i])) return true; } // If it matches the current locale Locale displayLocale = getResources().getConfiguration().locale; if (lang.equalsIgnoreCase(get5Code(displayLocale))) { return true; } return false; } Loading java/src/com/android/inputmethod/latin/LanguageSwitcher.java +20 −1 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ public class LanguageSwitcher { private int mCurrentIndex = 0; private String mDefaultInputLanguage; private Locale mDefaultInputLocale; private Locale mSystemLocale; public LanguageSwitcher(LatinIME ime) { mIme = ime; Loading Loading @@ -97,7 +98,9 @@ public class LanguageSwitcher { private void constructLocales() { mLocales = new Locale[mSelectedLanguageArray.length]; for (int i = 0; i < mLocales.length; i++) { mLocales[i] = new Locale(mSelectedLanguageArray[i]); final String lang = mSelectedLanguageArray[i]; mLocales[i] = new Locale(lang.substring(0, 2), lang.length() > 4 ? lang.substring(3, 5) : ""); } } Loading Loading @@ -140,6 +143,22 @@ public class LanguageSwitcher { return mLocales[(mCurrentIndex + 1) % mLocales.length]; } /** * Sets the system locale (display UI) used for comparing with the input language. * @param locale the locale of the system */ public void setSystemLocale(Locale locale) { mSystemLocale = locale; } /** * Returns the system locale. * @return the system locale */ public Locale getSystemLocale() { return mSystemLocale; } /** * Returns the previous input locale in the list. Wraps around to the end of the * list if we're at the beginning of the list. Loading java/src/com/android/inputmethod/latin/LatinIME.java +2 −0 Original line number Diff line number Diff line Loading @@ -283,6 +283,7 @@ public class LatinIME extends InputMethodService mKeyboardSwitcher = new KeyboardSwitcher(this, this); mKeyboardSwitcher.setLanguageSwitcher(mLanguageSwitcher); mSystemLocale = conf.locale.toString(); mLanguageSwitcher.setSystemLocale(conf.locale); String inputLanguage = mLanguageSwitcher.getInputLanguage(); if (inputLanguage == null) { inputLanguage = conf.locale.toString(); Loading Loading @@ -368,6 +369,7 @@ public class LatinIME extends InputMethodService if (mLanguageSwitcher != null) { mLanguageSwitcher.loadLocales( PreferenceManager.getDefaultSharedPreferences(this)); mLanguageSwitcher.setSystemLocale(conf.locale); toggleLanguage(true, true); } else { reloadKeyboards(); Loading java/src/com/android/inputmethod/latin/LatinKeyboard.java +7 −0 Original line number Diff line number Diff line Loading @@ -430,6 +430,13 @@ public class LatinKeyboard extends Keyboard { Locale locale = mLanguageSwitcher.getLocaleCount() > 0 ? mLanguageSwitcher.getInputLocale() : null; // If the language count is 1 and is the same as the system language, don't show it. if (locale != null && mLanguageSwitcher.getLocaleCount() == 1 && mLanguageSwitcher.getSystemLocale().getLanguage() .equalsIgnoreCase(locale.getLanguage())) { locale = null; } if (mLocale != null && mLocale.equals(locale)) return; mLocale = locale; updateSpaceBarForLocale(); Loading Loading
java/src/com/android/inputmethod/latin/InputLanguageSelection.java +0 −5 Original line number Diff line number Diff line Loading @@ -89,11 +89,6 @@ public class InputLanguageSelection extends PreferenceActivity { for (int i = 0; i < list.length; i++) { if (lang.equalsIgnoreCase(list[i])) return true; } // If it matches the current locale Locale displayLocale = getResources().getConfiguration().locale; if (lang.equalsIgnoreCase(get5Code(displayLocale))) { return true; } return false; } Loading
java/src/com/android/inputmethod/latin/LanguageSwitcher.java +20 −1 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ public class LanguageSwitcher { private int mCurrentIndex = 0; private String mDefaultInputLanguage; private Locale mDefaultInputLocale; private Locale mSystemLocale; public LanguageSwitcher(LatinIME ime) { mIme = ime; Loading Loading @@ -97,7 +98,9 @@ public class LanguageSwitcher { private void constructLocales() { mLocales = new Locale[mSelectedLanguageArray.length]; for (int i = 0; i < mLocales.length; i++) { mLocales[i] = new Locale(mSelectedLanguageArray[i]); final String lang = mSelectedLanguageArray[i]; mLocales[i] = new Locale(lang.substring(0, 2), lang.length() > 4 ? lang.substring(3, 5) : ""); } } Loading Loading @@ -140,6 +143,22 @@ public class LanguageSwitcher { return mLocales[(mCurrentIndex + 1) % mLocales.length]; } /** * Sets the system locale (display UI) used for comparing with the input language. * @param locale the locale of the system */ public void setSystemLocale(Locale locale) { mSystemLocale = locale; } /** * Returns the system locale. * @return the system locale */ public Locale getSystemLocale() { return mSystemLocale; } /** * Returns the previous input locale in the list. Wraps around to the end of the * list if we're at the beginning of the list. Loading
java/src/com/android/inputmethod/latin/LatinIME.java +2 −0 Original line number Diff line number Diff line Loading @@ -283,6 +283,7 @@ public class LatinIME extends InputMethodService mKeyboardSwitcher = new KeyboardSwitcher(this, this); mKeyboardSwitcher.setLanguageSwitcher(mLanguageSwitcher); mSystemLocale = conf.locale.toString(); mLanguageSwitcher.setSystemLocale(conf.locale); String inputLanguage = mLanguageSwitcher.getInputLanguage(); if (inputLanguage == null) { inputLanguage = conf.locale.toString(); Loading Loading @@ -368,6 +369,7 @@ public class LatinIME extends InputMethodService if (mLanguageSwitcher != null) { mLanguageSwitcher.loadLocales( PreferenceManager.getDefaultSharedPreferences(this)); mLanguageSwitcher.setSystemLocale(conf.locale); toggleLanguage(true, true); } else { reloadKeyboards(); Loading
java/src/com/android/inputmethod/latin/LatinKeyboard.java +7 −0 Original line number Diff line number Diff line Loading @@ -430,6 +430,13 @@ public class LatinKeyboard extends Keyboard { Locale locale = mLanguageSwitcher.getLocaleCount() > 0 ? mLanguageSwitcher.getInputLocale() : null; // If the language count is 1 and is the same as the system language, don't show it. if (locale != null && mLanguageSwitcher.getLocaleCount() == 1 && mLanguageSwitcher.getSystemLocale().getLanguage() .equalsIgnoreCase(locale.getLanguage())) { locale = null; } if (mLocale != null && mLocale.equals(locale)) return; mLocale = locale; updateSpaceBarForLocale(); Loading