abouttreesummaryrefslogcommitdiff
path: root/srcs/juloo.keyboard2/Config.java
diff options
context:
space:
mode:
authorJules Aguillon2023-07-18 00:31:32 +0200
committerJules Aguillon2023-07-19 23:30:58 +0200
commit458e17bf31c9ef6b4dfadd56dd0c0dfb709eb32c (patch)
tree7e4bd6dd451f13071fd85ebecb984388c236fd39 /srcs/juloo.keyboard2/Config.java
parent324aa26ba4d062edcbbecab9de2f0a8f2c3c8dfc (diff)
downloadunexpected-keyboard-458e17bf31c9ef6b4dfadd56dd0c0dfb709eb32c.tar.gz
unexpected-keyboard-458e17bf31c9ef6b4dfadd56dd0c0dfb709eb32c.zip
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.
Diffstat (limited to 'srcs/juloo.keyboard2/Config.java')
-rw-r--r--srcs/juloo.keyboard2/Config.java4
1 files changed, 4 insertions, 0 deletions
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<KeyValue> extra_keys_param;
+ public List<KeyValue> 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);