aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/LanguageSwitcher.java
diff options
context:
space:
mode:
authorAmith Yamasani <yamasani@google.com>2010-05-04 13:08:44 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2010-05-04 13:08:44 -0700
commitdbab99296343f0359e2a59ec91e383701e185de2 (patch)
tree74f6a00a65e351aeaefcba68ab8dbef26c829a14 /java/src/com/android/inputmethod/latin/LanguageSwitcher.java
parent249cfdaa647f18889f15ac328ee6d1d001abc68f (diff)
parentb1068051c775f395e2e3e75877be74fa62f2a8df (diff)
downloadlatinime-dbab99296343f0359e2a59ec91e383701e185de2.tar.gz
latinime-dbab99296343f0359e2a59ec91e383701e185de2.tar.xz
latinime-dbab99296343f0359e2a59ec91e383701e185de2.zip
am b1068051: am f0296426: Don\'t auto-select the system language in IME language selection screen.
Diffstat (limited to 'java/src/com/android/inputmethod/latin/LanguageSwitcher.java')
-rw-r--r--java/src/com/android/inputmethod/latin/LanguageSwitcher.java21
1 files changed, 20 insertions, 1 deletions
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) : "");
}
}
@@ -141,6 +144,22 @@ public class LanguageSwitcher {
}
/**
+ * 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.
* @return