From eaa10f44a4a0108a90803b1b28238842d3fb5add Mon Sep 17 00:00:00 2001 From: satok Date: Tue, 17 May 2011 17:34:17 +0900 Subject: Show full display names in the popup of the spacebar language swicher - Multiply the speed of the slide Bug: 4427222 Change-Id: Ifd2de9843191296f0f311440ea7b8ab075c67d8d --- java/src/com/android/inputmethod/latin/Utils.java | 25 +++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'java/src/com/android/inputmethod/latin/Utils.java') diff --git a/java/src/com/android/inputmethod/latin/Utils.java b/java/src/com/android/inputmethod/latin/Utils.java index d165de32d..5207f38ad 100644 --- a/java/src/com/android/inputmethod/latin/Utils.java +++ b/java/src/com/android/inputmethod/latin/Utils.java @@ -44,6 +44,7 @@ import java.io.IOException; import java.io.PrintWriter; import java.text.SimpleDateFormat; import java.util.Date; +import java.util.HashMap; import java.util.Locale; public class Utils { @@ -662,4 +663,28 @@ public class Utils { res.updateConfiguration(conf, res.getDisplayMetrics()); return saveLocale; } + + private static final HashMap sLocaleCache = new HashMap(); + + public static Locale constructLocaleFromString(String localeStr) { + if (localeStr == null) + return null; + synchronized (sLocaleCache) { + if (sLocaleCache.containsKey(localeStr)) + return sLocaleCache.get(localeStr); + Locale retval = null; + String[] localeParams = localeStr.split("_", 3); + if (localeParams.length == 1) { + retval = new Locale(localeParams[0]); + } else if (localeParams.length == 2) { + retval = new Locale(localeParams[0], localeParams[1]); + } else if (localeParams.length == 3) { + retval = new Locale(localeParams[0], localeParams[1], localeParams[2]); + } + if (retval != null) { + sLocaleCache.put(localeStr, retval); + } + return retval; + } + } } -- cgit v1.2.3-83-g751a From 9e2d810dc524380ca1db6b384cfb00b4401585e5 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Fri, 27 May 2011 21:41:13 +0900 Subject: Remove web mode and add webInput boolean Bug: 4490948 Change-Id: I6fe23c9ab4918eab6806cc621c4d6821c2e1baf9 Cherry-Pick: I4cd1af0b --- java/res/values/attrs.xml | 5 +++-- java/res/xml/kbd_qwerty_f1.xml | 2 +- java/res/xml/kbd_qwerty_row4.xml | 4 ++-- .../inputmethod/compat/InputTypeCompatUtils.java | 25 +++++++++++++++++++--- .../android/inputmethod/keyboard/KeyboardId.java | 17 +++++++++------ .../inputmethod/keyboard/KeyboardParser.java | 12 +++++++---- .../com/android/inputmethod/latin/LatinIME.java | 6 ++++-- java/src/com/android/inputmethod/latin/Utils.java | 2 -- 8 files changed, 50 insertions(+), 23 deletions(-) (limited to 'java/src/com/android/inputmethod/latin/Utils.java') diff --git a/java/res/values/attrs.xml b/java/res/values/attrs.xml index 0e5b38b6b..feb955e86 100644 --- a/java/res/values/attrs.xml +++ b/java/res/values/attrs.xml @@ -184,9 +184,10 @@ - - + + + diff --git a/java/res/xml/kbd_qwerty_f1.xml b/java/res/xml/kbd_qwerty_f1.xml index d0e2884e1..e89d02d91 100644 --- a/java/res/xml/kbd_qwerty_f1.xml +++ b/java/res/xml/kbd_qwerty_f1.xml @@ -46,7 +46,7 @@ %s", TAG_CASE, + if (DEBUG) Log.d(TAG, String.format("<%s%s%s%s%s%s%s%s%s%s%s> %s", TAG_CASE, textAttr(KeyboardId.modeName( a.getInt(R.styleable.Keyboard_Case_mode, -1)), "mode"), textAttr(KeyboardId.colorSchemeName( viewAttr.getInt( R.styleable.KeyboardView_colorScheme, -1)), "colorSchemeName"), + booleanAttr(a, R.styleable.Keyboard_Case_webInput, "webInput"), booleanAttr(a, R.styleable.Keyboard_Case_passwordInput, "passwordInput"), booleanAttr(a, R.styleable.Keyboard_Case_hasSettingsKey, "hasSettingsKey"), booleanAttr(a, R.styleable.Keyboard_Case_voiceKeyEnabled, "voiceKeyEnabled"), diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index d625951fc..fd6c47803 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -81,7 +81,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar private static final String TAG = LatinIME.class.getSimpleName(); private static final boolean PERF_DEBUG = false; private static final boolean TRACE = false; - private static boolean DEBUG = LatinImeLogger.sDBG; + private static boolean DEBUG; /** * The private IME option used to indicate that no microphone should be @@ -357,6 +357,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar mSubtypeSwitcher = SubtypeSwitcher.getInstance(); mKeyboardSwitcher = KeyboardSwitcher.getInstance(); mRecorrection = Recorrection.getInstance(); + DEBUG = LatinImeLogger.sDBG; loadSettings(); @@ -506,7 +507,8 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar LatinKeyboardView inputView = switcher.getKeyboardView(); if (DEBUG) { - Log.d(TAG, "onStartInputView: " + inputView); + Log.d(TAG, "onStartInputView: inputType=" + ((attribute == null) ? "none" + : String.format("0x%08x", attribute.inputType))); } // In landscape mode, this method gets called without the input view being created. if (inputView == null) { diff --git a/java/src/com/android/inputmethod/latin/Utils.java b/java/src/com/android/inputmethod/latin/Utils.java index 5207f38ad..66a6d161b 100644 --- a/java/src/com/android/inputmethod/latin/Utils.java +++ b/java/src/com/android/inputmethod/latin/Utils.java @@ -538,8 +538,6 @@ public class Utils { return KeyboardId.MODE_IM; } else if (variation == InputType.TYPE_TEXT_VARIATION_FILTER) { return KeyboardId.MODE_TEXT; - } else if (variation == InputType.TYPE_TEXT_VARIATION_WEB_EDIT_TEXT) { - return KeyboardId.MODE_WEB; } else { return KeyboardId.MODE_TEXT; } -- cgit v1.2.3-83-g751a From a88a5eddbcea0d836ab3d563f460897f39418ca0 Mon Sep 17 00:00:00 2001 From: Ken Wakasa Date: Tue, 7 Jun 2011 20:44:46 +0900 Subject: Revise hasMultipleEnabledIMEsOrSubtypes() bug: 4559308 Change-Id: If831c0827dbf030eaf1d241ebfa60d4e5029ae63 --- .../compat/InputMethodSubtypeCompatWrapper.java | 6 ++++ java/src/com/android/inputmethod/latin/Utils.java | 32 +++++++++++++++++++++- 2 files changed, 37 insertions(+), 1 deletion(-) (limited to 'java/src/com/android/inputmethod/latin/Utils.java') diff --git a/java/src/com/android/inputmethod/compat/InputMethodSubtypeCompatWrapper.java b/java/src/com/android/inputmethod/compat/InputMethodSubtypeCompatWrapper.java index 806c355a9..667d86c42 100644 --- a/java/src/com/android/inputmethod/compat/InputMethodSubtypeCompatWrapper.java +++ b/java/src/com/android/inputmethod/compat/InputMethodSubtypeCompatWrapper.java @@ -48,6 +48,8 @@ public final class InputMethodSubtypeCompatWrapper extends AbstractCompatWrapper CompatUtils.getMethod(CLASS_InputMethodSubtype, "containsExtraValueKey", String.class); private static final Method METHOD_getExtraValueOf = CompatUtils.getMethod(CLASS_InputMethodSubtype, "getExtraValueOf", String.class); + private static final Method METHOD_isAuxiliary = + CompatUtils.getMethod(CLASS_InputMethodSubtype, "isAuxiliary"); private final int mDummyNameResId; private final int mDummyIconResId; @@ -116,6 +118,10 @@ public final class InputMethodSubtypeCompatWrapper extends AbstractCompatWrapper return (String)CompatUtils.invoke(mObj, null, METHOD_getExtraValueOf, key); } + public boolean isAuxiliary() { + return (Boolean)CompatUtils.invoke(mObj, false, METHOD_isAuxiliary); + } + public boolean isDummy() { return !hasOriginalObject(); } diff --git a/java/src/com/android/inputmethod/latin/Utils.java b/java/src/com/android/inputmethod/latin/Utils.java index 66a6d161b..6bdc0a857 100644 --- a/java/src/com/android/inputmethod/latin/Utils.java +++ b/java/src/com/android/inputmethod/latin/Utils.java @@ -18,6 +18,7 @@ package com.android.inputmethod.latin; import com.android.inputmethod.compat.InputMethodInfoCompatWrapper; import com.android.inputmethod.compat.InputMethodManagerCompatWrapper; +import com.android.inputmethod.compat.InputMethodSubtypeCompatWrapper; import com.android.inputmethod.compat.InputTypeCompatUtils; import com.android.inputmethod.keyboard.Keyboard; import com.android.inputmethod.keyboard.KeyboardId; @@ -43,8 +44,10 @@ import java.io.FileReader; import java.io.IOException; import java.io.PrintWriter; import java.text.SimpleDateFormat; +import java.util.ArrayList; import java.util.Date; import java.util.HashMap; +import java.util.List; import java.util.Locale; public class Utils { @@ -109,7 +112,34 @@ public class Utils { } public static boolean hasMultipleEnabledIMEsOrSubtypes(InputMethodManagerCompatWrapper imm) { - return imm.getEnabledInputMethodList().size() > 1 + final List enabledImis = imm.getEnabledInputMethodList(); + + // Filters out IMEs that have auxiliary subtypes only (including either implicitly or + // explicitly enabled ones). + final ArrayList filteredImis = + new ArrayList(); + + outerloop: + for (InputMethodInfoCompatWrapper imi : enabledImis) { + // We can return true immediately after we find two or more filtered IMEs. + if (filteredImis.size() > 1) return true; + final List subtypes = + imm.getEnabledInputMethodSubtypeList(imi, true); + // IMEs that have no subtypes should be included. + if (subtypes.isEmpty()) { + filteredImis.add(imi); + continue; + } + // IMEs that have one or more non-auxiliary subtypes should be included. + for (InputMethodSubtypeCompatWrapper subtype : subtypes) { + if (!subtype.isAuxiliary()) { + filteredImis.add(imi); + continue outerloop; + } + } + } + + return filteredImis.size() > 1 // imm.getEnabledInputMethodSubtypeList(null, false) will return the current IME's enabled // input method subtype (The current IME should be LatinIME.) || imm.getEnabledInputMethodSubtypeList(null, false).size() > 1; -- cgit v1.2.3-83-g751a