abouttreesummaryrefslogcommitdiff
path: root/srcs/juloo.keyboard2/KeyboardData.java
diff options
context:
space:
mode:
authorJules Aguillon2022-01-09 20:26:06 +0100
committerJules Aguillon2022-01-09 20:26:06 +0100
commit53113cadd9654c827ae306905dae4d738dedf818 (patch)
treefe56afe810939608893fd82732e9f7f29105a563 /srcs/juloo.keyboard2/KeyboardData.java
parent4b43645c4b6632d0cd2388b90e7bc2bbde98087e (diff)
downloadunexpected-keyboard-53113cadd9654c827ae306905dae4d738dedf818.tar.gz
unexpected-keyboard-53113cadd9654c827ae306905dae4d738dedf818.zip
Add the Action key
It is placed on the top-right of the enter key on every layouts. It sends a special event (performEditorAction) instead of writing a newline. The "actionId" is passed through the EditorInfo object in an obfuscated way so it's not clear whether it's using the right one.
Diffstat (limited to 'srcs/juloo.keyboard2/KeyboardData.java')
-rw-r--r--srcs/juloo.keyboard2/KeyboardData.java32
1 files changed, 21 insertions, 11 deletions
diff --git a/srcs/juloo.keyboard2/KeyboardData.java b/srcs/juloo.keyboard2/KeyboardData.java
index db3b884..67b5db4 100644
--- a/srcs/juloo.keyboard2/KeyboardData.java
+++ b/srcs/juloo.keyboard2/KeyboardData.java
@@ -57,11 +57,11 @@ class KeyboardData
return new KeyboardData(rows);
}
- public KeyboardData removeKeys(MapKeys f)
+ public KeyboardData replaceKeys(MapKeys f)
{
ArrayList<Row> rows_ = new ArrayList<Row>();
for (Row r : rows)
- rows_.add(r.removeKeys(f));
+ rows_.add(r.replaceKeys(f));
return new KeyboardData(rows_);
}
@@ -105,11 +105,11 @@ class KeyboardData
return new Row(keys, h, shift);
}
- public Row removeKeys(MapKeys f)
+ public Row replaceKeys(MapKeys f)
{
ArrayList<Key> keys_ = new ArrayList<Key>();
for (Key k : keys)
- keys_.add(k.removeKeys(f));
+ keys_.add(k.replaceKeys(f));
return new Row(keys_, height, shift);
}
}
@@ -157,7 +157,7 @@ class KeyboardData
return new Key(k0, k1, k2, k3, k4, width, shift);
}
- public Key removeKeys(MapKeys f)
+ public Key replaceKeys(MapKeys f)
{
return new Key(f.map(key0), f.map(key1), f.map(key2), f.map(key3), f.map(key4), width, shift);
}
@@ -168,27 +168,37 @@ class KeyboardData
public abstract KeyValue map(KeyValue k);
}
- public static class RemoveKeysByFlags implements MapKeys
+ public static class ReplaceKeysByFlags implements MapKeys
{
private final int _flags;
+ private final KeyValue _replacement;
- public RemoveKeysByFlags(int flags) { _flags = flags; }
+ public ReplaceKeysByFlags(int flags, KeyValue r)
+ {
+ _flags = flags;
+ _replacement = r;
+ }
public KeyValue map(KeyValue k)
{
- return (k == null || (k.flags & _flags) != 0) ? null : k;
+ return (k != null && (k.flags & _flags) != 0) ? _replacement : k;
}
}
- public static class RemoveKeysByEvent implements MapKeys
+ public static class ReplaceKeysByEvent implements MapKeys
{
private final int _eventCode;
+ private final KeyValue _replacement;
- public RemoveKeysByEvent(int ev) { _eventCode = ev; }
+ public ReplaceKeysByEvent(int ev, KeyValue r)
+ {
+ _eventCode = ev;
+ _replacement = r;
+ }
public KeyValue map(KeyValue k)
{
- return (k == null || k.eventCode == _eventCode) ? null : k;
+ return (k != null && k.eventCode == _eventCode) ? _replacement : k;
}
}
}