From fd0f0d54766de6c5621e5a09e192f75f3c05782c Mon Sep 17 00:00:00 2001 From: Jules Aguillon Date: Sun, 15 Jan 2023 19:19:07 +0100 Subject: [PATCH] Separate option for bottom margin in landscape mode A large margin in portrait mode is desirable but generally not in landscape mode. --- res/values-land/dimens.xml | 1 + res/xml/settings.xml | 5 ++++- srcs/juloo.keyboard2/Config.java | 4 ++-- srcs/juloo.keyboard2/Keyboard2View.java | 4 ++-- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/res/values-land/dimens.xml b/res/values-land/dimens.xml index 7cdc3b5..2e3517f 100644 --- a/res/values-land/dimens.xml +++ b/res/values-land/dimens.xml @@ -1,5 +1,6 @@ 28dp + 3dp 48dp diff --git a/res/xml/settings.xml b/res/xml/settings.xml index 5554b8f..b48ec84 100644 --- a/res/xml/settings.xml +++ b/res/xml/settings.xml @@ -57,7 +57,10 @@ - + + + + diff --git a/srcs/juloo.keyboard2/Config.java b/srcs/juloo.keyboard2/Config.java index 24a396d..3a22118 100644 --- a/srcs/juloo.keyboard2/Config.java +++ b/srcs/juloo.keyboard2/Config.java @@ -32,7 +32,7 @@ final class Config public boolean vibrateEnabled; public long longPressTimeout; public long longPressInterval; - public float marginBottom; + public float margin_bottom; public float keyHeight; public float horizontal_margin; public float keyVerticalInterval; @@ -122,7 +122,7 @@ final class Config vibrateEnabled = _prefs.getBoolean("vibrate_enabled", true); longPressTimeout = _prefs.getInt("longpress_timeout", 600); longPressInterval = _prefs.getInt("longpress_interval", 65); - marginBottom = get_dip_pref(dm, "margin_bottom", + margin_bottom = get_dip_pref(dm, oriented_pref("margin_bottom"), res.getDimension(R.dimen.margin_bottom)); keyVerticalInterval = get_dip_pref(dm, "key_vertical_space", res.getDimension(R.dimen.key_vertical_interval)); diff --git a/srcs/juloo.keyboard2/Keyboard2View.java b/srcs/juloo.keyboard2/Keyboard2View.java index 835d595..be7647d 100644 --- a/srcs/juloo.keyboard2/Keyboard2View.java +++ b/srcs/juloo.keyboard2/Keyboard2View.java @@ -230,7 +230,7 @@ public class Keyboard2View extends View int height = (int)(_config.keyHeight * _keyboard.keysHeight + _keyboard.rows.size() - + _config.marginTop + _config.marginBottom); + + _config.marginTop + _config.margin_bottom); setMeasuredDimension(width, height); _keyWidth = (width - (_config.horizontal_margin * 2)) / _keyboard.keysWidth; } @@ -247,7 +247,7 @@ public class Keyboard2View extends View left + (int)_config.horizontal_margin, top + (int)_config.marginTop, right - (int)_config.horizontal_margin, - bottom - (int)_config.marginBottom); + bottom - (int)_config.margin_bottom); setSystemGestureExclusionRects(Arrays.asList(keyboard_area)); } }