From 798494e701b456f43fd5c63cbd70eb4bcff141c6 Mon Sep 17 00:00:00 2001 From: Jules Aguillon Date: Sun, 26 Feb 2023 11:31:08 +0100 Subject: Fix miscalculated keyboard height with number row The 'keysHeight' field needs to be updated. As this class is not intended to be mutable, copy the list of rows and call the constructor. Also remove an unecessary component of the keyboard height calculation. --- srcs/juloo.keyboard2/KeyboardData.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'srcs/juloo.keyboard2/KeyboardData.java') diff --git a/srcs/juloo.keyboard2/KeyboardData.java b/srcs/juloo.keyboard2/KeyboardData.java index 078e849..1c5de76 100644 --- a/srcs/juloo.keyboard2/KeyboardData.java +++ b/srcs/juloo.keyboard2/KeyboardData.java @@ -74,8 +74,9 @@ class KeyboardData public KeyboardData addNumberRow() { - rows.add(0, number_row.updateWidth(keysWidth)); - return this; + ArrayList rows_ = new ArrayList(this.rows); + rows_.add(0, number_row.updateWidth(keysWidth)); + return new KeyboardData(rows_, keysWidth); } public Key findKeyWithValue(KeyValue kv) -- cgit v1.2.3