From c98a943edaf03bb114172b31b041b0a6b952c043 Mon Sep 17 00:00:00 2001 From: satok Date: Fri, 4 Feb 2011 17:05:07 +0900 Subject: [PATCH] Duplicate enabled languages when there is only one enabled language Bug: 3415274 Change-Id: Ibc17733be888044cfa5d1787b8489e642d70d70f --- .../com/android/inputmethod/latin/SubtypeSwitcher.java | 9 ++++++++- .../com/android/inputmethod/voice/VoiceIMEConnector.java | 4 ++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java b/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java index f4262cc99..d8c89a0d4 100644 --- a/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java +++ b/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java @@ -426,8 +426,15 @@ public class SubtypeSwitcher { if (mConfigUseSpacebarLanguageSwitcher) { return mLanguageSwitcher.getEnabledLanguages(); } else { + int enabledLanguageCount = mEnabledLanguagesOfCurrentInputMethod.size(); + // Workaround for explicitly specifying the voice language + if (enabledLanguageCount == 1) { + mEnabledLanguagesOfCurrentInputMethod.add( + mEnabledLanguagesOfCurrentInputMethod.get(0)); + ++enabledLanguageCount; + } return mEnabledLanguagesOfCurrentInputMethod.toArray( - new String[mEnabledLanguagesOfCurrentInputMethod.size()]); + new String[enabledLanguageCount]); } } diff --git a/java/src/com/android/inputmethod/voice/VoiceIMEConnector.java b/java/src/com/android/inputmethod/voice/VoiceIMEConnector.java index 4ceaa1bb9..277ef7e65 100644 --- a/java/src/com/android/inputmethod/voice/VoiceIMEConnector.java +++ b/java/src/com/android/inputmethod/voice/VoiceIMEConnector.java @@ -81,7 +81,7 @@ public class VoiceIMEConnector implements VoiceInput.UiListener { private static final int RECOGNITIONVIEW_HEIGHT_THRESHOLD_RATIO = 6; private static final String TAG = VoiceIMEConnector.class.getSimpleName(); - private static boolean DEBUG = LatinImeLogger.sDBG; + private static final boolean DEBUG = LatinImeLogger.sDBG; private boolean mAfterVoiceInput; private boolean mHasUsedVoiceInput; @@ -715,7 +715,7 @@ public class VoiceIMEConnector implements VoiceInput.UiListener { mHandler.updateVoiceResults(); } - public FieldContext makeFieldContext() { + private FieldContext makeFieldContext() { SubtypeSwitcher switcher = SubtypeSwitcher.getInstance(); return new FieldContext(mService.getCurrentInputConnection(), mService.getCurrentInputEditorInfo(), switcher.getInputLocaleStr(),