From d81479a340d76afaef14ce683322e1488167919c Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Wed, 31 Aug 2011 21:20:52 +0900 Subject: Implement KeyboardLocale InputMethodSubtype extra key The locale is specified by KeyboardLocale extra key in method.xml, LatinIME will use the specified locale for keyboard layout. Bug: 5238658 Change-Id: I8e6cb66c73a7ac1bf611d9910b42fa9cff38eba0 --- java/res/values/strings.xml | 6 +++--- java/res/xml/method.xml | 6 +++--- .../compat/InputMethodServiceCompatWrapper.java | 9 +++++---- java/src/com/android/inputmethod/latin/LatinIME.java | 6 ++++++ .../com/android/inputmethod/latin/SubtypeSwitcher.java | 16 +++++++++++----- 5 files changed, 28 insertions(+), 15 deletions(-) (limited to 'java') diff --git a/java/res/values/strings.xml b/java/res/values/strings.xml index 247bdba41..2a3d705b0 100644 --- a/java/res/values/strings.xml +++ b/java/res/values/strings.xml @@ -332,11 +332,11 @@ Keyboard theme - + German QWERTY - + English (UK) - + English (US) diff --git a/java/res/xml/method.xml b/java/res/xml/method.xml index 452294e04..f2f3178de 100644 --- a/java/res/xml/method.xml +++ b/java/res/xml/method.xml @@ -20,7 +20,7 @@ - + @@ -64,9 +64,9 @@ /> " : mShortcutInputMethodInfo.getId()) + ", " - + (mShortcutSubtype == null ? "" : (mShortcutSubtype.getLocale() + + (mShortcutSubtype == null ? "" : (getSubtypeLocale(mShortcutSubtype) + ", " + mShortcutSubtype.getMode()))); } // TODO: Update an icon for shortcut IME @@ -189,11 +189,17 @@ public class SubtypeSwitcher { Log.d(TAG, "Update shortcut IME to : " + (mShortcutInputMethodInfo == null ? "" : mShortcutInputMethodInfo.getId()) + ", " - + (mShortcutSubtype == null ? "" : (mShortcutSubtype.getLocale() + + (mShortcutSubtype == null ? "" : (getSubtypeLocale(mShortcutSubtype) + ", " + mShortcutSubtype.getMode()))); } } + private static String getSubtypeLocale(InputMethodSubtypeCompatWrapper subtype) { + final String keyboardLocale = subtype.getExtraValueOf( + LatinIME.SUBTYPE_EXTRA_VALUE_KEYBOARD_LOCALE); + return keyboardLocale != null ? keyboardLocale : subtype.getLocale(); + } + // Update the current subtype. LatinIME.onCurrentInputMethodSubtypeChanged calls this function. public void updateSubtype(InputMethodSubtypeCompatWrapper newSubtype) { final String newLocale; @@ -206,7 +212,7 @@ public class SubtypeSwitcher { newLocale = "en_US"; newMode = KEYBOARD_MODE; } else { - newLocale = newSubtype.getLocale(); + newLocale = getSubtypeLocale(newSubtype); newMode = newSubtype.getMode(); } if (DBG) { @@ -332,7 +338,7 @@ public class SubtypeSwitcher { final String imiPackageName = imi.getPackageName(); if (DBG) { Log.d(TAG, "Update icons of IME: " + imiPackageName + "," - + subtype.getLocale() + "," + subtype.getMode()); + + getSubtypeLocale(subtype) + "," + subtype.getMode()); } if (subtype != null) { return pm.getDrawable(imiPackageName, subtype.getIconResId(), -- cgit v1.2.3-83-g751a