diff options
| author | Jules Aguillon | 2022-12-31 14:00:38 +0100 |
|---|---|---|
| committer | Jules Aguillon | 2022-12-31 14:00:38 +0100 |
| commit | c5f5a23d75183823db8a8e02049c5c72f504a77c (patch) | |
| tree | 2184fc85d7570f67dd3a0b62ca45713de06dc63d /srcs/juloo.keyboard2 | |
| parent | 73ef7c67652ab05bac07fcb3fb178a24cae29d60 (diff) | |
| download | unexpected-keyboard-c5f5a23d75183823db8a8e02049c5c72f504a77c.tar.gz unexpected-keyboard-c5f5a23d75183823db8a8e02049c5c72f504a77c.zip | |
Fix dimensions going off after rotation
Values like 'characterSize' and 'horizontalMargin' can't be fed back into the default value because they are not of the same unit.
To avoid this happening again, change the way the default value is defined for every options.
The 'key_height' dimension was no longer used.
Diffstat (limited to 'srcs/juloo.keyboard2')
| -rw-r--r-- | srcs/juloo.keyboard2/Config.java | 37 |
1 files changed, 13 insertions, 24 deletions
diff --git a/srcs/juloo.keyboard2/Config.java b/srcs/juloo.keyboard2/Config.java index aa053b5..9557a00 100644 --- a/srcs/juloo.keyboard2/Config.java +++ b/srcs/juloo.keyboard2/Config.java @@ -67,21 +67,6 @@ final class Config keyPadding = res.getDimension(R.dimen.key_padding); labelTextSize = 0.33f; sublabelTextSize = 0.22f; - // default values - layout = null; - second_layout = null; - custom_layout = null; - vibrateEnabled = true; - longPressTimeout = 600; - longPressInterval = 65; - marginBottom = res.getDimension(R.dimen.margin_bottom); - keyHeight = res.getDimension(R.dimen.key_height); - horizontalMargin = res.getDimension(R.dimen.horizontal_margin); - keyVerticalInterval = res.getDimension(R.dimen.key_vertical_interval); - keyHorizontalInterval = res.getDimension(R.dimen.key_horizontal_interval); - preciseRepeat = true; - characterSize = 1.f; - accents = 1; // from prefs refresh(res); // initialized later @@ -132,13 +117,16 @@ final class Config float swipe_scaling = Math.min(dm.widthPixels, dm.heightPixels) / 10.f * dpi_ratio; float swipe_dist_value = Float.valueOf(_prefs.getString("swipe_dist", "15")); swipe_dist_px = swipe_dist_value / 25.f * swipe_scaling; - vibrateEnabled = _prefs.getBoolean("vibrate_enabled", vibrateEnabled); - longPressTimeout = _prefs.getInt("longpress_timeout", (int)longPressTimeout); - longPressInterval = _prefs.getInt("longpress_interval", (int)longPressInterval); - marginBottom = getDipPref(dm, _prefs, "margin_bottom", marginBottom); - keyVerticalInterval = getDipPref(dm, _prefs, "key_vertical_space", keyVerticalInterval); + vibrateEnabled = _prefs.getBoolean("vibrate_enabled", true); + longPressTimeout = _prefs.getInt("longpress_timeout", 600); + longPressInterval = _prefs.getInt("longpress_interval", 65); + marginBottom = getDipPref(dm, _prefs, "margin_bottom", + res.getDimension(R.dimen.margin_bottom)); + keyVerticalInterval = getDipPref(dm, _prefs, "key_vertical_space", + res.getDimension(R.dimen.key_vertical_interval)); keyHorizontalInterval = - getDipPref(dm, _prefs, "key_horizontal_space", keyHorizontalInterval) + getDipPref(dm, _prefs, "key_horizontal_space", + res.getDimension(R.dimen.key_horizontal_interval)) * horizontalIntervalScale; // Label brightness is used as the alpha channel labelBrightness = _prefs.getInt("label_brightness", 100) * 255 / 100; @@ -150,12 +138,13 @@ final class Config // during rendered. keyHeight = dm.heightPixels * keyboardHeightPercent / 100 / 4; horizontalMargin = - getDipPref(dm, _prefs, "horizontal_margin", horizontalMargin) + getDipPref(dm, _prefs, "horizontal_margin", + res.getDimension(R.dimen.horizontal_margin)) + res.getDimension(R.dimen.extra_horizontal_margin); - preciseRepeat = _prefs.getBoolean("precise_repeat", preciseRepeat); + preciseRepeat = _prefs.getBoolean("precise_repeat", true); double_tap_lock_shift = _prefs.getBoolean("lock_double_tap", false); characterSize = - _prefs.getFloat("character_size", characterSize) + _prefs.getFloat("character_size", 1.f) * characterSizeScale; accents = Integer.valueOf(_prefs.getString("accents", "1")); theme = getThemeId(res, _prefs.getString("theme", "")); |
