Custom border settings (#524)

This commit is contained in:
RetrogisusDEV 2024-02-10 06:38:46 -04:00 committed by GitHub
parent f74e5a9f73
commit 93d8af4505
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
20 changed files with 71 additions and 4 deletions

View File

@ -88,6 +88,9 @@ Nezapomeňte... Jako každá virtuální klávesnice, i tato musí být aktivov
<string name="pref_swipe_dist_e_very_far">Velmi dlouhá</string>
<string name="pref_key_horizontal_space">Horizontální mezery mezi klávesami</string>
<string name="pref_key_vertical_space">Vertikální mezery mezi klávesami</string>
<!-- <string name="pref_border_config_title">Customize borders</string> -->
<!-- <string name="pref_border_width_title">Border Width</string> -->
<!-- <string name="pref_corners_radius_title">Corner radius</string> -->
<string name="key_action_next">Další</string>
<string name="key_action_done">Dokončit</string>
<string name="key_action_go">Spustit</string>

View File

@ -76,6 +76,9 @@ Diese App enthält keine Werbung, benötigt keinen Netzwerkzugriff und ist quell
<string name="pref_swipe_dist_e_very_far">Sehr weit</string>
<string name="pref_key_horizontal_space">Horizontaler Abstand zwischen den Tasten</string>
<string name="pref_key_vertical_space">Vertikaler Abstand zwischen den Tasten</string>
<!-- <string name="pref_border_config_title">Customize borders</string> -->
<!-- <string name="pref_border_width_title">Border Width</string> -->
<!-- <string name="pref_corners_radius_title">Corner radius</string> -->
<string name="key_action_next">Nächstes</string>
<string name="key_action_done">Fertig</string>
<string name="key_action_go">Los</string>

View File

@ -76,6 +76,9 @@ La misma no contiene ningún anuncio/publicidad, no realiza peticiones de red y
<string name="pref_swipe_dist_e_very_far">Muy larga</string>
<string name="pref_key_horizontal_space">Espaciado horizontal entre las teclas</string>
<string name="pref_key_vertical_space">Espaciado vertical entre las teclas</string>
<!-- <string name="pref_border_config_title">Customize borders</string> -->
<!-- <string name="pref_border_width_title">Border Width</string> -->
<!-- <string name="pref_corners_radius_title">Corner radius</string> -->
<string name="key_action_next">Siguiente</string>
<string name="key_action_done">Hecho</string>
<string name="key_action_go">Ir</string>

View File

@ -76,6 +76,9 @@ This application contains no ads, doesn't make any network requests and is Open
<string name="pref_swipe_dist_e_very_far">بسیار دور</string>
<string name="pref_key_horizontal_space">فاصله افقی بین کلیدها</string>
<string name="pref_key_vertical_space">فاصله عمودی بین کلیدها</string>
<!-- <string name="pref_border_config_title">Customize borders</string> -->
<!-- <string name="pref_border_width_title">Border Width</string> -->
<!-- <string name="pref_corners_radius_title">Corner radius</string> -->
<string name="key_action_next">بعدی</string>
<string name="key_action_done">اتمام</string>
<string name="key_action_go">برو</string>

View File

@ -76,6 +76,9 @@ Cette application ne contient pas de publicité, n'accède pas au réseau et est
<string name="pref_swipe_dist_e_very_far">Très longue</string>
<string name="pref_key_horizontal_space">Espacement horizontal entre les touches</string>
<string name="pref_key_vertical_space">Espacement vertical entre les touches</string>
<!-- <string name="pref_border_config_title">Customize borders</string> -->
<!-- <string name="pref_border_width_title">Border Width</string> -->
<!-- <string name="pref_corners_radius_title">Corner radius</string> -->
<string name="key_action_next">Suiv.</string>
<string name="key_action_done">Fin</string>
<string name="key_action_go">Aller</string>

View File

@ -76,6 +76,9 @@ This application contains no ads, doesn't make any network requests and is Open
<string name="pref_swipe_dist_e_very_far">Molto distante</string>
<string name="pref_key_horizontal_space">Spazio orizzontale tra i tasti</string>
<string name="pref_key_vertical_space">Spazio verticale tra i tasti</string>
<!-- <string name="pref_border_config_title">Customize borders</string> -->
<!-- <string name="pref_border_width_title">Border Width</string> -->
<!-- <string name="pref_corners_radius_title">Corner radius</string> -->
<string name="key_action_next">Prossimo</string>
<string name="key_action_done">Fatto</string>
<string name="key_action_go">Vai</string>

View File

@ -88,6 +88,9 @@
<string name="pref_swipe_dist_e_very_far">매우 넓음</string>
<string name="pref_key_horizontal_space">키보드 양 옆 간격</string>
<string name="pref_key_vertical_space">키보드 세로 간격</string>
<!-- <string name="pref_border_config_title">Customize borders</string> -->
<!-- <string name="pref_border_width_title">Border Width</string> -->
<!-- <string name="pref_corners_radius_title">Corner radius</string> -->
<string name="key_action_next">다음</string>
<string name="key_action_done">확인</string>
<string name="key_action_go">Go</string>

View File

@ -76,6 +76,9 @@ Tagad lieliski piemērota izmantošanai ikdienā.
<string name="pref_swipe_dist_e_very_far">Ļoti tāls</string>
<string name="pref_key_horizontal_space">Līmeniskais attālums starp taustiņiem</string>
<string name="pref_key_vertical_space">Stateniskais attālums starp taustiņiem</string>
<!-- <string name="pref_border_config_title">Customize borders</string> -->
<!-- <string name="pref_border_width_title">Border Width</string> -->
<!-- <string name="pref_corners_radius_title">Corner radius</string> -->
<string name="key_action_next">Nākamais</string>
<string name="key_action_done">Darīts</string>
<string name="key_action_go">Aiziet</string>

View File

@ -76,6 +76,9 @@ Aplikacja nie zawiera reklam, nie żąda dostępu do internetu, a jej kod źród
<string name="pref_swipe_dist_e_very_far">Bardzo duża</string>
<string name="pref_key_horizontal_space">Odległość pomiędzy klawiszami w poziomie</string>
<string name="pref_key_vertical_space">Odległość pomiędzy klawiszami w pionie</string>
<!-- <string name="pref_border_config_title">Customize borders</string> -->
<!-- <string name="pref_border_width_title">Border Width</string> -->
<!-- <string name="pref_corners_radius_title">Corner radius</string> -->
<string name="key_action_next">Dalej</string>
<string name="key_action_done">OK</string>
<string name="key_action_go">Przejdź</string>

View File

@ -88,6 +88,9 @@ Sistema &gt; Idioma e entrada &gt; Teclado virtual &gt; Gerenciar teclados virtu
<string name="pref_swipe_dist_e_very_far">Bem longo</string>
<string name="pref_key_horizontal_space">Distância horizontal entre teclas</string>
<string name="pref_key_vertical_space">Distância vertical entre teclas</string>
<!-- <string name="pref_border_config_title">Customize borders</string> -->
<!-- <string name="pref_border_width_title">Border Width</string> -->
<!-- <string name="pref_corners_radius_title">Corner radius</string> -->
<string name="key_action_next">Próximo</string>
<string name="key_action_done">Pronto</string>
<string name="key_action_go">Ir</string>

View File

@ -76,6 +76,9 @@ Această aplicație nu conține publicitate, nu folosește rețeaua deloc și e
<string name="pref_swipe_dist_e_very_far">Foarte depărtată</string>
<string name="pref_key_horizontal_space">Distanța orizontală dintre taste</string>
<string name="pref_key_vertical_space">Distanța verticală dintre taste</string>
<!-- <string name="pref_border_config_title">Customize borders</string> -->
<!-- <string name="pref_border_width_title">Border Width</string> -->
<!-- <string name="pref_corners_radius_title">Corner radius</string> -->
<string name="key_action_next">Următor</string>
<string name="key_action_done">Gata</string>
<string name="key_action_go">Go</string>

View File

@ -76,6 +76,9 @@
<string name="pref_swipe_dist_e_very_far">Очень далеко</string>
<string name="pref_key_horizontal_space">Горизонтальное расстояние между клавишами</string>
<string name="pref_key_vertical_space">Расстояние по вертикали между клавишами</string>
<!-- <string name="pref_border_config_title">Customize borders</string> -->
<!-- <string name="pref_border_width_title">Border Width</string> -->
<!-- <string name="pref_corners_radius_title">Corner radius</string> -->
<string name="key_action_next">Далее</string>
<string name="key_action_done">Ввод</string>
<string name="key_action_go">Go</string>

View File

@ -76,6 +76,9 @@ Bu uygulama açık kaynaklıdır. Reklam içermez ve internete bağlanmaz."</str
<string name="pref_swipe_dist_e_very_far">Çok uzun</string>
<string name="pref_key_horizontal_space">Tuşlar arasındaki yatay boşluk</string>
<string name="pref_key_vertical_space">Tuşlar arasındaki dikey boşluk</string>
<!-- <string name="pref_border_config_title">Customize borders</string> -->
<!-- <string name="pref_border_width_title">Border Width</string> -->
<!-- <string name="pref_corners_radius_title">Corner radius</string> -->
<string name="key_action_next">Sonraki</string>
<string name="key_action_done">Tamam</string>
<string name="key_action_go">ileri</string>

View File

@ -76,6 +76,9 @@ This application contains no ads, doesn't make any network requests and is Open
<string name="pref_swipe_dist_e_very_far">Дуже далека</string>
<string name="pref_key_horizontal_space">Горизонтальна відстань між клавішами</string>
<string name="pref_key_vertical_space">Вертикальна відстань між клавішами</string>
<!-- <string name="pref_border_config_title">Customize borders</string> -->
<!-- <string name="pref_border_width_title">Border Width</string> -->
<!-- <string name="pref_corners_radius_title">Corner radius</string> -->
<string name="key_action_next">Далі</string>
<string name="key_action_done">Готово</string>
<string name="key_action_go">Іти</string>

View File

@ -76,6 +76,9 @@ Bây giờ đã hoàn hảo cho việc sử dụng hàng ngày.
<string name="pref_swipe_dist_e_very_far">Rất xa</string>
<string name="pref_key_horizontal_space">Khoảng cách giữa các phím theo chiều ngang</string>
<string name="pref_key_vertical_space">Khoảng cách giữa các phím theo chiều dọc</string>
<!-- <string name="pref_border_config_title">Customize borders</string> -->
<!-- <string name="pref_border_width_title">Border Width</string> -->
<!-- <string name="pref_corners_radius_title">Corner radius</string> -->
<string name="key_action_next">Tiếp</string>
<string name="key_action_done">Xong</string>
<string name="key_action_go">Đi</string>

View File

@ -76,6 +76,9 @@ This application contains no ads, doesn't make any network requests and is Open
<string name="pref_swipe_dist_e_very_far">非常长</string>
<string name="pref_key_horizontal_space">按键的左右边距</string>
<string name="pref_key_vertical_space">按键的上下边距</string>
<!-- <string name="pref_border_config_title">Customize borders</string> -->
<!-- <string name="pref_border_width_title">Border Width</string> -->
<!-- <string name="pref_corners_radius_title">Corner radius</string> -->
<string name="key_action_next">下一项</string>
<string name="key_action_done">完成</string>
<string name="key_action_go">前往</string>

View File

@ -76,6 +76,9 @@ This application contains no ads, doesn't make any network requests and is Open
<string name="pref_swipe_dist_e_very_far">Very far</string>
<string name="pref_key_horizontal_space">Horizontal spacing between the keys</string>
<string name="pref_key_vertical_space">Vertical spacing between the keys</string>
<string name="pref_border_config_title">Customize borders</string>
<string name="pref_border_width_title">Border Width</string>
<string name="pref_corners_radius_title">Corner radius</string>
<string name="key_action_next">Next</string>
<string name="key_action_done">Done</string>
<string name="key_action_go">Go</string>

View File

@ -46,5 +46,8 @@
<juloo.keyboard2.prefs.SlideBarPreference android:key="character_size" android:title="@string/pref_character_size_title" android:summary="@string/pref_character_size_summary" android:defaultValue="1.0" min="0.75" max="1.5"/>
<juloo.keyboard2.prefs.SlideBarPreference android:key="key_vertical_margin" android:title="@string/pref_key_vertical_space" android:summary="%s%%" android:defaultValue="1.5" min="0" max="5"/>
<juloo.keyboard2.prefs.SlideBarPreference android:key="key_horizontal_margin" android:title="@string/pref_key_horizontal_space" android:summary="%s%%" android:defaultValue="2" min="0" max="5"/>
<CheckBoxPreference android:key="border_config" android:title="@string/pref_border_config_title" android:defaultValue="false"/>
<juloo.keyboard2.prefs.IntSlideBarPreference android:key="custom_border_radius" android:title="@string/pref_corners_radius_title" android:summary="%s%%" android:defaultValue="0" min="0" max="100" android:dependency="border_config"/>
<juloo.keyboard2.prefs.SlideBarPreference android:key="custom_border_line_width" android:title="@string/pref_border_width_title" android:summary="%sdp" android:defaultValue="0" min="0" max="5" android:dependency="border_config"/>
</PreferenceCategory>
</PreferenceScreen>

View File

@ -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;

View File

@ -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);