mirror of
https://github.com/Julow/Unexpected-Keyboard.git
synced 2025-01-24 14:28:49 +01:00
Fix inconsistent text size in landscape mode
Dimens weren't refreshed when the orientation changed. Dimens are not the right solution anyway, use scaling factors instead.
This commit is contained in:
parent
b236a74b64
commit
e0131fa6b0
@ -1,11 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="horizontal_margin">12dp</dimen>
|
||||
<dimen name="margin_bottom">3dp</dimen>
|
||||
<dimen name="key_padding">3dp</dimen>
|
||||
<dimen name="key_height">36dp</dimen>
|
||||
<item name="label_text_size" type="integer" format="float">0.4</item>
|
||||
<item name="sublabel_text_size" type="integer" format="float">0.3</item>
|
||||
<dimen name="emoji_type_button_height">48dp</dimen>
|
||||
<dimen name="extra_horizontal_margin">25dp</dimen>
|
||||
</resources>
|
||||
|
@ -7,8 +7,6 @@
|
||||
<dimen name="key_vertical_interval">2dp</dimen>
|
||||
<dimen name="key_horizontal_interval">2dp</dimen>
|
||||
<dimen name="key_height">51dp</dimen>
|
||||
<item name="label_text_size" type="integer" format="float">0.33</item>
|
||||
<item name="sublabel_text_size" type="integer" format="float">0.22</item>
|
||||
<dimen name="emoji_type_button_height">56dp</dimen>
|
||||
<dimen name="emoji_grid_height">250dp</dimen>
|
||||
<dimen name="emoji_text_size">28dp</dimen>
|
||||
|
@ -57,8 +57,8 @@ final class Config
|
||||
// static values
|
||||
marginTop = res.getDimension(R.dimen.margin_top);
|
||||
keyPadding = res.getDimension(R.dimen.key_padding);
|
||||
labelTextSize = Float.valueOf(res.getString(R.integer.label_text_size));
|
||||
sublabelTextSize = Float.valueOf(res.getString(R.integer.sublabel_text_size));
|
||||
labelTextSize = 0.33f;
|
||||
sublabelTextSize = 0.22f;
|
||||
// default values
|
||||
layout = -1;
|
||||
programming_layout = -1;
|
||||
@ -97,12 +97,14 @@ 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
|
||||
// Scale some dimensions depending on orientation
|
||||
float horizontalIntervalScale = 1.f;
|
||||
float characterSizeScale = 1.f;
|
||||
if (res.getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) // Landscape mode
|
||||
{
|
||||
keyboardHeightPercent = prefs.getInt("keyboard_height_landscape", 50);
|
||||
horizontalIntervalScale = 2.f;
|
||||
characterSizeScale = 1.25f;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -142,7 +144,9 @@ final class Config
|
||||
if (prefs.getBoolean("lockable_sup", false)) lockable_modifiers.add(KeyValue.Modifier.SUPERSCRIPT);
|
||||
if (prefs.getBoolean("lockable_sub", false)) lockable_modifiers.add(KeyValue.Modifier.SUBSCRIPT);
|
||||
if (prefs.getBoolean("lockable_box", false)) lockable_modifiers.add(KeyValue.Modifier.BOX);
|
||||
characterSize = prefs.getFloat("character_size", characterSize);
|
||||
characterSize =
|
||||
prefs.getFloat("character_size", characterSize)
|
||||
* characterSizeScale;
|
||||
accents = Integer.valueOf(prefs.getString("accents", "1"));
|
||||
theme = getThemeId(res, prefs.getString("theme", ""));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user