abouttreesummaryrefslogcommitdiff
path: root/srcs
diff options
context:
space:
mode:
authorJules Aguillon2023-02-26 11:31:08 +0100
committerJules Aguillon2023-02-26 11:31:08 +0100
commit798494e701b456f43fd5c63cbd70eb4bcff141c6 (patch)
treed73d0c05e2e0b5a78310683260e3465eb2e5cc9e /srcs
parent0d902aa3348678251fc226c6fcaf04788ab5cf32 (diff)
downloadunexpected-keyboard-798494e701b456f43fd5c63cbd70eb4bcff141c6.tar.gz
unexpected-keyboard-798494e701b456f43fd5c63cbd70eb4bcff141c6.zip
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.
Diffstat (limited to 'srcs')
-rw-r--r--srcs/juloo.keyboard2/Keyboard2View.java1
-rw-r--r--srcs/juloo.keyboard2/KeyboardData.java5
2 files changed, 3 insertions, 3 deletions
diff --git a/srcs/juloo.keyboard2/Keyboard2View.java b/srcs/juloo.keyboard2/Keyboard2View.java
index 17b5eec..88f8e6b 100644
--- a/srcs/juloo.keyboard2/Keyboard2View.java
+++ b/srcs/juloo.keyboard2/Keyboard2View.java
@@ -229,7 +229,6 @@ public class Keyboard2View extends View
int width = dm.widthPixels;
int height =
(int)(_config.keyHeight * _keyboard.keysHeight
- + _keyboard.rows.size()
+ _config.marginTop + _config.margin_bottom);
setMeasuredDimension(width, height);
_keyWidth = (width - (_config.horizontal_margin * 2)) / _keyboard.keysWidth;
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<Row> rows_ = new ArrayList<Row>(this.rows);
+ rows_.add(0, number_row.updateWidth(keysWidth));
+ return new KeyboardData(rows_, keysWidth);
}
public Key findKeyWithValue(KeyValue kv)