abouttreesummaryrefslogcommitdiff
path: root/srcs/juloo.keyboard2/Theme.java
diff options
context:
space:
mode:
authorJules Aguillon2022-11-13 20:53:06 +0100
committerJules Aguillon2022-11-13 20:53:06 +0100
commit64c7c8ce20e2e49b2bf3ee13da9a3def5a57a7d7 (patch)
tree7f3a7d12d22c3092fd3bad3dd5abb6b156489c66 /srcs/juloo.keyboard2/Theme.java
parentc1751578ef2c30a78561511d1eb37500c945ecae (diff)
downloadunexpected-keyboard-64c7c8ce20e2e49b2bf3ee13da9a3def5a57a7d7.tar.gz
unexpected-keyboard-64c7c8ce20e2e49b2bf3ee13da9a3def5a57a7d7.zip
Draw borders and update themes
Themes can define the color of each borders independently. Every borders must have the same width for now. It's possible to set a different width when the key is activated, thought this is only used to remove borders. The 4 themes are updated to take advantage of borders.
Diffstat (limited to 'srcs/juloo.keyboard2/Theme.java')
-rw-r--r--srcs/juloo.keyboard2/Theme.java17
1 files changed, 16 insertions, 1 deletions
diff --git a/srcs/juloo.keyboard2/Theme.java b/srcs/juloo.keyboard2/Theme.java
index 21d21fd..b5e5b88 100644
--- a/srcs/juloo.keyboard2/Theme.java
+++ b/srcs/juloo.keyboard2/Theme.java
@@ -12,6 +12,7 @@ public class Theme
{
public final Paint keyBgPaint = new Paint();
public final Paint keyDownBgPaint = new Paint();
+ public final Paint keyBorderPaint = new Paint();
public final int lockedColor;
public final int activatedColor;
public final int labelColor;
@@ -19,6 +20,12 @@ public class Theme
public final int secondaryLabelColor;
public final float keyBorderRadius;
+ public final float keyBorderWidth;
+ public final float keyBorderWidthActivated;
+ public final int keyBorderColorLeft;
+ public final int keyBorderColorTop;
+ public final int keyBorderColorRight;
+ public final int keyBorderColorBottom;
public final int colorNavBar;
public final boolean isLightNavBar;
@@ -32,7 +39,8 @@ public class Theme
public Theme(Context context, AttributeSet attrs)
{
TypedArray s = context.getTheme().obtainStyledAttributes(attrs, R.styleable.keyboard, 0, 0);
- keyBgPaint.setColor(s.getColor(R.styleable.keyboard_colorKey, 0));
+ int colorKey = s.getColor(R.styleable.keyboard_colorKey, 0);
+ keyBgPaint.setColor(colorKey);
keyDownBgPaint.setColor(s.getColor(R.styleable.keyboard_colorKeyActivated, 0));
// colorKeyboard = s.getColor(R.styleable.keyboard_colorKeyboard, 0);
colorNavBar = s.getColor(R.styleable.keyboard_navigationBarColor, 0);
@@ -44,6 +52,13 @@ public class Theme
float secondaryLightOffset = s.getFloat(R.styleable.keyboard_secondaryLightOffset, 1.f);
secondaryLabelColor = adjustLight(labelColor, secondaryLightOffset);
keyBorderRadius = s.getDimension(R.styleable.keyboard_keyBorderRadius, 0);
+ keyBorderWidth = s.getDimension(R.styleable.keyboard_keyBorderWidth, 0);
+ keyBorderWidthActivated = s.getDimension(R.styleable.keyboard_keyBorderWidthActivated, 0);
+ keyBorderPaint.setStyle(Paint.Style.STROKE);
+ keyBorderColorLeft = s.getColor(R.styleable.keyboard_keyBorderColorLeft, colorKey);
+ keyBorderColorTop = s.getColor(R.styleable.keyboard_keyBorderColorTop, colorKey);
+ keyBorderColorRight = s.getColor(R.styleable.keyboard_keyBorderColorRight, colorKey);
+ keyBorderColorBottom = s.getColor(R.styleable.keyboard_keyBorderColorBottom, colorKey);
s.recycle();
_keyLabelPaint = initLabelPaint(Paint.Align.CENTER, null);
_keySubLabelPaint = initLabelPaint(Paint.Align.LEFT, null);