aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/InputLanguageSelection.java
diff options
context:
space:
mode:
authorsatok <satok@google.com>2011-04-18 20:23:39 +0900
committersatok <satok@google.com>2011-04-18 20:28:36 +0900
commit88808fcdd41c901072f3d224fa109182b26af22d (patch)
tree558214811f8730bac313e8916f8d3d1190d55f70 /java/src/com/android/inputmethod/latin/InputLanguageSelection.java
parentbc3dba451a7af85eab600968fbafda3040b7ced4 (diff)
downloadlatinime-88808fcdd41c901072f3d224fa109182b26af22d.tar.gz
latinime-88808fcdd41c901072f3d224fa109182b26af22d.tar.xz
latinime-88808fcdd41c901072f3d224fa109182b26af22d.zip
Show all languages supported in LatinImeGoogle in InputLanguageSelection
Bug: 4311203 Change-Id: I7a94e9697758cb79743c026e7f1c023f618a9aa1
Diffstat (limited to 'java/src/com/android/inputmethod/latin/InputLanguageSelection.java')
-rw-r--r--java/src/com/android/inputmethod/latin/InputLanguageSelection.java54
1 files changed, 30 insertions, 24 deletions
diff --git a/java/src/com/android/inputmethod/latin/InputLanguageSelection.java b/java/src/com/android/inputmethod/latin/InputLanguageSelection.java
index be5e015aa..40ab28c98 100644
--- a/java/src/com/android/inputmethod/latin/InputLanguageSelection.java
+++ b/java/src/com/android/inputmethod/latin/InputLanguageSelection.java
@@ -162,36 +162,42 @@ public class InputLanguageSelection extends PreferenceActivity {
for (int i = 0 ; i < origSize; i++ ) {
String s = locales[i];
int len = s.length();
+ String language = "";
+ String country = "";
if (len == 5) {
- String language = s.substring(0, 2);
- String country = s.substring(3, 5);
- Locale l = new Locale(language, country);
+ language = s.substring(0, 2);
+ country = s.substring(3, 5);
+ } else if (len < 5) {
+ language = s;
+ }
+ Locale l = new Locale(language, country);
- // Exclude languages that are not relevant to LatinIME
- if (arrayContains(BLACKLIST_LANGUAGES, language)) continue;
+ // Exclude languages that are not relevant to LatinIME
+ if (arrayContains(BLACKLIST_LANGUAGES, language) || TextUtils.isEmpty(language)) {
+ continue;
+ }
- if (finalSize == 0) {
+ if (finalSize == 0) {
+ preprocess[finalSize++] =
+ new Loc(SubtypeSwitcher.getFullDisplayName(l, true), l);
+ } else {
+ // check previous entry:
+ // same lang and a country -> upgrade to full name and
+ // insert ours with full name
+ // diff lang -> insert ours with lang-only name
+ if (preprocess[finalSize-1].mLocale.getLanguage().equals(
+ language)) {
+ preprocess[finalSize-1].setLabel(SubtypeSwitcher.getFullDisplayName(
+ preprocess[finalSize-1].mLocale, false));
preprocess[finalSize++] =
- new Loc(SubtypeSwitcher.getFullDisplayName(l, true), l);
+ new Loc(SubtypeSwitcher.getFullDisplayName(l, false), l);
} else {
- // check previous entry:
- // same lang and a country -> upgrade to full name and
- // insert ours with full name
- // diff lang -> insert ours with lang-only name
- if (preprocess[finalSize-1].mLocale.getLanguage().equals(
- language)) {
- preprocess[finalSize-1].setLabel(SubtypeSwitcher.getFullDisplayName(
- preprocess[finalSize-1].mLocale, false));
- preprocess[finalSize++] =
- new Loc(SubtypeSwitcher.getFullDisplayName(l, false), l);
+ String displayName;
+ if (s.equals("zz_ZZ")) {
+ // ignore this locale
} else {
- String displayName;
- if (s.equals("zz_ZZ")) {
- // ignore this locale
- } else {
- displayName = SubtypeSwitcher.getFullDisplayName(l, true);
- preprocess[finalSize++] = new Loc(displayName, l);
- }
+ displayName = SubtypeSwitcher.getFullDisplayName(l, true);
+ preprocess[finalSize++] = new Loc(displayName, l);
}
}
}