From 61dbda00de17be4b624ee7830ae4859167db3ed1 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Fri, 28 Mar 2014 16:29:56 +0900 Subject: [PATCH] Remove redundant check to detect forceAscii Change-Id: Ib3272ec19a90b3aa4937573e049ceb86855ea408 --- .../inputmethod/keyboard/KeyboardSwitcher.java | 2 +- .../inputmethod/latin/SubtypeSwitcher.java | 15 ++++++--------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java index 2dfde9434..37a4bf8f6 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java +++ b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java @@ -205,7 +205,7 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions { final boolean subtypeChanged = (oldKeyboard == null) || !keyboard.mId.mLocale.equals(oldKeyboard.mId.mLocale); final boolean needsToDisplayLanguage = mSubtypeSwitcher.needsToDisplayLanguage( - keyboard.mId.mLocale); + keyboard.mId.mSubtype); keyboardView.startDisplayLanguageOnSpacebar(subtypeChanged, needsToDisplayLanguage, RichInputMethodManager.getInstance().hasMultipleEnabledIMEsOrSubtypes(true)); } diff --git a/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java b/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java index 935dd9667..c9a85f994 100644 --- a/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java +++ b/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java @@ -93,7 +93,10 @@ public final class SubtypeSwitcher { private int mEnabledSubtypeCount; private boolean mIsSystemLanguageSameAsInputLanguage; - public boolean getValue() { + public boolean needsToDisplayLanguage(final InputMethodSubtype subtype) { + if (SubtypeLocaleUtils.isNoLanguage(subtype)) { + return true; + } return mEnabledSubtypeCount >= 2 || !mIsSystemLanguageSameAsInputLanguage; } @@ -265,14 +268,8 @@ public final class SubtypeSwitcher { // Subtype Switching functions // ////////////////////////////////// - public boolean needsToDisplayLanguage(final Locale keyboardLocale) { - if (keyboardLocale.toString().equals(SubtypeLocaleUtils.NO_LANGUAGE)) { - return true; - } - if (!keyboardLocale.equals(getCurrentSubtypeLocale())) { - return false; - } - return mNeedsToDisplayLanguage.getValue(); + public boolean needsToDisplayLanguage(final InputMethodSubtype subtype) { + return mNeedsToDisplayLanguage.needsToDisplayLanguage(subtype); } public boolean isSystemLocaleSameAsLocaleOfAllEnabledSubtypesOfEnabledImes() {