diff options
| author | satok <satok@google.com> | 2010-11-04 21:17:48 +0900 |
|---|---|---|
| committer | satok <satok@google.com> | 2010-11-05 11:40:56 +0900 |
| commit | 9ef0283bdcd9534cc09ae37eb2b78771b95247b5 (patch) | |
| tree | 2819ed8e9c104af435d741a1778cf1e5f584e078 /services/java/com/android/server/InputMethodManagerService.java | |
| parent | 63cf0279d73937f38def42eeb0ef8278c926e448 (diff) | |
Change API for getting InputMethodSubtype's mode from resource id to String
Change-Id: I00aa99f8ab9901d40806a6bb336ab718eb857e8b
Diffstat (limited to 'services/java/com/android/server/InputMethodManagerService.java')
| -rw-r--r-- | services/java/com/android/server/InputMethodManagerService.java | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/services/java/com/android/server/InputMethodManagerService.java b/services/java/com/android/server/InputMethodManagerService.java index 41471d97f774..d035eb586aad 100644 --- a/services/java/com/android/server/InputMethodManagerService.java +++ b/services/java/com/android/server/InputMethodManagerService.java @@ -1622,15 +1622,12 @@ public class InputMethodManagerService extends IInputMethodManager.Stub if (enabledSubtypeSet.contains(String.valueOf(subtype.hashCode()))) { CharSequence title; int nameResId = subtype.getNameResId(); - int modeResId = subtype.getModeResId(); + String mode = subtype.getMode(); if (nameResId != 0) { title = pm.getText(property.getPackageName(), nameResId, property.getServiceInfo().applicationInfo); } else { CharSequence language = subtype.getLocale(); - CharSequence mode = modeResId == 0 ? null - : pm.getText(property.getPackageName(), modeResId, - property.getServiceInfo().applicationInfo); // TODO: Use more friendly Title and UI title = label + "," + (mode == null ? "" : mode) + "," + (language == null ? "" : language); @@ -1869,14 +1866,17 @@ public class InputMethodManagerService extends IInputMethodManager.Stub int applicableSubtypeId = DEFAULT_SUBTYPE_ID; for (int i = 0; i < subtypes.size(); ++i) { final String subtypeLocale = subtypes.get(i).getLocale(); - if (locale.equals(subtypeLocale)) { - // Exact match (e.g. system locale is "en_US" and subtype locale is "en_US") - applicableSubtypeId = i; - break; - } else if (!partialMatchFound && subtypeLocale.startsWith(language)) { - // Partial match (e.g. system locale is "en_US" and subtype locale is "en") - applicableSubtypeId = i; - partialMatchFound = true; + // An applicable subtype should be a keyboard subtype + if (subtypes.get(i).getMode().equalsIgnoreCase("keyboard")) { + if (locale.equals(subtypeLocale)) { + // Exact match (e.g. system locale is "en_US" and subtype locale is "en_US") + applicableSubtypeId = i; + break; + } else if (!partialMatchFound && subtypeLocale.startsWith(language)) { + // Partial match (e.g. system locale is "en_US" and subtype locale is "en") + applicableSubtypeId = i; + partialMatchFound = true; + } } } |
