abouttreesummaryrefslogcommitdiff
path: root/srcs/juloo.keyboard2/Keyboard2View.java
diff options
context:
space:
mode:
authorJules Aguillon2025-05-30 00:08:59 +0200
committerJules Aguillon2025-05-30 20:07:26 +0200
commit2a50a4a129f96784af15f82c0a5d9b09d780dd61 (patch)
tree04b849b0ce6321d31b471cade70e8fde1f9d591a /srcs/juloo.keyboard2/Keyboard2View.java
parent9ab099175d8b0548eeeb77cc963dd1c13b9cbaf7 (diff)
downloadunexpected-keyboard-2a50a4a129f96784af15f82c0a5d9b09d780dd61.tar.gz
unexpected-keyboard-2a50a4a129f96784af15f82c0a5d9b09d780dd61.zip
Fix high keyboard height making it overflows
The calculation for the size of each rows now avoid making the keyboard bigger than the screen if the Keyboard Height option is unusually high. The height calculation with the default settings is changed slightly, it is now assuming that a layout is 3.95 rows high instead of 4. This is because the bottom row is usually 0.95% the size of other rows.
Diffstat (limited to 'srcs/juloo.keyboard2/Keyboard2View.java')
-rw-r--r--srcs/juloo.keyboard2/Keyboard2View.java14
1 files changed, 7 insertions, 7 deletions
diff --git a/srcs/juloo.keyboard2/Keyboard2View.java b/srcs/juloo.keyboard2/Keyboard2View.java
index 684e42a..23d2a0a 100644
--- a/srcs/juloo.keyboard2/Keyboard2View.java
+++ b/srcs/juloo.keyboard2/Keyboard2View.java
@@ -229,7 +229,7 @@ public class Keyboard2View extends View
return null;
for (KeyboardData.Row row : _keyboard.rows)
{
- y += (row.shift + row.height) * _config.keyHeight;
+ y += (row.shift + row.height) * _tc.row_height;
if (ty < y)
return row;
}
@@ -309,19 +309,19 @@ public class Keyboard2View extends View
_marginRight = Math.max(_config.horizontal_margin, insets_right);
_marginBottom = _config.margin_bottom + insets_bottom;
_keyWidth = (width - _marginLeft - _marginRight) / _keyboard.keysWidth;
- _tc = new Theme.Computed(_theme, _config, _keyWidth);
+ _tc = new Theme.Computed(_theme, _config, _keyWidth, _keyboard);
// Compute the size of labels based on the width or the height of keys. The
// margin around keys is taken into account. Keys normal aspect ratio is
// assumed to be 3/2. It's generally more, the width computation is useful
// when the keyboard is unusually high.
float labelBaseSize = Math.min(
- _config.keyHeight - _tc.vertical_margin,
+ _tc.row_height - _tc.vertical_margin,
_keyWidth * 3/2 - _tc.horizontal_margin
) * _config.characterSize;
_mainLabelSize = labelBaseSize * _config.labelTextSize;
_subLabelSize = labelBaseSize * _config.sublabelTextSize;
int height =
- (int)(_config.keyHeight * _keyboard.keysHeight
+ (int)(_tc.row_height * _keyboard.keysHeight
+ _config.marginTop + _marginBottom);
setMeasuredDimension(width, height);
}
@@ -364,9 +364,9 @@ public class Keyboard2View extends View
float y = _tc.margin_top;
for (KeyboardData.Row row : _keyboard.rows)
{
- y += row.shift * _config.keyHeight;
+ y += row.shift * _tc.row_height;
float x = _marginLeft + _tc.margin_left;
- float keyH = row.height * _config.keyHeight - _tc.vertical_margin;
+ float keyH = row.height * _tc.row_height - _tc.vertical_margin;
for (KeyboardData.Key k : row.keys)
{
x += k.shift * _keyWidth;
@@ -384,7 +384,7 @@ public class Keyboard2View extends View
drawIndication(canvas, k, x, y, keyW, keyH, _tc);
x += _keyWidth * k.width;
}
- y += row.height * _config.keyHeight;
+ y += row.height * _tc.row_height;
}
}