mirror of
https://github.com/Julow/Unexpected-Keyboard.git
synced 2024-11-22 07:13:13 +01:00
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).
This commit is contained in:
parent
7fb5c992b6
commit
75df3afda6
@ -36,8 +36,8 @@
|
||||
<key width="1.5" key0="backspace" key1="delete" key3=";"/>
|
||||
</row>
|
||||
<row height="0.95">
|
||||
<key width="1.8" key0="ctrl" key2="meta" key4="switch_numeric"/>
|
||||
<key width="1.2" key0="fn" key1="alt" key2="change_method" key3="switch_emoji" key4="config"/>
|
||||
<key width="1.8" key0="ctrl" key2="loc meta" key4="switch_numeric"/>
|
||||
<key width="1.2" key0="fn" key1="loc alt" key2="change_method" key3="switch_emoji" key4="config"/>
|
||||
<key width="4.0" key0="space" key1="switch_programming" key2="0" edgekeys="true"/>
|
||||
<key width="1.2" key1="up" key2="right" key3="left" key4="down" edgekeys="true"/>
|
||||
<key width="1.8" key0="enter" key3="action"/>
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<row height="0.95">
|
||||
<key width="1.8" key0="ctrl" key1="loc switch_greekmath" key2="meta" key4="switch_numeric"/>
|
||||
<key width="1.2" key0="fn" key1="alt" key2="change_method" key3="switch_emoji" key4="config"/>
|
||||
<key width="1.8" key0="ctrl" key1="loc switch_greekmath" key2="loc meta" key4="switch_numeric"/>
|
||||
<key width="1.2" key0="fn" key1="loc alt" key2="change_method" key3="switch_emoji" key4="config"/>
|
||||
<key width="4.0" key0="space" key1="switch_programming" edgekeys="true"/>
|
||||
<key width="1.2" key1="up" key2="right" key3="left" key4="down" edgekeys="true"/>
|
||||
<key width="1.8" key0="enter" key2="action"/>
|
||||
|
@ -39,8 +39,8 @@
|
||||
<key width="1.5" key0="backspace" key2="delete"/>
|
||||
</row>
|
||||
<row height="0.95">
|
||||
<key width="1.8" key0="ctrl" key2="meta" key4="switch_numeric"/>
|
||||
<key width="1.2" key0="fn" key1="alt" key2="change_method" key3="switch_emoji" key4="config"/>
|
||||
<key width="1.8" key0="ctrl" key2="loc meta" key4="switch_numeric"/>
|
||||
<key width="1.2" key0="fn" key1="loc alt" key2="change_method" key3="switch_emoji" key4="config"/>
|
||||
<key width="4.0" key0="space" key1="switch_programming" edgekeys="true"/>
|
||||
<key width="1.2" key1="up" key2="right" key3="left" key4="down" edgekeys="true"/>
|
||||
<key key0="j" key4=";"/>
|
||||
|
@ -20,7 +20,7 @@
|
||||
</row>
|
||||
<row>
|
||||
<key width="0.75" key0="switch_greekmath"/>
|
||||
<key width="0.75" key0="shift" key2="fn" key4="alt"/>
|
||||
<key width="0.75" key0="shift" key2="fn" key4="loc alt"/>
|
||||
<key key0="1" key1="superscript" key2="ordinal" key3="subscript"/>
|
||||
<key key0="2"/>
|
||||
<key key0="3"/>
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user