diff options
| author | RetrogisusDEV | 2024-02-10 06:38:46 -0400 |
|---|---|---|
| committer | GitHub | 2024-02-10 11:38:46 +0100 |
| commit | 93d8af45059e98c40cc19166db497643540b9ac1 (patch) | |
| tree | 72f4c8d6a5e5bc016542194c71a2bdbe1ead237f /srcs/juloo.keyboard2/Keyboard2View.java | |
| parent | f74e5a9f73f9ce48250b41af9c17650ed084cf9d (diff) | |
| download | unexpected-keyboard-93d8af45059e98c40cc19166db497643540b9ac1.tar.gz unexpected-keyboard-93d8af45059e98c40cc19166db497643540b9ac1.zip | |
Custom border settings (#524)
Diffstat (limited to 'srcs/juloo.keyboard2/Keyboard2View.java')
| -rw-r--r-- | srcs/juloo.keyboard2/Keyboard2View.java | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/srcs/juloo.keyboard2/Keyboard2View.java b/srcs/juloo.keyboard2/Keyboard2View.java index 8c9a035..42c93ca 100644 --- a/srcs/juloo.keyboard2/Keyboard2View.java +++ b/srcs/juloo.keyboard2/Keyboard2View.java @@ -343,9 +343,13 @@ public class Keyboard2View extends View boolean isKeyDown) { float r = _theme.keyBorderRadius; - float w = isKeyDown ? _theme.keyBorderWidthActivated : _theme.keyBorderWidth; - float w2 = _theme.keyBorderWidth / 2.f; - _tmpRect.set(x + w2, y + w2, x + keyW - w2, y + keyH - w2); + if (_config.borderConfig) + r = _config.customBorderRadius * _keyWidth; + float w = (_config.borderConfig) ? _config.customBorderLineWidth : _theme.keyBorderWidth; + float padding = w / 2.f; + if (isKeyDown) + w = _theme.keyBorderWidthActivated; + _tmpRect.set(x + padding, y + padding, x + keyW - padding, y + keyH - padding); canvas.drawRoundRect(_tmpRect, r, r, isKeyDown ? _theme.keyDownBgPaint : _theme.keyBgPaint); if (w > 0.f) @@ -353,8 +357,8 @@ public class Keyboard2View extends View _theme.keyBorderPaint.setStrokeWidth(w); float overlap = r - r * 0.85f + w; // sin(45°) drawBorder(canvas, x, y, x + overlap, y + keyH, _theme.keyBorderColorLeft); - drawBorder(canvas, x, y, x + keyW, y + overlap, _theme.keyBorderColorTop); drawBorder(canvas, x + keyW - overlap, y, x + keyW, y + keyH, _theme.keyBorderColorRight); + drawBorder(canvas, x, y, x + keyW, y + overlap, _theme.keyBorderColorTop); drawBorder(canvas, x, y + keyH - overlap, x + keyW, y + keyH, _theme.keyBorderColorBottom); } } @@ -366,6 +370,8 @@ public class Keyboard2View extends View { Paint p = _theme.keyBorderPaint; float r = _theme.keyBorderRadius; + if (_config.borderConfig) + r = _config.customBorderRadius * _keyWidth; canvas.save(); canvas.clipRect(clipl, clipt, clipr, clipb); p.setColor(color); |
