abouttreesummaryrefslogcommitdiff
path: root/srcs/juloo.keyboard2
diff options
context:
space:
mode:
authorJules Aguillon2022-10-16 01:07:24 +0200
committerJules Aguillon2022-10-16 01:07:24 +0200
commit75df3afda64e6c533bec537b6f36d1dba55a93d6 (patch)
tree15b7dcc6b333ba560eaa9c710297098ee3539c80 /srcs/juloo.keyboard2
parent7fb5c992b6235d350cbd45962d1e51c5a044d019 (diff)
downloadunexpected-keyboard-75df3afda64e6c533bec537b6f36d1dba55a93d6.tar.gz
unexpected-keyboard-75df3afda64e6c533bec537b6f36d1dba55a93d6.zip
Allow to disable Alt and Meta keys
The keys are marked "loc" in the layouts and are handled like the other extra keys. The only difference is that they are enabled by default (for now).
Diffstat (limited to 'srcs/juloo.keyboard2')
-rw-r--r--srcs/juloo.keyboard2/ExtraKeyCheckBoxPreference.java17
1 files changed, 16 insertions, 1 deletions
diff --git a/srcs/juloo.keyboard2/ExtraKeyCheckBoxPreference.java b/srcs/juloo.keyboard2/ExtraKeyCheckBoxPreference.java
index 0a98b9d..d0734b9 100644
--- a/srcs/juloo.keyboard2/ExtraKeyCheckBoxPreference.java
+++ b/srcs/juloo.keyboard2/ExtraKeyCheckBoxPreference.java
@@ -14,6 +14,8 @@ public class ExtraKeyCheckBoxPreference extends CheckBoxPreference
{
public static String[] extra_keys = new String[]
{
+ "alt",
+ "meta",
"accent_aigu",
"accent_grave",
"accent_double_aigu",
@@ -33,6 +35,18 @@ public class ExtraKeyCheckBoxPreference extends CheckBoxPreference
"switch_greekmath",
};
+ public static boolean default_checked(String name)
+ {
+ switch (name)
+ {
+ case "alt":
+ case "meta":
+ return true;
+ default:
+ return false;
+ }
+ }
+
boolean _key_font;
public ExtraKeyCheckBoxPreference(Context context, AttributeSet attrs)
@@ -43,6 +57,7 @@ public class ExtraKeyCheckBoxPreference extends CheckBoxPreference
a.recycle();
String key_name = extra_keys[index];
setKey(pref_key_of_key_name(key_name));
+ setDefaultValue(default_checked(key_name));
KeyValue kv = KeyValue.getKeyByName(key_name);
setTitle(kv.getString());
_key_font = kv.hasFlags(KeyValue.FLAG_KEY_FONT);
@@ -66,7 +81,7 @@ public class ExtraKeyCheckBoxPreference extends CheckBoxPreference
HashSet<KeyValue> ks = new HashSet<KeyValue>();
for (String key_name : extra_keys)
{
- if (prefs.getBoolean(pref_key_of_key_name(key_name), false))
+ if (prefs.getBoolean(pref_key_of_key_name(key_name), default_checked(key_name)))
ks.add(KeyValue.getKeyByName(key_name));
}
return ks;