From f02964264f196447b03a88591a2964b67c318718 Mon Sep 17 00:00:00 2001 From: Amith Yamasani Date: Mon, 3 May 2010 11:14:31 -0700 Subject: Don't auto-select the system language in IME language selection screen. Fixes http://b/2650378 On entering the selection screen, don't add the system language in addition to other selected languages. Change-Id: Id7a3b45df39a8493d17be668029eee139bf00ff3 --- .../android/inputmethod/latin/LanguageSwitcher.java | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'java/src/com/android/inputmethod/latin/LanguageSwitcher.java') diff --git a/java/src/com/android/inputmethod/latin/LanguageSwitcher.java b/java/src/com/android/inputmethod/latin/LanguageSwitcher.java index 12045125f..578c80526 100644 --- a/java/src/com/android/inputmethod/latin/LanguageSwitcher.java +++ b/java/src/com/android/inputmethod/latin/LanguageSwitcher.java @@ -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; @@ -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) : ""); } } @@ -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. -- cgit v1.2.3-83-g751a