diff --git a/srcs/juloo.keyboard2/Config.java b/srcs/juloo.keyboard2/Config.java index 63befa5..92cd8a6 100644 --- a/srcs/juloo.keyboard2/Config.java +++ b/srcs/juloo.keyboard2/Config.java @@ -86,7 +86,9 @@ final class Config longPressTimeout = prefs.getInt("longpress_timeout", (int)longPressTimeout); longPressInterval = prefs.getInt("longpress_interval", (int)longPressInterval); marginBottom = getDipPref(dm, prefs, "margin_bottom", marginBottom); - keyHeight = getDipPref(dm, prefs, "key_height", keyHeight); + // Add keyVerticalInterval to keyHeight because the space between the keys + // is removed from the keys during rendering + keyHeight = getDipPref(dm, prefs, "key_height", keyHeight) + keyVerticalInterval; horizontalMargin = getDipPref(dm, prefs, "horizontal_margin", horizontalMargin); preciseRepeat = prefs.getBoolean("precise_repeat", preciseRepeat); characterSize = prefs.getFloat("character_size", characterSize); diff --git a/srcs/juloo.keyboard2/Keyboard2View.java b/srcs/juloo.keyboard2/Keyboard2View.java index 5e687d7..18a6c72 100644 --- a/srcs/juloo.keyboard2/Keyboard2View.java +++ b/srcs/juloo.keyboard2/Keyboard2View.java @@ -349,7 +349,7 @@ public class Keyboard2View extends View int width = dm.widthPixels; int height = (int)(_config.keyHeight * _keyboard.keysHeight - + _keyboard.rows.size() * _config.keyVerticalInterval + + _keyboard.rows.size() + _config.marginTop + _config.marginBottom); setMeasuredDimension(width, height); _keyWidth = (width - (_config.horizontalMargin * 2)) / _keyboard.keysWidth; @@ -358,15 +358,15 @@ public class Keyboard2View extends View @Override protected void onDraw(Canvas canvas) { - float y = _config.marginTop; + float y = _config.marginTop + _config.keyVerticalInterval / 2; for (KeyboardData.Row row : _keyboard.rows) { y += row.shift * _config.keyHeight; - float x = _config.horizontalMargin; - float keyH = row.height * _config.keyHeight; + float x = _config.horizontalMargin + _config.keyHorizontalInterval / 2; + float keyH = row.height * _config.keyHeight - _config.keyVerticalInterval; for (KeyboardData.Key k : row.keys) { - x += k.shift * _keyWidth + _config.keyHorizontalInterval; + x += k.shift * _keyWidth; float keyW = _keyWidth * k.width - _config.keyHorizontalInterval; KeyDown keyDown = getKeyDown(k); _tmpRect.set(x, y, x + keyW, y + keyH); @@ -383,9 +383,9 @@ public class Keyboard2View extends View drawSubLabel(canvas, k.key2, x + keyW - subPadding, y + subPadding, true, true, keyDown); if (k.key4 != null) drawSubLabel(canvas, k.key4, x + keyW - subPadding, y + keyH - subPadding, true, false, keyDown); - x += keyW; + x += _keyWidth * k.width; } - y += keyH + _config.keyVerticalInterval; + y += row.height * _config.keyHeight; } }