Separate option for bottom margin in landscape mode

A large margin in portrait mode is desirable but generally not in
landscape mode.
This commit is contained in:
Jules Aguillon 2023-01-15 19:19:07 +01:00
parent a199962117
commit fd0f0d5476
4 changed files with 9 additions and 5 deletions

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<dimen name="horizontal_margin">28dp</dimen> <dimen name="horizontal_margin">28dp</dimen>
<dimen name="margin_bottom">3dp</dimen>
<dimen name="emoji_type_button_height">48dp</dimen> <dimen name="emoji_type_button_height">48dp</dimen>
</resources> </resources>

View File

@ -57,7 +57,10 @@
<juloo.common.IntSlideBarPreference android:key="keyboard_opacity" android:title="@string/pref_keyboard_opacity" android:summary="%s%%" android:defaultValue="100" min="30" max="100"/> <juloo.common.IntSlideBarPreference android:key="keyboard_opacity" android:title="@string/pref_keyboard_opacity" android:summary="%s%%" android:defaultValue="100" min="30" max="100"/>
<juloo.common.IntSlideBarPreference android:key="key_opacity" android:title="@string/pref_key_opacity" android:summary="%s%%" android:defaultValue="100" min="30" max="100"/> <juloo.common.IntSlideBarPreference android:key="key_opacity" android:title="@string/pref_key_opacity" android:summary="%s%%" android:defaultValue="100" min="30" max="100"/>
<juloo.common.IntSlideBarPreference android:key="key_activated_opacity" android:title="@string/pref_key_activated_opacity" android:summary="%s%%" android:defaultValue="100" min="30" max="100"/> <juloo.common.IntSlideBarPreference android:key="key_activated_opacity" android:title="@string/pref_key_activated_opacity" android:summary="%s%%" android:defaultValue="100" min="30" max="100"/>
<juloo.common.IntSlideBarPreference android:key="margin_bottom" android:title="@string/pref_margin_bottom_title" android:summary="%sdp" android:defaultValue="5" min="0" max="100"/> <PreferenceScreen android:title="@string/pref_margin_bottom_title">
<juloo.common.IntSlideBarPreference android:key="margin_bottom_portrait" android:title="@string/pref_portrait" android:summary="%sdp" android:defaultValue="7" min="0" max="100"/>
<juloo.common.IntSlideBarPreference android:key="margin_bottom_landscape" android:title="@string/pref_landscape" android:summary="%sdp" android:defaultValue="3" min="0" max="100"/>
</PreferenceScreen>
<juloo.common.IntSlideBarPreference android:key="keyboard_height" android:title="@string/pref_keyboard_height_title" android:summary="%s%%" android:defaultValue="35" min="10" max="50"/> <juloo.common.IntSlideBarPreference android:key="keyboard_height" android:title="@string/pref_keyboard_height_title" android:summary="%s%%" android:defaultValue="35" min="10" max="50"/>
<juloo.common.IntSlideBarPreference android:key="keyboard_height_landscape" android:title="@string/pref_keyboard_height_landscape_title" android:summary="%s%%" android:defaultValue="50" min="20" max="65"/> <juloo.common.IntSlideBarPreference android:key="keyboard_height_landscape" android:title="@string/pref_keyboard_height_landscape_title" android:summary="%s%%" android:defaultValue="50" min="20" max="65"/>
<PreferenceScreen android:title="@string/pref_horizontal_margin_title"> <PreferenceScreen android:title="@string/pref_horizontal_margin_title">

View File

@ -32,7 +32,7 @@ final class Config
public boolean vibrateEnabled; public boolean vibrateEnabled;
public long longPressTimeout; public long longPressTimeout;
public long longPressInterval; public long longPressInterval;
public float marginBottom; public float margin_bottom;
public float keyHeight; public float keyHeight;
public float horizontal_margin; public float horizontal_margin;
public float keyVerticalInterval; public float keyVerticalInterval;
@ -122,7 +122,7 @@ final class Config
vibrateEnabled = _prefs.getBoolean("vibrate_enabled", true); vibrateEnabled = _prefs.getBoolean("vibrate_enabled", true);
longPressTimeout = _prefs.getInt("longpress_timeout", 600); longPressTimeout = _prefs.getInt("longpress_timeout", 600);
longPressInterval = _prefs.getInt("longpress_interval", 65); 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)); res.getDimension(R.dimen.margin_bottom));
keyVerticalInterval = get_dip_pref(dm, "key_vertical_space", keyVerticalInterval = get_dip_pref(dm, "key_vertical_space",
res.getDimension(R.dimen.key_vertical_interval)); res.getDimension(R.dimen.key_vertical_interval));

View File

@ -230,7 +230,7 @@ public class Keyboard2View extends View
int height = int height =
(int)(_config.keyHeight * _keyboard.keysHeight (int)(_config.keyHeight * _keyboard.keysHeight
+ _keyboard.rows.size() + _keyboard.rows.size()
+ _config.marginTop + _config.marginBottom); + _config.marginTop + _config.margin_bottom);
setMeasuredDimension(width, height); setMeasuredDimension(width, height);
_keyWidth = (width - (_config.horizontal_margin * 2)) / _keyboard.keysWidth; _keyWidth = (width - (_config.horizontal_margin * 2)) / _keyboard.keysWidth;
} }
@ -247,7 +247,7 @@ public class Keyboard2View extends View
left + (int)_config.horizontal_margin, left + (int)_config.horizontal_margin,
top + (int)_config.marginTop, top + (int)_config.marginTop,
right - (int)_config.horizontal_margin, right - (int)_config.horizontal_margin,
bottom - (int)_config.marginBottom); bottom - (int)_config.margin_bottom);
setSystemGestureExclusionRects(Arrays.asList(keyboard_area)); setSystemGestureExclusionRects(Arrays.asList(keyboard_area));
} }
} }