From 76d4ffeebfd084913a8c1b7433dff48f5b2063df Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Mon, 19 Nov 2012 11:25:30 +0900 Subject: Add Spanish United States keyboard The subtype locale name on the spacebar will be suppressed when only one subtype is enabled and - Subtype locale is equal to the system locale. or - Subtype language is equal to the system language but the subtype is implicitly enabled. Thus the "es_ES" system locale chooses "es" subtype keyboard implicitly but the keyboard doesn't have the subtype name on its spacebar. This change also removes Spanish Latin America keyboard. Bug: 7531804 Change-Id: Ib929e8235d643c0ba039eb010e18ab721a734e15 --- .../inputmethod/latin/RichInputMethodManager.java | 34 +++++++++++++++------- 1 file changed, 24 insertions(+), 10 deletions(-) (limited to 'java/src/com/android/inputmethod/latin/RichInputMethodManager.java') diff --git a/java/src/com/android/inputmethod/latin/RichInputMethodManager.java b/java/src/com/android/inputmethod/latin/RichInputMethodManager.java index b3832303d..63dfd3250 100644 --- a/java/src/com/android/inputmethod/latin/RichInputMethodManager.java +++ b/java/src/com/android/inputmethod/latin/RichInputMethodManager.java @@ -96,28 +96,42 @@ public final class RichInputMethodManager { return mInputMethodInfoOfThisIme.getId(); } - public boolean checkIfSubtypeBelongsToThisImeAndEnabled(final InputMethodSubtype ims) { - return checkIfSubtypeBelongsToImeAndEnabled(mInputMethodInfoOfThisIme, ims); + public boolean checkIfSubtypeBelongsToThisImeAndEnabled(final InputMethodSubtype subtype) { + return checkIfSubtypeBelongsToImeAndEnabled(mInputMethodInfoOfThisIme, subtype); + } + + public boolean checkIfSubtypeBelongsToThisImeAndImplicitlyEnabled( + final InputMethodSubtype subtype) { + final boolean subtypeEnabled = checkIfSubtypeBelongsToThisImeAndEnabled(subtype); + final boolean subtypeExplicitlyEnabled = checkIfSubtypeBelongsToList( + subtype, mImmWrapper.mImm.getEnabledInputMethodSubtypeList( + mInputMethodInfoOfThisIme, false /* allowsImplicitlySelectedSubtypes */)); + return subtypeEnabled && !subtypeExplicitlyEnabled; } public boolean checkIfSubtypeBelongsToImeAndEnabled(final InputMethodInfo imi, - final InputMethodSubtype ims) { - final List subtypes = mImmWrapper.mImm.getEnabledInputMethodSubtypeList( - imi, true /* allowsImplicitlySelectedSubtypes */); - for (final InputMethodSubtype subtype : subtypes) { - if (subtype.equals(ims)) { + final InputMethodSubtype subtype) { + return checkIfSubtypeBelongsToList( + subtype, mImmWrapper.mImm.getEnabledInputMethodSubtypeList( + imi, true /* allowsImplicitlySelectedSubtypes */)); + } + + private static boolean checkIfSubtypeBelongsToList(final InputMethodSubtype subtype, + final List subtypes) { + for (final InputMethodSubtype ims : subtypes) { + if (ims.equals(subtype)) { return true; } } return false; } - public boolean checkIfSubtypeBelongsToThisIme(final InputMethodSubtype ims) { + public boolean checkIfSubtypeBelongsToThisIme(final InputMethodSubtype subtype) { final InputMethodInfo myImi = mInputMethodInfoOfThisIme; final int count = myImi.getSubtypeCount(); for (int i = 0; i < count; i++) { - final InputMethodSubtype subtype = myImi.getSubtypeAt(i); - if (subtype.equals(ims)) { + final InputMethodSubtype ims = myImi.getSubtypeAt(i); + if (ims.equals(subtype)) { return true; } } -- cgit v1.2.3-83-g751a