From 0f62b3044c501dc5679583e06447285ebeb31118 Mon Sep 17 00:00:00 2001 From: Jules Aguillon Date: Sun, 12 Feb 2023 23:20:11 +0100 Subject: Option to switch to the previous input method A new option changes the "change_method" into the new "change_method_prev". It switch to the previously used input method. A long press on "change_method_prev" sends "change_method". A new section is added in the settings and existing options are moved. --- srcs/juloo.keyboard2/Keyboard2.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'srcs/juloo.keyboard2/Keyboard2.java') diff --git a/srcs/juloo.keyboard2/Keyboard2.java b/srcs/juloo.keyboard2/Keyboard2.java index 0065e0d..54caf3c 100644 --- a/srcs/juloo.keyboard2/Keyboard2.java +++ b/srcs/juloo.keyboard2/Keyboard2.java @@ -329,11 +329,21 @@ public class Keyboard2 extends InputMethodService /** Not static */ public class Receiver implements KeyEventHandler.IReceiver { - public void switchToNextInputMethod() { + public void switchInputMethod() + { InputMethodManager imm = (InputMethodManager)getSystemService(INPUT_METHOD_SERVICE); imm.showInputMethodPicker(); - // deprecated in version 28: imm.switchToNextInputMethod(getConnectionToken(), false); - // added in version 28: switchToNextInputMethod(false); + } + + public void switchToPrevInputMethod() + { + if (VERSION.SDK_INT < 28) + { + InputMethodManager imm = (InputMethodManager)getSystemService(INPUT_METHOD_SERVICE); + imm.switchToLastInputMethod(getConnectionToken()); + } + else + Keyboard2.this.switchToPreviousInputMethod(); } public void setPane_emoji() -- cgit v1.2.3