aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/LatinIME.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/latin/LatinIME.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/latin/LatinIME.java')
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java26
1 files changed, 25 insertions, 1 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index a77cedc48..f1b1b8db2 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -1229,7 +1229,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
// TODO: Revise the language switch key behavior to make it much smarter and more reasonable.
public void switchToNextSubtype() {
final IBinder token = getWindow().getWindow().getAttributes().token;
- if (mSettings.getCurrent().mIncludesOtherImesInLanguageSwitchList) {
+ if (shouldSwitchToOtherInputMethods()) {
mRichImm.switchToNextInputMethod(token, false /* onlyCurrentIme */);
return;
}
@@ -1799,4 +1799,28 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
p.println(settingsValues.dump());
// TODO: Dump all settings values
}
+
+ public boolean shouldSwitchToOtherInputMethods() {
+ // TODO: Revisit here to reorganize the settings. Probably we can/should use different
+ // strategy once the implementation of
+ // {@link InputMethodManager#shouldOfferSwitchingToNextInputMethod} is defined well.
+ final boolean fallbackValue = mSettings.getCurrent().mIncludesOtherImesInLanguageSwitchList;
+ final IBinder token = getWindow().getWindow().getAttributes().token;
+ if (token == null) {
+ return fallbackValue;
+ }
+ return mRichImm.shouldOfferSwitchingToNextInputMethod(token, fallbackValue);
+ }
+
+ public boolean shouldShowLanguageSwitchKey() {
+ // TODO: Revisit here to reorganize the settings. Probably we can/should use different
+ // strategy once the implementation of
+ // {@link InputMethodManager#shouldOfferSwitchingToNextInputMethod} is defined well.
+ final boolean fallbackValue = mSettings.getCurrent().isLanguageSwitchKeyEnabled();
+ final IBinder token = getWindow().getWindow().getAttributes().token;
+ if (token == null) {
+ return fallbackValue;
+ }
+ return mRichImm.shouldOfferSwitchingToNextInputMethod(token, fallbackValue);
+ }
}