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.
This commit is contained in:
Jules Aguillon 2023-02-26 11:31:08 +01:00
parent 0d902aa334
commit 798494e701
2 changed files with 3 additions and 3 deletions

View File

@ -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;

View File

@ -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)