mirror of
https://github.com/Julow/Unexpected-Keyboard.git
synced 2025-07-15 13:55:41 +02:00
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.
This commit is contained in:
@ -6,7 +6,6 @@
|
|||||||
<dimen name="key_padding">2dp</dimen>
|
<dimen name="key_padding">2dp</dimen>
|
||||||
<dimen name="key_vertical_interval">2dp</dimen>
|
<dimen name="key_vertical_interval">2dp</dimen>
|
||||||
<dimen name="key_horizontal_interval">2dp</dimen>
|
<dimen name="key_horizontal_interval">2dp</dimen>
|
||||||
<dimen name="key_height">51dp</dimen>
|
|
||||||
<dimen name="emoji_type_button_height">56dp</dimen>
|
<dimen name="emoji_type_button_height">56dp</dimen>
|
||||||
<dimen name="emoji_grid_height">250dp</dimen>
|
<dimen name="emoji_grid_height">250dp</dimen>
|
||||||
<dimen name="emoji_text_size">28dp</dimen>
|
<dimen name="emoji_text_size">28dp</dimen>
|
||||||
|
@ -67,21 +67,6 @@ final class Config
|
|||||||
keyPadding = res.getDimension(R.dimen.key_padding);
|
keyPadding = res.getDimension(R.dimen.key_padding);
|
||||||
labelTextSize = 0.33f;
|
labelTextSize = 0.33f;
|
||||||
sublabelTextSize = 0.22f;
|
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
|
// from prefs
|
||||||
refresh(res);
|
refresh(res);
|
||||||
// initialized later
|
// initialized later
|
||||||
@ -132,13 +117,16 @@ final class Config
|
|||||||
float swipe_scaling = Math.min(dm.widthPixels, dm.heightPixels) / 10.f * dpi_ratio;
|
float swipe_scaling = Math.min(dm.widthPixels, dm.heightPixels) / 10.f * dpi_ratio;
|
||||||
float swipe_dist_value = Float.valueOf(_prefs.getString("swipe_dist", "15"));
|
float swipe_dist_value = Float.valueOf(_prefs.getString("swipe_dist", "15"));
|
||||||
swipe_dist_px = swipe_dist_value / 25.f * swipe_scaling;
|
swipe_dist_px = swipe_dist_value / 25.f * swipe_scaling;
|
||||||
vibrateEnabled = _prefs.getBoolean("vibrate_enabled", vibrateEnabled);
|
vibrateEnabled = _prefs.getBoolean("vibrate_enabled", true);
|
||||||
longPressTimeout = _prefs.getInt("longpress_timeout", (int)longPressTimeout);
|
longPressTimeout = _prefs.getInt("longpress_timeout", 600);
|
||||||
longPressInterval = _prefs.getInt("longpress_interval", (int)longPressInterval);
|
longPressInterval = _prefs.getInt("longpress_interval", 65);
|
||||||
marginBottom = getDipPref(dm, _prefs, "margin_bottom", marginBottom);
|
marginBottom = getDipPref(dm, _prefs, "margin_bottom",
|
||||||
keyVerticalInterval = getDipPref(dm, _prefs, "key_vertical_space", keyVerticalInterval);
|
res.getDimension(R.dimen.margin_bottom));
|
||||||
|
keyVerticalInterval = getDipPref(dm, _prefs, "key_vertical_space",
|
||||||
|
res.getDimension(R.dimen.key_vertical_interval));
|
||||||
keyHorizontalInterval =
|
keyHorizontalInterval =
|
||||||
getDipPref(dm, _prefs, "key_horizontal_space", keyHorizontalInterval)
|
getDipPref(dm, _prefs, "key_horizontal_space",
|
||||||
|
res.getDimension(R.dimen.key_horizontal_interval))
|
||||||
* horizontalIntervalScale;
|
* horizontalIntervalScale;
|
||||||
// Label brightness is used as the alpha channel
|
// Label brightness is used as the alpha channel
|
||||||
labelBrightness = _prefs.getInt("label_brightness", 100) * 255 / 100;
|
labelBrightness = _prefs.getInt("label_brightness", 100) * 255 / 100;
|
||||||
@ -150,12 +138,13 @@ final class Config
|
|||||||
// during rendered.
|
// during rendered.
|
||||||
keyHeight = dm.heightPixels * keyboardHeightPercent / 100 / 4;
|
keyHeight = dm.heightPixels * keyboardHeightPercent / 100 / 4;
|
||||||
horizontalMargin =
|
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);
|
+ 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);
|
double_tap_lock_shift = _prefs.getBoolean("lock_double_tap", false);
|
||||||
characterSize =
|
characterSize =
|
||||||
_prefs.getFloat("character_size", characterSize)
|
_prefs.getFloat("character_size", 1.f)
|
||||||
* characterSizeScale;
|
* characterSizeScale;
|
||||||
accents = Integer.valueOf(_prefs.getString("accents", "1"));
|
accents = Integer.valueOf(_prefs.getString("accents", "1"));
|
||||||
theme = getThemeId(res, _prefs.getString("theme", ""));
|
theme = getThemeId(res, _prefs.getString("theme", ""));
|
||||||
|
Reference in New Issue
Block a user