forked from extern/Unexpected-Keyboard
Add options for the spacing between the keys
Two options: vertical and horizontal.
This commit is contained in:
parent
8631dfb723
commit
2d2f0dd51d
@ -37,6 +37,8 @@
|
||||
<string name="pref_swipe_dist_e_default">Normale</string>
|
||||
<string name="pref_swipe_dist_e_far">Longue</string>
|
||||
<string name="pref_swipe_dist_e_very_far">Très longue</string>
|
||||
<string name="pref_key_horizontal_space">Espacement horizontal entre les touches</string>
|
||||
<string name="pref_key_vertical_space">Espacement vertical entre les touches</string>
|
||||
<string name="key_action_next">Suiv.</string>
|
||||
<string name="key_action_done">Fin</string>
|
||||
<string name="key_action_go">Aller</string>
|
||||
|
@ -37,6 +37,8 @@
|
||||
<string name="pref_swipe_dist_e_default">Normal</string>
|
||||
<string name="pref_swipe_dist_e_far">Far</string>
|
||||
<string name="pref_swipe_dist_e_very_far">Very far</string>
|
||||
<string name="pref_key_horizontal_space">Horizontal spacing between the keys</string>
|
||||
<string name="pref_key_vertical_space">Vertical spacing between the keys</string>
|
||||
<string name="key_action_next">Next</string>
|
||||
<string name="key_action_done">Done</string>
|
||||
<string name="key_action_go">Go</string>
|
||||
|
@ -20,5 +20,7 @@
|
||||
<juloo.common.IntSlideBarPreference android:key="key_height" android:title="@string/pref_key_height_title" android:summary="%sdp" android:defaultValue="50" min="30" max="90"/>
|
||||
<juloo.common.IntSlideBarPreference android:key="horizontal_margin" android:title="@string/pref_horizontal_margin_title" android:summary="%sdp" android:defaultValue="3" min="0" max="20"/>
|
||||
<juloo.common.SlideBarPreference android:key="character_size" android:title="@string/pref_character_size_title" android:summary="@string/pref_character_size_summary" android:defaultValue="1.0" min="0.8" max="1.2"/>
|
||||
<juloo.common.SlideBarPreference android:key="key_vertical_space" android:title="@string/pref_key_vertical_space" android:summary="%sdp" android:defaultValue="2.0" min="0.5" max="6.0"/>
|
||||
<juloo.common.SlideBarPreference android:key="key_horizontal_space" android:title="@string/pref_key_horizontal_space" android:summary="%sdp" android:defaultValue="2.0" min="0.5" max="6.0"/>
|
||||
</PreferenceCategory>
|
||||
</PreferenceScreen>
|
||||
|
@ -14,8 +14,6 @@ final class Config
|
||||
// From resources
|
||||
public final float marginTop;
|
||||
public final float keyPadding;
|
||||
public final float keyVerticalInterval;
|
||||
public final float keyHorizontalInterval;
|
||||
|
||||
// From preferences
|
||||
public int layout; // Or '-1' for the system defaults
|
||||
@ -28,6 +26,8 @@ final class Config
|
||||
public float marginBottom;
|
||||
public float keyHeight;
|
||||
public float horizontalMargin;
|
||||
public float keyVerticalInterval;
|
||||
public float keyHorizontalInterval;
|
||||
public boolean preciseRepeat;
|
||||
public float characterSize; // Ratio
|
||||
public int accents; // Values are R.values.pref_accents_v_*
|
||||
@ -48,8 +48,6 @@ final class Config
|
||||
// static values
|
||||
marginTop = res.getDimension(R.dimen.margin_top);
|
||||
keyPadding = res.getDimension(R.dimen.key_padding);
|
||||
keyVerticalInterval = res.getDimension(R.dimen.key_vertical_interval);
|
||||
keyHorizontalInterval = res.getDimension(R.dimen.key_horizontal_interval);
|
||||
// default values
|
||||
layout = -1;
|
||||
vibrateEnabled = true;
|
||||
@ -59,6 +57,8 @@ final class Config
|
||||
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;
|
||||
@ -89,6 +89,8 @@ final class Config
|
||||
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);
|
||||
keyHorizontalInterval = getDipPref(dm, prefs, "key_horizontal_space", keyHorizontalInterval);
|
||||
// Add keyVerticalInterval to keyHeight because the space between the keys
|
||||
// is removed from the keys during rendering
|
||||
keyHeight = getDipPref(dm, prefs, "key_height", keyHeight) + keyVerticalInterval;
|
||||
@ -101,8 +103,10 @@ final class Config
|
||||
|
||||
private float getDipPref(DisplayMetrics dm, SharedPreferences prefs, String pref_name, float def)
|
||||
{
|
||||
int value = prefs.getInt(pref_name, -1);
|
||||
if (value < 0)
|
||||
float value;
|
||||
try { value = prefs.getInt(pref_name, -1); }
|
||||
catch (Exception e) { value = prefs.getFloat(pref_name, -1f); }
|
||||
if (value < 0f)
|
||||
return (def);
|
||||
return (TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, value, dm));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user