From 8ba4f33709e6c40ade96922f88feace6e4b75b56 Mon Sep 17 00:00:00 2001 From: Yohei Yukawa Date: Mon, 28 Apr 2014 07:39:00 +0900 Subject: 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 --- .../android/inputmethod/latin/RichInputMethodManager.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) (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 630a03670..2b0be545e 100644 --- a/java/src/com/android/inputmethod/latin/RichInputMethodManager.java +++ b/java/src/com/android/inputmethod/latin/RichInputMethodManager.java @@ -20,6 +20,7 @@ import static com.android.inputmethod.latin.Constants.Subtype.KEYBOARD_MODE; import android.content.Context; import android.content.SharedPreferences; +import android.os.Build; import android.os.IBinder; import android.preference.PreferenceManager; import android.util.Log; @@ -406,4 +407,15 @@ public final class RichInputMethodManager { mSubtypeListCacheWithoutImplicitlySelectedSubtypes.clear(); mInputMethodInfoCache.clear(); } + + public boolean shouldOfferSwitchingToNextInputMethod(final IBinder binder, + boolean defaultValue) { + // Use the default value instead on Jelly Bean MR2 and previous where + // {@link InputMethodManager#shouldOfferSwitchingToNextInputMethod} isn't yet available + // and on KitKat where the API is still just a stub to return true always. + if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT) { + return defaultValue; + } + return mImmWrapper.shouldOfferSwitchingToNextInputMethod(binder); + } } -- cgit v1.2.3-83-g751a