abouttreesummaryrefslogcommitdiff
path: root/srcs/juloo.keyboard2/Config.java
diff options
context:
space:
mode:
authorJules Aguillon2022-09-19 11:41:18 +0200
committerJules Aguillon2022-09-19 11:41:18 +0200
commit25a6e71ee815a196d76358cf132c45eb38a10b35 (patch)
tree99a76bca782a96e8abe0a9311e6ad4f924e2a7fe /srcs/juloo.keyboard2/Config.java
parent617f0878bca876bc7163b82586e0ea9a4a623c84 (diff)
downloadunexpected-keyboard-25a6e71ee815a196d76358cf132c45eb38a10b35.tar.gz
unexpected-keyboard-25a6e71ee815a196d76358cf132c45eb38a10b35.zip
Add the Extra Keys option
Allows to add more keys to the keyboard from a predefined list. The implementation doesn't use MultiSelectListPreference because it doesn't seem possible to change the item layout to properly show the rendered symbols.
Diffstat (limited to 'srcs/juloo.keyboard2/Config.java')
-rw-r--r--srcs/juloo.keyboard2/Config.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/srcs/juloo.keyboard2/Config.java b/srcs/juloo.keyboard2/Config.java
index 9dbf556..0f2fd69 100644
--- a/srcs/juloo.keyboard2/Config.java
+++ b/srcs/juloo.keyboard2/Config.java
@@ -47,7 +47,8 @@ final class Config
public String actionLabel; // Might be 'null'
public int actionId; // Meaningful only when 'actionLabel' isn't 'null'
public boolean swapEnterActionKey; // Swap the "enter" and "action" keys
- public Set<KeyValue> extra_keys; // 'null' means all the keys
+ public Set<KeyValue> extra_keys_subtype;
+ public Set<KeyValue> extra_keys_param;
public final IKeyEventHandler handler;
@@ -81,7 +82,7 @@ final class Config
actionLabel = null;
actionId = 0;
swapEnterActionKey = false;
- extra_keys = null;
+ extra_keys_subtype = null;
handler = h;
}
@@ -149,6 +150,7 @@ final class Config
accents = Integer.valueOf(prefs.getString("accents", "1"));
theme = getThemeId(res, prefs.getString("theme", ""));
autocapitalisation = prefs.getBoolean("autocapitalisation", true);
+ extra_keys_param = ExtraKeyCheckBoxPreference.get_extra_keys(prefs);
}
/** Update the layout according to the configuration.
@@ -164,7 +166,9 @@ final class Config
KeyValue.getKeyByName("action").withSymbol(actionLabel);
// Extra keys are removed from the set as they are encountered during the
// first iteration then automatically added.
- final Set<KeyValue> extra_keys = new HashSet<KeyValue>(this.extra_keys);
+ final Set<KeyValue> extra_keys = new HashSet<KeyValue>();
+ extra_keys.addAll(extra_keys_subtype);
+ extra_keys.addAll(extra_keys_param);
KeyboardData kw = original_kw.mapKeys(new KeyboardData.MapKeyValues() {
public KeyValue apply(KeyValue key, boolean localized)
{