From 93d8af45059e98c40cc19166db497643540b9ac1 Mon Sep 17 00:00:00 2001
From: RetrogisusDEV <99091223+RetrogisusDEV@users.noreply.github.com>
Date: Sat, 10 Feb 2024 06:38:46 -0400
Subject: [PATCH] Custom border settings (#524)
---
res/values-cs/strings.xml | 3 +++
res/values-de/strings.xml | 3 +++
res/values-es/strings.xml | 3 +++
res/values-fa/strings.xml | 3 +++
res/values-fr/strings.xml | 3 +++
res/values-it/strings.xml | 3 +++
res/values-ko/strings.xml | 3 +++
res/values-lv/strings.xml | 3 +++
res/values-pl/strings.xml | 3 +++
res/values-pt/strings.xml | 3 +++
res/values-ro/strings.xml | 3 +++
res/values-ru/strings.xml | 3 +++
res/values-tr/strings.xml | 3 +++
res/values-uk/strings.xml | 3 +++
res/values-vi/strings.xml | 3 +++
res/values-zh-rCN/strings.xml | 3 +++
res/values/strings.xml | 3 +++
res/xml/settings.xml | 3 +++
srcs/juloo.keyboard2/Config.java | 7 +++++++
srcs/juloo.keyboard2/Keyboard2View.java | 14 ++++++++++----
20 files changed, 71 insertions(+), 4 deletions(-)
diff --git a/res/values-cs/strings.xml b/res/values-cs/strings.xml
index 800e36a..0c6f79e 100644
--- a/res/values-cs/strings.xml
+++ b/res/values-cs/strings.xml
@@ -88,6 +88,9 @@ Nezapomeňte... Jako každá virtuální klávesnice, i tato musí být aktivov
Velmi dlouhá
Horizontální mezery mezi klávesami
Vertikální mezery mezi klávesami
+
+
+
Další
Dokončit
Spustit
diff --git a/res/values-de/strings.xml b/res/values-de/strings.xml
index 3a86d88..c5df728 100644
--- a/res/values-de/strings.xml
+++ b/res/values-de/strings.xml
@@ -76,6 +76,9 @@ Diese App enthält keine Werbung, benötigt keinen Netzwerkzugriff und ist quell
Sehr weit
Horizontaler Abstand zwischen den Tasten
Vertikaler Abstand zwischen den Tasten
+
+
+
Nächstes
Fertig
Los
diff --git a/res/values-es/strings.xml b/res/values-es/strings.xml
index f0bd694..c52168c 100644
--- a/res/values-es/strings.xml
+++ b/res/values-es/strings.xml
@@ -76,6 +76,9 @@ La misma no contiene ningún anuncio/publicidad, no realiza peticiones de red y
Muy larga
Espaciado horizontal entre las teclas
Espaciado vertical entre las teclas
+
+
+
Siguiente
Hecho
Ir
diff --git a/res/values-fa/strings.xml b/res/values-fa/strings.xml
index f83a026..d3fdeb2 100644
--- a/res/values-fa/strings.xml
+++ b/res/values-fa/strings.xml
@@ -76,6 +76,9 @@ This application contains no ads, doesn't make any network requests and is Open
بسیار دور
فاصله افقی بین کلیدها
فاصله عمودی بین کلیدها
+
+
+
بعدی
اتمام
برو
diff --git a/res/values-fr/strings.xml b/res/values-fr/strings.xml
index f7315be..82b9e1f 100644
--- a/res/values-fr/strings.xml
+++ b/res/values-fr/strings.xml
@@ -76,6 +76,9 @@ Cette application ne contient pas de publicité, n'accède pas au réseau et est
Très longue
Espacement horizontal entre les touches
Espacement vertical entre les touches
+
+
+
Suiv.
Fin
Aller
diff --git a/res/values-it/strings.xml b/res/values-it/strings.xml
index 127030f..b40b664 100644
--- a/res/values-it/strings.xml
+++ b/res/values-it/strings.xml
@@ -76,6 +76,9 @@ This application contains no ads, doesn't make any network requests and is Open
Molto distante
Spazio orizzontale tra i tasti
Spazio verticale tra i tasti
+
+
+
Prossimo
Fatto
Vai
diff --git a/res/values-ko/strings.xml b/res/values-ko/strings.xml
index a697f68..90d7ce1 100644
--- a/res/values-ko/strings.xml
+++ b/res/values-ko/strings.xml
@@ -88,6 +88,9 @@
매우 넓음
키보드 양 옆 간격
키보드 세로 간격
+
+
+
다음
확인
Go
diff --git a/res/values-lv/strings.xml b/res/values-lv/strings.xml
index fbcf1e7..b874a87 100644
--- a/res/values-lv/strings.xml
+++ b/res/values-lv/strings.xml
@@ -76,6 +76,9 @@ Tagad lieliski piemērota izmantošanai ikdienā.
Ļoti tāls
Līmeniskais attālums starp taustiņiem
Stateniskais attālums starp taustiņiem
+
+
+
Nākamais
Darīts
Aiziet
diff --git a/res/values-pl/strings.xml b/res/values-pl/strings.xml
index f366d42..9c9ceaa 100644
--- a/res/values-pl/strings.xml
+++ b/res/values-pl/strings.xml
@@ -76,6 +76,9 @@ Aplikacja nie zawiera reklam, nie żąda dostępu do internetu, a jej kod źród
Bardzo duża
Odległość pomiędzy klawiszami w poziomie
Odległość pomiędzy klawiszami w pionie
+
+
+
Dalej
OK
Przejdź
diff --git a/res/values-pt/strings.xml b/res/values-pt/strings.xml
index d672152..292e073 100644
--- a/res/values-pt/strings.xml
+++ b/res/values-pt/strings.xml
@@ -88,6 +88,9 @@ Sistema > Idioma e entrada > Teclado virtual > Gerenciar teclados virtu
Bem longo
Distância horizontal entre teclas
Distância vertical entre teclas
+
+
+
Próximo
Pronto
Ir
diff --git a/res/values-ro/strings.xml b/res/values-ro/strings.xml
index 27946e8..a3a9ec7 100644
--- a/res/values-ro/strings.xml
+++ b/res/values-ro/strings.xml
@@ -76,6 +76,9 @@ Această aplicație nu conține publicitate, nu folosește rețeaua deloc și e
Foarte depărtată
Distanța orizontală dintre taste
Distanța verticală dintre taste
+
+
+
Următor
Gata
Go
diff --git a/res/values-ru/strings.xml b/res/values-ru/strings.xml
index 5987aac..f552588 100644
--- a/res/values-ru/strings.xml
+++ b/res/values-ru/strings.xml
@@ -76,6 +76,9 @@
Очень далеко
Горизонтальное расстояние между клавишами
Расстояние по вертикали между клавишами
+
+
+
Далее
Ввод
Go
diff --git a/res/values-tr/strings.xml b/res/values-tr/strings.xml
index 00fa331..3a557cf 100644
--- a/res/values-tr/strings.xml
+++ b/res/values-tr/strings.xml
@@ -76,6 +76,9 @@ Bu uygulama açık kaynaklıdır. Reklam içermez ve internete bağlanmaz."Çok uzun
Tuşlar arasındaki yatay boşluk
Tuşlar arasındaki dikey boşluk
+
+
+
Sonraki
Tamam
ileri
diff --git a/res/values-uk/strings.xml b/res/values-uk/strings.xml
index 69f8999..d2abf34 100644
--- a/res/values-uk/strings.xml
+++ b/res/values-uk/strings.xml
@@ -76,6 +76,9 @@ This application contains no ads, doesn't make any network requests and is Open
Дуже далека
Горизонтальна відстань між клавішами
Вертикальна відстань між клавішами
+
+
+
Далі
Готово
Іти
diff --git a/res/values-vi/strings.xml b/res/values-vi/strings.xml
index 6784e37..b77e43e 100644
--- a/res/values-vi/strings.xml
+++ b/res/values-vi/strings.xml
@@ -76,6 +76,9 @@ Bây giờ đã hoàn hảo cho việc sử dụng hàng ngày.
Rất xa
Khoảng cách giữa các phím theo chiều ngang
Khoảng cách giữa các phím theo chiều dọc
+
+
+
Tiếp
Xong
Đi
diff --git a/res/values-zh-rCN/strings.xml b/res/values-zh-rCN/strings.xml
index 6c1000d..d9a93a6 100644
--- a/res/values-zh-rCN/strings.xml
+++ b/res/values-zh-rCN/strings.xml
@@ -76,6 +76,9 @@ This application contains no ads, doesn't make any network requests and is Open
非常长
按键的左右边距
按键的上下边距
+
+
+
下一项
完成
前往
diff --git a/res/values/strings.xml b/res/values/strings.xml
index adae6e8..313475d 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -76,6 +76,9 @@ This application contains no ads, doesn't make any network requests and is Open
Very far
Horizontal spacing between the keys
Vertical spacing between the keys
+ Customize borders
+ Border Width
+ Corner radius
Next
Done
Go
diff --git a/res/xml/settings.xml b/res/xml/settings.xml
index eedac32..3068f78 100644
--- a/res/xml/settings.xml
+++ b/res/xml/settings.xml
@@ -46,5 +46,8 @@
+
+
+
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);