forked from extern/Unexpected-Keyboard
Show keys description in settings
The symbols alone might be hard to understand when scrolling through the "extra keys" option.
This commit is contained in:
parent
344df4c5c1
commit
ff0c0354d6
@ -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);
|
||||
}
|
||||
|
||||
|
@ -342,6 +342,25 @@ final class KeyValue
|
||||
addPlaceholderKey("f12_placeholder");
|
||||
}
|
||||
|
||||
static final HashMap<String, String> keys_descr = new HashMap<String, String>();
|
||||
|
||||
/* 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)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user