diff options
| author | Jules Aguillon | 2023-01-30 23:58:47 +0100 |
|---|---|---|
| committer | Jules Aguillon | 2023-01-30 23:58:47 +0100 |
| commit | 540384bb0a29b9e43dd4fe69fd5fc8f380fd6cbd (patch) | |
| tree | cf7a213bb421680a1eec252c5d13e04d757cba24 /srcs/juloo.keyboard2/KeyboardData.java | |
| parent | c7184303e9e291487641324468ec60417ef47bf7 (diff) | |
| download | unexpected-keyboard-540384bb0a29b9e43dd4fe69fd5fc8f380fd6cbd.tar.gz unexpected-keyboard-540384bb0a29b9e43dd4fe69fd5fc8f380fd6cbd.zip | |
Add optional number row
An option is added to enable an extra number row at the top of the
keyboard. Digits are removed from the keyboard while the number row is
visible.
Diffstat (limited to 'srcs/juloo.keyboard2/KeyboardData.java')
| -rw-r--r-- | srcs/juloo.keyboard2/KeyboardData.java | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/srcs/juloo.keyboard2/KeyboardData.java b/srcs/juloo.keyboard2/KeyboardData.java index 5130284..078e849 100644 --- a/srcs/juloo.keyboard2/KeyboardData.java +++ b/srcs/juloo.keyboard2/KeyboardData.java @@ -72,6 +72,12 @@ class KeyboardData return new KeyboardData(extendedRows, compute_max_width(extendedRows)); } + public KeyboardData addNumberRow() + { + rows.add(0, number_row.updateWidth(keysWidth)); + return this; + } + public Key findKeyWithValue(KeyValue kv) { for (Row r : rows) @@ -104,6 +110,7 @@ class KeyboardData } public static Row bottom_row; + public static Row number_row; public static KeyboardData num_pad; public static KeyboardData pin_entry; private static Map<Integer, KeyboardData> _layoutCache = new HashMap<Integer, KeyboardData>(); @@ -112,7 +119,8 @@ class KeyboardData { try { - bottom_row = parse_bottom_row(res.getXml(R.xml.bottom_row)); + bottom_row = parse_row(res.getXml(R.xml.bottom_row)); + number_row = parse_row(res.getXml(R.xml.number_row)); num_pad = parse_keyboard(res.getXml(R.xml.numpad)); } catch (Exception e) @@ -187,10 +195,10 @@ class KeyboardData return w; } - private static Row parse_bottom_row(XmlPullParser parser) throws Exception + private static Row parse_row(XmlPullParser parser) throws Exception { if (!expect_tag(parser, "row")) - throw new Exception("Failed to parse bottom row"); + throw new Exception("Failed to parse row"); return Row.parse(parser); } |
