am 5e5cf045: am 7f7947c9: Keep subtypes in method.xml the same as pre-JellyBean

* commit '5e5cf045ca6debafcc29ae1c47afda4a3a152326':
  Keep subtypes in method.xml the same as pre-JellyBean
main
Tadashi G. Takaoka 2012-06-27 21:58:53 -07:00 committed by Android Git Automerger
commit 69527d4d60
3 changed files with 87 additions and 22 deletions

View File

@ -181,6 +181,52 @@
<!-- Description for Bulgarian (BDS) subtype. --> <!-- Description for Bulgarian (BDS) subtype. -->
<string name="subtype_bulgarian_bds">%s (BDS)</string> <string name="subtype_bulgarian_bds">%s (BDS)</string>
<!-- Compatibility map from subtypeLocale:subtypeExtraValue to keyboardLayoutSet -->
<string-array name="locale_and_extra_value_to_keyboard_layout_set_map">
<item>en_US:TrySuppressingImeSwitcher,AsciiCapable,SupportTouchPositionCorrection</item>
<item>qwerty</item>
<item>en_GB:TrySuppressingImeSwitcher,AsciiCapable,SupportTouchPositionCorrection</item>
<item>qwerty</item>
<item>ar:SupportTouchPositionCorrection</item>
<item>arabic</item>
<item>cs:AsciiCapable,SupportTouchPositionCorrection</item>
<item>qwertz</item>
<item>da:AsciiCapable,SupportTouchPositionCorrection</item>
<item>nordic</item>
<item>de:AsciiCapable,SupportTouchPositionCorrection</item>
<item>qwertz</item>
<item>es:AsciiCapable,SupportTouchPositionCorrection</item>
<item>spanish</item>
<item>fi:AsciiCapable,SupportTouchPositionCorrection</item>
<item>nordic</item>
<item>fr:AsciiCapable,SupportTouchPositionCorrection</item>
<item>azerty</item>
<item>fr_CA:AsciiCapable,SupportTouchPositionCorrection</item>
<item>qwerty</item>
<item>hr:AsciiCapable,SupportTouchPositionCorrection</item>
<item>qwertz</item>
<item>hu:AsciiCapable,SupportTouchPositionCorrection</item>
<item>qwertz</item>
<item>it:AsciiCapable,SupportTouchPositionCorrection</item>
<item>qwerty</item>
<item>iw:SupportTouchPositionCorrection</item>
<item>hebrew</item>
<item>nb:AsciiCapable,SupportTouchPositionCorrection</item>
<item>nordic</item>
<item>nl:AsciiCapable,SupportTouchPositionCorrection</item>
<item>qwerty</item>
<item>pl:AsciiCapable,SupportTouchPositionCorrection</item>
<item>qwerty</item>
<item>ru:SupportTouchPositionCorrection</item>
<item>east_slavic</item>
<item>sr:SupportTouchPositionCorrection</item>
<item>south_slavic</item>
<item>sv:AsciiCapable,SupportTouchPositionCorrection</item>
<item>nordic</item>
<item>tr:AsciiCapable,SupportTouchPositionCorrection</item>
<item>qwerty</item>
</string-array>
<!-- dictionary pack package name /settings activity (for shared prefs and settings) --> <!-- dictionary pack package name /settings activity (for shared prefs and settings) -->
<string name="dictionary_pack_package_name">com.google.android.inputmethod.latin.dictionarypack</string> <string name="dictionary_pack_package_name">com.google.android.inputmethod.latin.dictionarypack</string>
<string name="dictionary_pack_settings_activity">com.google.android.inputmethod.latin.dictionarypack.DictionarySettingsActivity</string> <string name="dictionary_pack_settings_activity">com.google.android.inputmethod.latin.dictionarypack.DictionarySettingsActivity</string>

View File

