From 9bb2642e2cfa0c46b99bdd7bde8feb158c0d9082 Mon Sep 17 00:00:00 2001 From: Jules Aguillon Date: Sat, 24 Apr 2021 23:22:25 +0200 Subject: Add the label size option --- res/values/strings.xml | 6 ++++-- res/xml/settings.xml | 8 ++++++++ srcs/juloo.keyboard2/Config.java | 3 +++ srcs/juloo.keyboard2/Keyboard2View.java | 2 +- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index fc6860d..9637b57 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -9,6 +9,8 @@ %s QWERTY Layout + Toggle accent keys + Whether to remove the accent keys from the keyboard Typing Precision @@ -33,6 +35,6 @@ %sdp Horizontal margin %sdp - Toggle accent keys - Whether to remove the accent keys from the keyboard. + Label size + Size of characters displayed on the keyboard (%.2fx) diff --git a/res/xml/settings.xml b/res/xml/settings.xml index ef4e232..d56f029 100644 --- a/res/xml/settings.xml +++ b/res/xml/settings.xml @@ -81,5 +81,13 @@ min="0" max="20" /> + diff --git a/srcs/juloo.keyboard2/Config.java b/srcs/juloo.keyboard2/Config.java index 779e2c5..f2b010a 100644 --- a/srcs/juloo.keyboard2/Config.java +++ b/srcs/juloo.keyboard2/Config.java @@ -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) diff --git a/srcs/juloo.keyboard2/Keyboard2View.java b/srcs/juloo.keyboard2/Keyboard2View.java index 3903b7b..7b3495f 100644 --- a/srcs/juloo.keyboard2/Keyboard2View.java +++ b/srcs/juloo.keyboard2/Keyboard2View.java @@ -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); -- cgit v1.2.3