aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2012-05-01 04:44:02 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2012-05-01 04:44:02 -0700
commitb21d16704510be3c50e1d6ed9af22ae2cc96ce8a (patch)
tree42a4eeb5b051607fc4b0fcd859d9bfbffcca8550 /java/src
parent09192913fcf3dbe4fdd76f26c47e669788fc12fe (diff)
parent76d6673b2aa7b7ae0511169e4cc576b7c51440ac (diff)
downloadlatinime-b21d16704510be3c50e1d6ed9af22ae2cc96ce8a.tar.gz
latinime-b21d16704510be3c50e1d6ed9af22ae2cc96ce8a.tar.xz
latinime-b21d16704510be3c50e1d6ed9af22ae2cc96ce8a.zip
am 76d6673b: Merge "Fix checking if subtype belongs to this ime" into jb-dev
* commit '76d6673b2aa7b7ae0511169e4cc576b7c51440ac': Fix checking if subtype belongs to this ime
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/latin/ImfUtils.java16
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java4
2 files changed, 17 insertions, 3 deletions
diff --git a/java/src/com/android/inputmethod/latin/ImfUtils.java b/java/src/com/android/inputmethod/latin/ImfUtils.java
index af46a02c0..36f6d8ba0 100644
--- a/java/src/com/android/inputmethod/latin/ImfUtils.java
+++ b/java/src/com/android/inputmethod/latin/ImfUtils.java
@@ -63,7 +63,8 @@ public class ImfUtils {
return getInputMethodInfoOfThisIme(context).getId();
}
- public static boolean checkIfSubtypeBelongsToThisIme(Context context, InputMethodSubtype ims) {
+ public static boolean checkIfSubtypeBelongsToThisImeAndEnabled(Context context,
+ InputMethodSubtype ims) {
final InputMethodInfo myImi = getInputMethodInfoOfThisIme(context);
final InputMethodManager imm = getInputMethodManager(context);
// TODO: Cache all subtypes of this IME for optimization
@@ -76,6 +77,19 @@ public class ImfUtils {
return false;
}
+ public static boolean checkIfSubtypeBelongsToThisIme(Context context,
+ InputMethodSubtype ims) {
+ final InputMethodInfo myImi = getInputMethodInfoOfThisIme(context);
+ final int count = myImi.getSubtypeCount();
+ for (int i = 0; i < count; i++) {
+ final InputMethodSubtype subtype = myImi.getSubtypeAt(i);
+ if (subtype.equals(ims)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
public static boolean hasMultipleEnabledIMEsOrSubtypes(Context context,
final boolean shouldIncludeAuxiliarySubtypes) {
final InputMethodManager imm = getInputMethodManager(context);
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index c6381180c..7efdef987 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -1148,8 +1148,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
final IBinder token = getWindow().getWindow().getAttributes().token;
if (mShouldSwitchToLastSubtype) {
final InputMethodSubtype lastSubtype = mImm.getLastInputMethodSubtype();
- final boolean lastSubtypeBelongsToThisIme = ImfUtils.checkIfSubtypeBelongsToThisIme(
- this, lastSubtype);
+ final boolean lastSubtypeBelongsToThisIme =
+ ImfUtils.checkIfSubtypeBelongsToThisImeAndEnabled(this, lastSubtype);
if ((includesOtherImes || lastSubtypeBelongsToThisIme)
&& mImm.switchToLastInputMethod(token)) {
mShouldSwitchToLastSubtype = false;