From 93edc4ac42f6fb0a59b7bc619a1334fefcfdec22 Mon Sep 17 00:00:00 2001 From: Max Schillinger Date: Wed, 2 Feb 2022 21:46:23 +0100 Subject: 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). --- srcs/juloo.keyboard2/KeyboardData.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'srcs/juloo.keyboard2/KeyboardData.java') 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); } } -- cgit v1.2.3