Skip to content
Snippets Groups Projects
Commit 0c49a9f7 authored by Tadashi G. Takaoka's avatar Tadashi G. Takaoka Committed by Android Git Automerger
Browse files

am c0a5f07c: am 792980d4: Avoid calling switchToLastInputMethod when other...

am c0a5f07c: am 792980d4: Avoid calling switchToLastInputMethod when other IMEs are in effect (DO NOT MERGE)

* commit 'c0a5f07c':
  Avoid calling switchToLastInputMethod when other IMEs are in effect (DO NOT MERGE)
parents eca0b552 c0a5f07c
No related branches found
No related tags found
No related merge requests found
...@@ -1219,22 +1219,25 @@ public final class LatinIME extends InputMethodService implements KeyboardAction ...@@ -1219,22 +1219,25 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
mConnection.performEditorAction(actionId); mConnection.performEditorAction(actionId);
} }
// TODO: Revise the language switch key behavior to make it much smarter and more reasonable.
private void handleLanguageSwitchKey() { private void handleLanguageSwitchKey() {
final boolean includesOtherImes = mCurrentSettings.mIncludesOtherImesInLanguageSwitchList;
final IBinder token = getWindow().getWindow().getAttributes().token; final IBinder token = getWindow().getWindow().getAttributes().token;
if (mCurrentSettings.mIncludesOtherImesInLanguageSwitchList) {
mImm.switchToNextInputMethod(token, false /* onlyCurrentIme */);
return;
}
if (mShouldSwitchToLastSubtype) { if (mShouldSwitchToLastSubtype) {
final InputMethodSubtype lastSubtype = mImm.getLastInputMethodSubtype(); final InputMethodSubtype lastSubtype = mImm.getLastInputMethodSubtype();
final boolean lastSubtypeBelongsToThisIme = final boolean lastSubtypeBelongsToThisIme =
ImfUtils.checkIfSubtypeBelongsToThisImeAndEnabled(this, lastSubtype); ImfUtils.checkIfSubtypeBelongsToThisImeAndEnabled(this, lastSubtype);
if ((includesOtherImes || lastSubtypeBelongsToThisIme) if (lastSubtypeBelongsToThisIme && mImm.switchToLastInputMethod(token)) {
&& mImm.switchToLastInputMethod(token)) {
mShouldSwitchToLastSubtype = false; mShouldSwitchToLastSubtype = false;
} else { } else {
mImm.switchToNextInputMethod(token, !includesOtherImes); mImm.switchToNextInputMethod(token, true /* onlyCurrentIme */);
mShouldSwitchToLastSubtype = true; mShouldSwitchToLastSubtype = true;
} }
} else { } else {
mImm.switchToNextInputMethod(token, !includesOtherImes); mImm.switchToNextInputMethod(token, true /* onlyCurrentIme */);
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment