aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/compat/InputMethodManagerCompatWrapper.java
diff options
context:
space:
mode:
authorYohei Yukawa <yukawa@google.com>2014-04-28 07:39:00 +0900
committerYohei Yukawa <yukawa@google.com>2014-04-28 15:11:19 +0900
commit8ba4f33709e6c40ade96922f88feace6e4b75b56 (patch)
treed06f0e886318cd9987a54a1fba1adae295cd8f47 /java/src/com/android/inputmethod/compat/InputMethodManagerCompatWrapper.java
parent2cc7c3321d9e1dea462cbcd78a6ee1a99985b73b (diff)
downloadlatinime-8ba4f33709e6c40ade96922f88feace6e4b75b56.tar.gz
latinime-8ba4f33709e6c40ade96922f88feace6e4b75b56.tar.xz
latinime-8ba4f33709e6c40ade96922f88feace6e4b75b56.zip
Use shouldOfferSwitchingToNextInputMethod when available
With this CL, LatinIME starts using InputMethodManager#shouldOfferSwitchingToNextInputMethod when available and API level is higher than 19 (KitKat). Note that relevant settings of LatinIME will be ignored if InputMethodManager#shouldOfferSwitchingToNextInputMethod is considered to be available at the moment. We will revisit here to reorganize the user visible settings before the new global IME switching mechanism becomes publicly available. BUG: 12965588 Change-Id: I0188fa56cba8e983c61cef3ae3400a0e3821f718
Diffstat (limited to 'java/src/com/android/inputmethod/compat/InputMethodManagerCompatWrapper.java')
-rw-r--r--java/src/com/android/inputmethod/compat/InputMethodManagerCompatWrapper.java11
1 files changed, 11 insertions, 0 deletions
diff --git a/java/src/com/android/inputmethod/compat/InputMethodManagerCompatWrapper.java b/java/src/com/android/inputmethod/compat/InputMethodManagerCompatWrapper.java
index a80c3fefe..18b3a6060 100644
--- a/java/src/com/android/inputmethod/compat/InputMethodManagerCompatWrapper.java
+++ b/java/src/com/android/inputmethod/compat/InputMethodManagerCompatWrapper.java
@@ -28,6 +28,12 @@ public final class InputMethodManagerCompatWrapper {
private static final Method METHOD_switchToNextInputMethod = CompatUtils.getMethod(
InputMethodManager.class, "switchToNextInputMethod", IBinder.class, Boolean.TYPE);
+ // Note that InputMethodManager.shouldOfferSwitchingToNextInputMethod() has been introduced
+ // in API level 19 (Build.VERSION_CODES.KITKAT).
+ private static final Method METHOD_shouldOfferSwitchingToNextInputMethod =
+ CompatUtils.getMethod(InputMethodManager.class,
+ "shouldOfferSwitchingToNextInputMethod", IBinder.class);
+
public final InputMethodManager mImm;
public InputMethodManagerCompatWrapper(final Context context) {
@@ -38,4 +44,9 @@ public final class InputMethodManagerCompatWrapper {
return (Boolean)CompatUtils.invoke(mImm, false /* defaultValue */,
METHOD_switchToNextInputMethod, token, onlyCurrentIme);
}
+
+ public boolean shouldOfferSwitchingToNextInputMethod(final IBinder token) {
+ return (Boolean)CompatUtils.invoke(mImm, false /* defaultValue */,
+ METHOD_shouldOfferSwitchingToNextInputMethod, token);
+ }
}