From 458e17bf31c9ef6b4dfadd56dd0c0dfb709eb32c Mon Sep 17 00:00:00 2001 From: Jules Aguillon Date: Tue, 18 Jul 2023 00:31:32 +0200 Subject: Add custom extra keys preference This is a new section in the extra keys option that allows to enter arbitrary strings which are then added to the keyboard. A new string is needed for the title of the section, Android's icons and strings are used as much as possible to avoid adding more strings. Keys are stored in the preferences as a JSON array of strings. --- srcs/juloo.keyboard2/Config.java | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'srcs/juloo.keyboard2/Config.java') diff --git a/srcs/juloo.keyboard2/Config.java b/srcs/juloo.keyboard2/Config.java index 1bc406c..c6b3ed4 100644 --- a/srcs/juloo.keyboard2/Config.java +++ b/srcs/juloo.keyboard2/Config.java @@ -62,6 +62,7 @@ final class Config public boolean swapEnterActionKey; // Swap the "enter" and "action" keys public ExtraKeys extra_keys_subtype; public Set extra_keys_param; + public List extra_keys_custom; public final IKeyEventHandler handler; public boolean orientation_landscape = false; @@ -155,6 +156,7 @@ final class Config autocapitalisation = _prefs.getBoolean("autocapitalisation", true); switch_input_immediate = _prefs.getBoolean("switch_input_immediate", false); extra_keys_param = ExtraKeysPreference.get_extra_keys(_prefs); + extra_keys_custom = CustomExtraKeysPreference.get(_prefs); } KeyValue action_key() @@ -170,6 +172,7 @@ final class Config * - Replace the action key to show the right label * - Swap the enter and action keys * - Add the optional numpad and number row + * - Add the extra keys */ public KeyboardData modify_layout(KeyboardData kw) { @@ -181,6 +184,7 @@ final class Config if (extra_keys_subtype != null) extra_keys_subtype.compute(extra_keys, kw.script); extra_keys.addAll(extra_keys_param); + extra_keys.addAll(extra_keys_custom); boolean number_row = this.number_row && !show_numpad; if (number_row) KeyboardData.number_row.getKeys(remove_keys); -- cgit v1.2.3