Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Setting Customize for keys And New Functions #524

Merged
merged 31 commits into from
Feb 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
97f9429
Add New Style App For Api 21+
RetrogisusDEV Jan 17, 2024
c673eff
Add Strings for Customize Keys
RetrogisusDEV Jan 17, 2024
e6eb0c2
Add Customize keys to settings.xml
RetrogisusDEV Jan 17, 2024
98567e3
Add New style Theme to LauncherActivity.java
RetrogisusDEV Jan 17, 2024
03cadec
Add new Style Theme to SettingActivity.java
RetrogisusDEV Jan 17, 2024
125ef1a
Add Customize Keys to Config.java
RetrogisusDEV Jan 17, 2024
1e966f8
other change more but in Keyboard2View.java
RetrogisusDEV Jan 17, 2024
c80422d
Add missing pref_corners_radius string
Julow Jan 17, 2024
96a4065
Indent code and add missing import
Julow Jan 17, 2024
cf930f0
Indent xml files
Julow Jan 17, 2024
facf126
Update strings
Julow Jan 17, 2024
a89b1a4
Fix slider preference class name after rebase
Julow Jan 17, 2024
943c378
Update AndroidManifest.xml
RetrogisusDEV Jan 19, 2024
8721b82
Update styles.xml
RetrogisusDEV Jan 19, 2024
5af065d
Update res
RetrogisusDEV Jan 19, 2024
50ced2b
add folder for night theme / res
RetrogisusDEV Jan 19, 2024
010e8d8
add fix name file to values-v21
RetrogisusDEV Jan 19, 2024
8e3f76b
Delete file at bad name res/values-v21/style.xml
RetrogisusDEV Jan 19, 2024
68d5447
updated SettingsActivity.java
RetrogisusDEV Jan 19, 2024
b4170a9
xD SettingsActivity.java
RetrogisusDEV Jan 19, 2024
77f308d
Actualizar LauncherActivity.java
RetrogisusDEV Jan 19, 2024
329f83d
Merge branch 'MAIN' into pr/524
Julow Feb 9, 2024
9ea16f0
Remove unecessary import
Julow Feb 10, 2024
504479c
Rename option title strings to _title
Julow Feb 10, 2024
30ff7f3
Remove unused summaryOff
Julow Feb 10, 2024
4e8667d
Define border radius relative to base key width
Julow Feb 10, 2024
a2f8b51
Fix border width rendering
Julow Feb 10, 2024
e195114
Fix order in which border are drawn
Julow Feb 10, 2024
c2b8595
Rename internal names to customBorder*
Julow Feb 10, 2024
462fd40
Remove unecessary change
Julow Feb 10, 2024
5e683bb
Improve strings
Julow Feb 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions res/values-cs/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
3 changes: 3 additions & 0 deletions res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
3 changes: 3 additions & 0 deletions res/values-es/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
3 changes: 3 additions & 0 deletions res/values-fa/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
3 changes: 3 additions & 0 deletions res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
3 changes: 3 additions & 0 deletions res/values-it/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
3 changes: 3 additions & 0 deletions res/values-ko/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
3 changes: 3 additions & 0 deletions res/values-lv/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
3 changes: 3 additions & 0 deletions res/values-pl/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
3 changes: 3 additions & 0 deletions res/values-pt/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
3 changes: 3 additions & 0 deletions res/values-ro/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
3 changes: 3 additions & 0 deletions res/values-ru/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
3 changes: 3 additions & 0 deletions res/values-tr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
3 changes: 3 additions & 0 deletions res/values-uk/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
3 changes: 3 additions & 0 deletions res/values-vi/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
3 changes: 3 additions & 0 deletions res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
3 changes: 3 additions & 0 deletions res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
3 changes: 3 additions & 0 deletions res/xml/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
7 changes: 7 additions & 0 deletions srcs/juloo.keyboard2/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -59,6 +61,7 @@ public final class Config
public boolean autocapitalisation;
public boolean switch_input_immediate;
public boolean pin_entry_enabled;
public boolean borderConfig;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This option might seem like a hack but is a foundation for a future "Custom theme" option. Ideally it would work by creating a Theme object and not by adding conditions in the rendering code. Is anyone interested in working on that?


// Dynamically set
public boolean shouldOfferVoiceTyping;
Expand Down Expand Up @@ -144,6 +147,10 @@ public void refresh(Resources res)
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;
Expand Down
14 changes: 10 additions & 4 deletions srcs/juloo.keyboard2/Keyboard2View.java
Original file line number Diff line number Diff line change
Expand Up @@ -343,18 +343,22 @@ void drawKeyFrame(Canvas canvas, float x, float y, float keyW, float keyH,
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)
{
_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);
}
}
Expand All @@ -366,6 +370,8 @@ void drawBorder(Canvas canvas, float clipl, float clipt, float clipr,
{
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);
Expand Down