diff options
| author | Jules Aguillon | 2022-11-11 19:15:25 +0100 |
|---|---|---|
| committer | Jules Aguillon | 2022-11-11 19:18:22 +0100 |
| commit | 4d99bd4f4b049d27a02f794b395aac3c56ff7fee (patch) | |
| tree | 3505ceff01c773568a6eda9dc4479946217fba91 /srcs/juloo.keyboard2/Theme.java | |
| parent | d644d2bf0e84beb942142ef8deee143c9e54ce8c (diff) | |
| download | unexpected-keyboard-4d99bd4f4b049d27a02f794b395aac3c56ff7fee.tar.gz unexpected-keyboard-4d99bd4f4b049d27a02f794b395aac3c56ff7fee.zip | |
Dim secondary keys
Reduce the constrast of "secondary" labels. Modifiers (except
diacritics), event and keyevent keys are considered secondary.
Diffstat (limited to 'srcs/juloo.keyboard2/Theme.java')
| -rw-r--r-- | srcs/juloo.keyboard2/Theme.java | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/srcs/juloo.keyboard2/Theme.java b/srcs/juloo.keyboard2/Theme.java index 0adc977..21d21fd 100644 --- a/srcs/juloo.keyboard2/Theme.java +++ b/srcs/juloo.keyboard2/Theme.java @@ -3,6 +3,7 @@ package juloo.keyboard2; import android.content.Context; import android.content.res.Resources; import android.content.res.TypedArray; +import android.graphics.Color; import android.graphics.Paint; import android.graphics.Typeface; import android.util.AttributeSet; @@ -15,6 +16,7 @@ public class Theme public final int activatedColor; public final int labelColor; public final int subLabelColor; + public final int secondaryLabelColor; public final float keyBorderRadius; @@ -39,6 +41,8 @@ public class Theme activatedColor = s.getColor(R.styleable.keyboard_colorLabelActivated, 0); lockedColor = s.getColor(R.styleable.keyboard_colorLabelLocked, 0); subLabelColor = s.getColor(R.styleable.keyboard_colorSubLabel, 0); + float secondaryLightOffset = s.getFloat(R.styleable.keyboard_secondaryLightOffset, 1.f); + secondaryLabelColor = adjustLight(labelColor, secondaryLightOffset); keyBorderRadius = s.getDimension(R.styleable.keyboard_keyBorderRadius, 0); s.recycle(); _keyLabelPaint = initLabelPaint(Paint.Align.CENTER, null); @@ -67,7 +71,15 @@ public class Theme return _indicationPaint; } - private Paint initLabelPaint(Paint.Align align, Typeface font) + int adjustLight(int color, float offset) + { + float[] hsv = new float[3]; + Color.colorToHSV(color, hsv); + hsv[2] += offset; + return Color.HSVToColor(hsv); + } + + Paint initLabelPaint(Paint.Align align, Typeface font) { Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG); paint.setTextAlign(align); @@ -76,7 +88,7 @@ public class Theme return (paint); } - private static Typeface _key_font = null; + static Typeface _key_font = null; static public Typeface getKeyFont(Context context) { |