@ -76,19 +76,19 @@
android:label="@string/subtype_en_US" android:label="@string/subtype_en_US"
android:imeSubtypeLocale="en_US" android:imeSubtypeLocale="en_US"
android:imeSubtypeMode="keyboard" android:imeSubtypeMode="keyboard"
android:imeSubtypeExtraValue="KeyboardLayoutSet=qwerty,TrySuppressingImeSwitcher,AsciiCapable" android:imeSubtypeExtraValue="TrySuppressingImeSwitcher,AsciiCapable,SupportTouchPositionCorrection"
/> />
<subtype android:icon="@drawable/ic_subtype_keyboard" <subtype android:icon="@drawable/ic_subtype_keyboard"
android:label="@string/subtype_en_GB" android:label="@string/subtype_en_GB"
android:imeSubtypeLocale="en_GB" android:imeSubtypeLocale="en_GB"
android:imeSubtypeMode="keyboard" android:imeSubtypeMode="keyboard"
android:imeSubtypeExtraValue="KeyboardLayoutSet=qwerty,TrySuppressingImeSwitcher,AsciiCapable" android:imeSubtypeExtraValue="TrySuppressingImeSwitcher,AsciiCapable,SupportTouchPositionCorrection"
/> />
<subtype android:icon="@drawable/ic_subtype_keyboard" <subtype android:icon="@drawable/ic_subtype_keyboard"
android:label="@string/subtype_generic" android:label="@string/subtype_generic"
android:imeSubtypeLocale="ar" android:imeSubtypeLocale="ar"
android:imeSubtypeMode="keyboard" android:imeSubtypeMode="keyboard"
android:imeSubtypeExtraValue="KeyboardLayoutSet=arabic" android:imeSubtypeExtraValue="SupportTouchPositionCorrection"
/> />
<subtype android:icon="@drawable/ic_subtype_keyboard" <subtype android:icon="@drawable/ic_subtype_keyboard"
android:label="@string/subtype_generic" android:label="@string/subtype_generic"
@ -112,19 +112,19 @@
android:label="@string/subtype_generic" android:label="@string/subtype_generic"
android:imeSubtypeLocale="cs" android:imeSubtypeLocale="cs"
android:imeSubtypeMode="keyboard" android:imeSubtypeMode="keyboard"
android:imeSubtypeExtraValue="KeyboardLayoutSet=qwertz,AsciiCapable" android:imeSubtypeExtraValue="AsciiCapable,SupportTouchPositionCorrection"
/> />
<subtype android:icon="@drawable/ic_subtype_keyboard" <subtype android:icon="@drawable/ic_subtype_keyboard"
android:label="@string/subtype_generic" android:label="@string/subtype_generic"
android:imeSubtypeLocale="da" android:imeSubtypeLocale="da"
android:imeSubtypeMode="keyboard" android:imeSubtypeMode="keyboard"
android:imeSubtypeExtraValue="KeyboardLayoutSet=nordic,AsciiCapable" android:imeSubtypeExtraValue="AsciiCapable,SupportTouchPositionCorrection"
/> />
<subtype android:icon="@drawable/ic_subtype_keyboard" <subtype android:icon="@drawable/ic_subtype_keyboard"
android:label="@string/subtype_generic" android:label="@string/subtype_generic"
android:imeSubtypeLocale="de" android:imeSubtypeLocale="de"
android:imeSubtypeMode="keyboard" android:imeSubtypeMode="keyboard"
android:imeSubtypeExtraValue="KeyboardLayoutSet=qwertz,AsciiCapable" android:imeSubtypeExtraValue="AsciiCapable,SupportTouchPositionCorrection"
/> />
<subtype android:icon="@drawable/ic_subtype_keyboard" <subtype android:icon="@drawable/ic_subtype_keyboard"
android:label="@string/subtype_generic" android:label="@string/subtype_generic"
@ -136,7 +136,7 @@
android:label="@string/subtype_generic" android:label="@string/subtype_generic"
android:imeSubtypeLocale="es" android:imeSubtypeLocale="es"
android:imeSubtypeMode="keyboard" android:imeSubtypeMode="keyboard"
android:imeSubtypeExtraValue="KeyboardLayoutSet=spanish,AsciiCapable" android:imeSubtypeExtraValue="AsciiCapable,SupportTouchPositionCorrection"
/> />
<subtype android:icon="@drawable/ic_subtype_keyboard" <subtype android:icon="@drawable/ic_subtype_keyboard"
android:label="@string/subtype_generic" android:label="@string/subtype_generic"
@ -154,19 +154,19 @@
android:label="@string/subtype_generic" android:label="@string/subtype_generic"
android:imeSubtypeLocale="fi" android:imeSubtypeLocale="fi"
android:imeSubtypeMode="keyboard" android:imeSubtypeMode="keyboard"
android:imeSubtypeExtraValue="KeyboardLayoutSet=nordic,AsciiCapable" android:imeSubtypeExtraValue="AsciiCapable,SupportTouchPositionCorrection"
/> />
<subtype android:icon="@drawable/ic_subtype_keyboard" <subtype android:icon="@drawable/ic_subtype_keyboard"
android:label="@string/subtype_generic" android:label="@string/subtype_generic"
android:imeSubtypeLocale="fr" android:imeSubtypeLocale="fr"
android:imeSubtypeMode="keyboard" android:imeSubtypeMode="keyboard"
android:imeSubtypeExtraValue="KeyboardLayoutSet=azerty,AsciiCapable" android:imeSubtypeExtraValue="AsciiCapable,SupportTouchPositionCorrection"
/> />
<subtype android:icon="@drawable/ic_subtype_keyboard" <subtype android:icon="@drawable/ic_subtype_keyboard"
android:label="@string/subtype_generic" android:label="@string/subtype_generic"
android:imeSubtypeLocale="fr_CA" android:imeSubtypeLocale="fr_CA"
android:imeSubtypeMode="keyboard" android:imeSubtypeMode="keyboard"
android:imeSubtypeExtraValue="KeyboardLayoutSet=qwerty,AsciiCapable" android:imeSubtypeExtraValue="AsciiCapable,SupportTouchPositionCorrection"
/> />
<subtype android:icon="@drawable/ic_subtype_keyboard" <subtype android:icon="@drawable/ic_subtype_keyboard"
android:label="@string/subtype_generic" android:label="@string/subtype_generic"
@ -178,13 +178,13 @@
android:label="@string/subtype_generic" android:label="@string/subtype_generic"
android:imeSubtypeLocale="hr" android:imeSubtypeLocale="hr"
android:imeSubtypeMode="keyboard" android:imeSubtypeMode="keyboard"
android:imeSubtypeExtraValue="KeyboardLayoutSet=qwertz,AsciiCapable" android:imeSubtypeExtraValue="AsciiCapable,SupportTouchPositionCorrection"
/> />
<subtype android:icon="@drawable/ic_subtype_keyboard" <subtype android:icon="@drawable/ic_subtype_keyboard"
android:label="@string/subtype_generic" android:label="@string/subtype_generic"
android:imeSubtypeLocale="hu" android:imeSubtypeLocale="hu"
android:imeSubtypeMode="keyboard" android:imeSubtypeMode="keyboard"
android:imeSubtypeExtraValue="KeyboardLayoutSet=qwertz,AsciiCapable" android:imeSubtypeExtraValue="AsciiCapable,SupportTouchPositionCorrection"
/> />
<subtype android:icon="@drawable/ic_subtype_keyboard" <subtype android:icon="@drawable/ic_subtype_keyboard"
android:label="@string/subtype_generic" android:label="@string/subtype_generic"
@ -196,14 +196,14 @@
android:label="@string/subtype_generic" android:label="@string/subtype_generic"
android:imeSubtypeLocale="it" android:imeSubtypeLocale="it"
android:imeSubtypeMode="keyboard" android:imeSubtypeMode="keyboard"
android:imeSubtypeExtraValue="KeyboardLayoutSet=qwerty,AsciiCapable" android:imeSubtypeExtraValue="AsciiCapable,SupportTouchPositionCorrection"
/> />
<!-- Java uses the deprecated "iw" code instead of the standard "he" code for Hebrew. --> <!-- Java uses the deprecated "iw" code instead of the standard "he" code for Hebrew. -->
<subtype android:icon="@drawable/ic_subtype_keyboard" <subtype android:icon="@drawable/ic_subtype_keyboard"
android:label="@string/subtype_generic" android:label="@string/subtype_generic"
android:imeSubtypeLocale="iw" android:imeSubtypeLocale="iw"
android:imeSubtypeMode="keyboard" android:imeSubtypeMode="keyboard"
android:imeSubtypeExtraValue="KeyboardLayoutSet=hebrew" android:imeSubtypeExtraValue="SupportTouchPositionCorrection"
/> />
<subtype android:icon="@drawable/ic_subtype_keyboard" <subtype android:icon="@drawable/ic_subtype_keyboard"
android:label="@string/subtype_generic" android:label="@string/subtype_generic"
@ -239,19 +239,19 @@
android:label="@string/subtype_generic" android:label="@string/subtype_generic"
android:imeSubtypeLocale="nb" android:imeSubtypeLocale="nb"
android:imeSubtypeMode="keyboard" android:imeSubtypeMode="keyboard"
android:imeSubtypeExtraValue="KeyboardLayoutSet=nordic,AsciiCapable" android:imeSubtypeExtraValue="AsciiCapable,SupportTouchPositionCorrection"
/> />
<subtype android:icon="@drawable/ic_subtype_keyboard" <subtype android:icon="@drawable/ic_subtype_keyboard"
android:label="@string/subtype_generic" android:label="@string/subtype_generic"
android:imeSubtypeLocale="nl" android:imeSubtypeLocale="nl"
android:imeSubtypeMode="keyboard" android:imeSubtypeMode="keyboard"
android:imeSubtypeExtraValue="KeyboardLayoutSet=qwerty,AsciiCapable" android:imeSubtypeExtraValue="AsciiCapable,SupportTouchPositionCorrection"
/> />
<subtype android:icon="@drawable/ic_subtype_keyboard" <subtype android:icon="@drawable/ic_subtype_keyboard"
android:label="@string/subtype_generic" android:label="@string/subtype_generic"
android:imeSubtypeLocale="pl" android:imeSubtypeLocale="pl"
android:imeSubtypeMode="keyboard" android:imeSubtypeMode="keyboard"
android:imeSubtypeExtraValue="KeyboardLayoutSet=qwerty,AsciiCapable" android:imeSubtypeExtraValue="AsciiCapable,SupportTouchPositionCorrection"
/> />
<subtype android:icon="@drawable/ic_subtype_keyboard" <subtype android:icon="@drawable/ic_subtype_keyboard"
android:label="@string/subtype_generic" android:label="@string/subtype_generic"
@ -275,7 +275,7 @@
android:label="@string/subtype_generic" android:label="@string/subtype_generic"
android:imeSubtypeLocale="ru" android:imeSubtypeLocale="ru"
android:imeSubtypeMode="keyboard" android:imeSubtypeMode="keyboard"
android:imeSubtypeExtraValue="KeyboardLayoutSet=east_slavic" android:imeSubtypeExtraValue="SupportTouchPositionCorrection"
/> />
<subtype android:icon="@drawable/ic_subtype_keyboard" <subtype android:icon="@drawable/ic_subtype_keyboard"
android:label="@string/subtype_generic" android:label="@string/subtype_generic"
@ -293,13 +293,13 @@
android:label="@string/subtype_generic" android:label="@string/subtype_generic"
android:imeSubtypeLocale="sr" android:imeSubtypeLocale="sr"
android:imeSubtypeMode="keyboard" android:imeSubtypeMode="keyboard"
android:imeSubtypeExtraValue="KeyboardLayoutSet=south_slavic" android:imeSubtypeExtraValue="SupportTouchPositionCorrection"
/> />
<subtype android:icon="@drawable/ic_subtype_keyboard" <subtype android:icon="@drawable/ic_subtype_keyboard"
android:label="@string/subtype_generic" android:label="@string/subtype_generic"
android:imeSubtypeLocale="sv" android:imeSubtypeLocale="sv"
android:imeSubtypeMode="keyboard" android:imeSubtypeMode="keyboard"
android:imeSubtypeExtraValue="KeyboardLayoutSet=nordic,AsciiCapable" android:imeSubtypeExtraValue="AsciiCapable,SupportTouchPositionCorrection"
/> />
<subtype android:icon="@drawable/ic_subtype_keyboard" <subtype android:icon="@drawable/ic_subtype_keyboard"
android:label="@string/subtype_generic" android:label="@string/subtype_generic"
@ -311,7 +311,7 @@
android:label="@string/subtype_generic" android:label="@string/subtype_generic"
android:imeSubtypeLocale="tr" android:imeSubtypeLocale="tr"
android:imeSubtypeMode="keyboard" android:imeSubtypeMode="keyboard"
android:imeSubtypeExtraValue="KeyboardLayoutSet=qwerty,AsciiCapable" android:imeSubtypeExtraValue="AsciiCapable,SupportTouchPositionCorrection"
/> />
<subtype android:icon="@drawable/ic_subtype_keyboard" <subtype android:icon="@drawable/ic_subtype_keyboard"
android:label="@string/subtype_generic" android:label="@string/subtype_generic"

