From b236a74b648399c92675558e2674478fc24c3be5 Mon Sep 17 00:00:00 2001 From: Jules Aguillon Date: Mon, 6 Jun 2022 15:40:32 +0200 Subject: [PATCH] Increase horizontal spacing in landscape mode Space between the keys and margin on the left and right edges of the screen. --- res/values-land/dimens.xml | 2 +- srcs/juloo.keyboard2/Config.java | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/res/values-land/dimens.xml b/res/values-land/dimens.xml index fb04c3d..5d63986 100644 --- a/res/values-land/dimens.xml +++ b/res/values-land/dimens.xml @@ -7,5 +7,5 @@ 0.4 0.3 48dp - 20dp + 25dp diff --git a/srcs/juloo.keyboard2/Config.java b/srcs/juloo.keyboard2/Config.java index 552aadf..43c11a6 100644 --- a/srcs/juloo.keyboard2/Config.java +++ b/srcs/juloo.keyboard2/Config.java @@ -97,9 +97,12 @@ final class Config // The height of the keyboard is relative to the height of the screen. // This is the height of the keyboard if it have 4 rows. int keyboardHeightPercent; + // Increase the horizontal space between the keys + float horizontalIntervalScale = 1.f; if (res.getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) // Landscape mode { keyboardHeightPercent = prefs.getInt("keyboard_height_landscape", 50); + horizontalIntervalScale = 2.f; } else { @@ -120,11 +123,15 @@ final class Config longPressInterval = prefs.getInt("longpress_interval", (int)longPressInterval); marginBottom = getDipPref(dm, prefs, "margin_bottom", marginBottom); keyVerticalInterval = getDipPref(dm, prefs, "key_vertical_space", keyVerticalInterval); - keyHorizontalInterval = getDipPref(dm, prefs, "key_horizontal_space", keyHorizontalInterval); + keyHorizontalInterval = + getDipPref(dm, prefs, "key_horizontal_space", keyHorizontalInterval) + * horizontalIntervalScale; // Do not substract keyVerticalInterval from keyHeight because this is done // during rendered. keyHeight = dm.heightPixels * keyboardHeightPercent / 100 / 4; - horizontalMargin = getDipPref(dm, prefs, "horizontal_margin", horizontalMargin) + res.getDimension(R.dimen.extra_horizontal_margin); + horizontalMargin = + getDipPref(dm, prefs, "horizontal_margin", horizontalMargin) + + res.getDimension(R.dimen.extra_horizontal_margin); preciseRepeat = prefs.getBoolean("precise_repeat", preciseRepeat); lockable_modifiers.clear(); if (prefs.getBoolean("lockable_shift", true)) lockable_modifiers.add(KeyValue.Modifier.SHIFT);