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/Config.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'srcs/juloo.keyboard2/Config.java') diff --git a/srcs/juloo.keyboard2/Config.java b/srcs/juloo.keyboard2/Config.java index eda2740..586db4e 100644 --- a/srcs/juloo.keyboard2/Config.java +++ b/srcs/juloo.keyboard2/Config.java @@ -48,6 +48,7 @@ final class Config public int accents; // Values are R.values.pref_accents_v_* public int theme; // Values are R.style.* public boolean autocapitalisation; + public boolean switch_input_immediate; // Dynamically set public boolean shouldOfferSwitchingToNextInputMethod; @@ -152,6 +153,7 @@ final class Config accents = Integer.valueOf(_prefs.getString("accents", "1")); theme = getThemeId(res, _prefs.getString("theme", "")); autocapitalisation = _prefs.getBoolean("autocapitalisation", true); + switch_input_immediate = _prefs.getBoolean("switch_input_immediate", false); extra_keys_param = ExtraKeyCheckBoxPreference.get_extra_keys(_prefs); } @@ -200,7 +202,11 @@ final class Config switch (key.getEvent()) { case CHANGE_METHOD: - return shouldOfferSwitchingToNextInputMethod ? key : null; + if (!shouldOfferSwitchingToNextInputMethod) + return null; + if (switch_input_immediate) + return KeyValue.getKeyByName("change_method_prev"); + return key; case ACTION: return (swapEnterActionKey && action_key != null) ? KeyValue.getKeyByName("enter") : action_key; -- cgit v1.2.3