View File

@ -60,6 +60,10 @@ public class SubtypeLocale {
// Exceptional locales to display name map. // Exceptional locales to display name map.
private static final HashMap<String, String> sExceptionalDisplayNamesMap = private static final HashMap<String, String> sExceptionalDisplayNamesMap =
new HashMap<String, String>(); new HashMap<String, String>();
// Keyboard layout set name for the subtypes that don't have a keyboardLayoutSet extra value.
// This is for compatibility to keep the same subtype ids as pre-JellyBean.
private static final HashMap<String,String> sLocaleAndExtraValueToKeyboardLayoutSetMap =
new HashMap<String,String>();
private SubtypeLocale() { private SubtypeLocale() {
// Intentional empty constructor for utility class. // Intentional empty constructor for utility class.
@ -97,6 +101,14 @@ public class SubtypeLocale {
final int resId = res.getIdentifier(resourceName, null, RESOURCE_PACKAGE_NAME); final int resId = res.getIdentifier(resourceName, null, RESOURCE_PACKAGE_NAME);
sExceptionalLocaleToWithLayoutNameIdsMap.put(localeString, resId); sExceptionalLocaleToWithLayoutNameIdsMap.put(localeString, resId);
} }
final String[] keyboardLayoutSetMap = res.getStringArray(
R.array.locale_and_extra_value_to_keyboard_layout_set_map);
for (int i = 0; i < keyboardLayoutSetMap.length; i += 2) {
final String key = keyboardLayoutSetMap[i];
final String keyboardLayoutSet = keyboardLayoutSetMap[i + 1];
sLocaleAndExtraValueToKeyboardLayoutSetMap.put(key, keyboardLayoutSet);
}
} }
public static String[] getPredefinedKeyboardLayoutSet() { public static String[] getPredefinedKeyboardLayoutSet() {
@ -193,7 +205,14 @@ public class SubtypeLocale {
} }
public static String getKeyboardLayoutSetName(InputMethodSubtype subtype) { public static String getKeyboardLayoutSetName(InputMethodSubtype subtype) {
final String keyboardLayoutSet = subtype.getExtraValueOf(KEYBOARD_LAYOUT_SET); String keyboardLayoutSet = subtype.getExtraValueOf(KEYBOARD_LAYOUT_SET);
if (keyboardLayoutSet == null) {
// This subtype doesn't have a keyboardLayoutSet extra value, so lookup its keyboard
// layout set in sLocaleAndExtraValueToKeyboardLayoutSetMap to keep it compatible with
// pre-JellyBean.
final String key = subtype.getLocale() + ":" + subtype.getExtraValue();
keyboardLayoutSet = sLocaleAndExtraValueToKeyboardLayoutSetMap.get(key);
}
// TODO: Remove this null check when InputMethodManager.getCurrentInputMethodSubtype is // TODO: Remove this null check when InputMethodManager.getCurrentInputMethodSubtype is
// fixed. // fixed.
if (keyboardLayoutSet == null) { if (keyboardLayoutSet == null) {