From 25a6e71ee815a196d76358cf132c45eb38a10b35 Mon Sep 17 00:00:00 2001 From: Jules Aguillon Date: Mon, 19 Sep 2022 11:41:18 +0200 Subject: 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. --- srcs/juloo.keyboard2/Config.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'srcs/juloo.keyboard2/Config.java') 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 extra_keys; // 'null' means all the keys + public Set extra_keys_subtype; + public Set 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 extra_keys = new HashSet(this.extra_keys); + final Set extra_keys = new HashSet(); + 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) { -- cgit v1.2.3