abouttreesummaryrefslogcommitdiff
path: root/srcs/juloo.keyboard2
diff options
context:
space:
mode:
Diffstat (limited to 'srcs/juloo.keyboard2')
-rw-r--r--srcs/juloo.keyboard2/Config.java7
-rw-r--r--srcs/juloo.keyboard2/Keyboard2View.java14
2 files changed, 17 insertions, 4 deletions
diff --git a/srcs/juloo.keyboard2/Config.java b/srcs/juloo.keyboard2/Config.java
index d41e6fc..3b050b0 100644
--- a/srcs/juloo.keyboard2/Config.java
+++ b/srcs/juloo.keyboard2/Config.java
@@ -51,6 +51,8 @@ public final class Config
public float key_horizontal_margin;
public int labelBrightness; // 0 - 255
public int keyboardOpacity; // 0 - 255
+ public float customBorderRadius; // 0 - 1
+ public float customBorderLineWidth; // dp
public int keyOpacity; // 0 - 255
public int keyActivatedOpacity; // 0 - 255
public boolean double_tap_lock_shift;
@@ -59,6 +61,7 @@ public final class Config
public boolean autocapitalisation;
public boolean switch_input_immediate;
public boolean pin_entry_enabled;
+ public boolean borderConfig;
// Dynamically set
public boolean shouldOfferVoiceTyping;
@@ -144,6 +147,10 @@ public final class Config
keyboardOpacity = _prefs.getInt("keyboard_opacity", 100) * 255 / 100;
keyOpacity = _prefs.getInt("key_opacity", 100) * 255 / 100;
keyActivatedOpacity = _prefs.getInt("key_activated_opacity", 100) * 255 / 100;
+ // keyboard border settings
+ borderConfig = _prefs.getBoolean("border_config", false);
+ customBorderRadius = _prefs.getInt("custom_border_radius", 0) / 100.f;
+ customBorderLineWidth = get_dip_pref(dm, "custom_border_line_width", 0);
// Do not substract key_vertical_margin from keyHeight because this is done
// during rendering.
keyHeight = dm.heightPixels * keyboardHeightPercent / 100 / 4;
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);