diff --git a/srcs/juloo.keyboard2/ExtraKeyCheckBoxPreference.java b/srcs/juloo.keyboard2/ExtraKeyCheckBoxPreference.java index e66c2cc..c75ed08 100644 --- a/srcs/juloo.keyboard2/ExtraKeyCheckBoxPreference.java +++ b/srcs/juloo.keyboard2/ExtraKeyCheckBoxPreference.java @@ -57,10 +57,14 @@ public class ExtraKeyCheckBoxPreference extends CheckBoxPreference int index = a.getInteger(R.styleable.ExtraKeyCheckBoxPreference_index, 0); a.recycle(); String key_name = extra_keys[index]; + KeyValue kv = KeyValue.getKeyByName(key_name); + String title = kv.getString(); + String descr = KeyValue.getKeyDescription(key_name); + if (descr != null) + title += " (" + descr + ")"; setKey(pref_key_of_key_name(key_name)); setDefaultValue(default_checked(key_name)); - KeyValue kv = KeyValue.getKeyByName(key_name); - setTitle(kv.getString()); + setTitle(title); _key_font = kv.hasFlags(KeyValue.FLAG_KEY_FONT); } diff --git a/srcs/juloo.keyboard2/KeyValue.java b/srcs/juloo.keyboard2/KeyValue.java index d6e1ce8..0587278 100644 --- a/srcs/juloo.keyboard2/KeyValue.java +++ b/srcs/juloo.keyboard2/KeyValue.java @@ -342,6 +342,25 @@ final class KeyValue addPlaceholderKey("f12_placeholder"); } + static final HashMap keys_descr = new HashMap(); + + /* Some keys have a description attached. Return [null] if otherwise. */ + public static String getKeyDescription(String name) + { + return keys_descr.get(name); + } + + static void addKeyDescr(String name, String descr) + { + keys_descr.put(name, descr); + } + + static { + /* Keys description is shown in the settings. */ + addKeyDescr("capslock", "Caps lock"); + addKeyDescr("switch_greekmath", "Greek & math symbols"); + } + // Substitute for [assert], which has no effect on Android. private static void check(boolean b) {