Add the label size option

This commit is contained in:
Jules Aguillon 2021-04-24 23:22:25 +02:00
parent 2dbb3dc28f
commit 9bb2642e2c
4 changed files with 16 additions and 3 deletions

View File

@ -9,6 +9,8 @@
<string name="subtype_label_qwerty">%s QWERTY</string>
<string name="pref_category_layout">Layout</string>
<string name="pref_disable_accent_keys_title">Toggle accent keys</string>
<string name="pref_disable_accent_keys_summary">Whether to remove the accent keys from the keyboard</string>
<string name="pref_category_typing">Typing</string>
<string name="pref_preci_title">Precision</string>
@ -33,6 +35,6 @@
<string name="pref_key_height_summary">%sdp</string>
<string name="pref_horizontal_margin_title">Horizontal margin</string>
<string name="pref_horizontal_margin_summary">%sdp</string>
<string name="pref_disable_accent_keys_title">Toggle accent keys</string>
<string name="pref_disable_accent_keys_summary">Whether to remove the accent keys from the keyboard.</string>
<string name="pref_character_size_title">Label size</string>
<string name="pref_character_size_summary">Size of characters displayed on the keyboard (%.2fx)</string>
</resources>

View File

@ -81,5 +81,13 @@
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"
/>
</PreferenceCategory>
</PreferenceScreen>

View File

@ -24,6 +24,7 @@ class Config
public float horizontalMargin;
public boolean disableAccentKeys;
public boolean preciseRepeat;
public float characterSize; // Ratio
public boolean shouldOfferSwitchingToNextInputMethod;
@ -48,6 +49,7 @@ class Config
horizontalMargin = res.getDimension(R.dimen.horizontal_margin);
disableAccentKeys = false;
preciseRepeat = true;
characterSize = 1.f;
// from prefs
refresh();
// initialized later
@ -71,6 +73,7 @@ class Config
horizontalMargin = getDipPref(prefs, "horizontal_margin", horizontalMargin);
disableAccentKeys = prefs.getBoolean("disable_accent_keys", disableAccentKeys);
preciseRepeat = prefs.getBoolean("precise_repeat", preciseRepeat);
characterSize = prefs.getFloat("character_size", characterSize);
}
private float getDipPref(SharedPreferences prefs, String pref_name, float def)

View File

@ -78,7 +78,7 @@ public class Keyboard2View extends View
{
Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
paint.setTextAlign(align);
paint.setTextSize(getResources().getDimension(size));
paint.setTextSize(getResources().getDimension(size) * _config.characterSize);
if (font != null)
paint.setTypeface(font);
return (paint);