avoid immediate switch to other app when language key switches both layouts and keyboard apps

This commit is contained in:
Helium314 2024-03-06 21:29:11 +01:00
parent 0298973d91
commit 2a13ae186a

View file

@ -526,7 +526,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
final class SubtypeState { final class SubtypeState {
private InputMethodSubtype mLastActiveSubtype; private InputMethodSubtype mLastActiveSubtype;
private boolean mCurrentSubtypeHasBeenUsed; private boolean mCurrentSubtypeHasBeenUsed = true; // starting with true avoids immediate switch
public void setCurrentSubtypeHasBeenUsed() { public void setCurrentSubtypeHasBeenUsed() {
mCurrentSubtypeHasBeenUsed = true; mCurrentSubtypeHasBeenUsed = true;
@ -1477,13 +1477,10 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
} }
if (shouldSwitchToOtherInputMethods()) { if (shouldSwitchToOtherInputMethods()) {
final InputMethodSubtype nextSubtype = mRichImm.getNextSubtypeInThisIme(false); final InputMethodSubtype nextSubtype = mRichImm.getNextSubtypeInThisIme(false);
// todo (later): this will switch IME if we are at the end of the list, but ideally we
// want to switch IME only if all internal subtypes are unused
// -> need to store used/unused subtypes in mSubtypeState
if (nextSubtype != null) { if (nextSubtype != null) {
switchToSubtype(nextSubtype); switchToSubtype(nextSubtype);
return; return;
} else if (switchInputMethod()){ } else if (switchInputMethod()) {
return; return;
} }
} }