abouttreesummaryrefslogcommitdiff
path: root/srcs/juloo.keyboard2/KeyboardData.java
diff options
context:
space:
mode:
authorMax Schillinger2022-02-02 21:46:23 +0100
committerJules Aguillon2022-02-06 23:49:43 +0100
commit93edc4ac42f6fb0a59b7bc619a1334fefcfdec22 (patch)
tree0f96f5d0ded5b346fa29f3531878e3b300a0258f /srcs/juloo.keyboard2/KeyboardData.java
parent7383cc4b68c20129c9c58730a3d530e7922e8404 (diff)
downloadunexpected-keyboard-93edc4ac42f6fb0a59b7bc619a1334fefcfdec22.tar.gz
unexpected-keyboard-93edc4ac42f6fb0a59b7bc619a1334fefcfdec22.zip
Allow egde keys instead of corner keys (swipe vertically/horizontally)
Add a new boolean parameter "edgekeys" for defining keys that have the additional (swipe) keys on the edges (top, right, left, bottom) instead of at the corners (top left, top right, bottom left, bottom right).
Diffstat (limited to 'srcs/juloo.keyboard2/KeyboardData.java')
-rw-r--r--srcs/juloo.keyboard2/KeyboardData.java15
1 files changed, 12 insertions, 3 deletions
diff --git a/srcs/juloo.keyboard2/KeyboardData.java b/srcs/juloo.keyboard2/KeyboardData.java
index 61a4ebf..2153534 100644
--- a/srcs/juloo.keyboard2/KeyboardData.java
+++ b/srcs/juloo.keyboard2/KeyboardData.java
@@ -131,8 +131,10 @@ class KeyboardData
public final float width;
/* Extra empty space on the left of the key. */
public final float shift;
+ /* Put keys 1 to 4 on the edges instead of the corners. */
+ public final boolean edgekeys;
- public Key(KeyValue k0, KeyValue k1, KeyValue k2, KeyValue k3, KeyValue k4, float w, float s)
+ public Key(KeyValue k0, KeyValue k1, KeyValue k2, KeyValue k3, KeyValue k4, float w, float s, boolean e)
{
key0 = k0;
key1 = k1;
@@ -141,6 +143,12 @@ class KeyboardData
key4 = k4;
width = w;
shift = s;
+ edgekeys = e;
+ }
+
+ public Key(KeyValue k0, KeyValue k1, KeyValue k2, KeyValue k3, KeyValue k4, float w, float s)
+ {
+ this(k0, k1, k2, k3, k4, w, s, false);
}
public static Key parse(XmlResourceParser parser) throws Exception
@@ -152,14 +160,15 @@ class KeyboardData
KeyValue k4 = KeyValue.getKeyByName(parser.getAttributeValue(null, "key4"));
float width = parser.getAttributeFloatValue(null, "width", 1f);
float shift = parser.getAttributeFloatValue(null, "shift", 0.f);
+ boolean edgekeys = parser.getAttributeBooleanValue(null, "edgekeys", false);
while (parser.next() != XmlResourceParser.END_TAG)
continue ;
- return new Key(k0, k1, k2, k3, k4, width, shift);
+ return new Key(k0, k1, k2, k3, k4, width, shift, edgekeys);
}
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);
+ return new Key(f.map(key0), f.map(key1), f.map(key2), f.map(key3), f.map(key4), width, shift, edgekeys);
}
}