From 73267d68fb3ba04a5233a605a10969a8a9052961 Mon Sep 17 00:00:00 2001 From: Jules Aguillon Date: Tue, 9 Jan 2024 00:43:28 +0100 Subject: Revert "Remove the vibration settings" This reverts commits ef03dfed5c802a855c4655204eee39a8769cfed7 and ff01678ba688778d67f824a0be56634974c1b0e8. The "vibration duration" slider is bought back. The "vibration enabled" option is replaced by "custom vibration", which switch between the system haptic feedback or the custom vibration. The slider is greyed when "custom vibration" is unchecked and is allowed to have a value of 0 to disable vibrations within the app. The intermediate values "light", "medium" and "strong" are removed and no migration of the setting is made. --- res/values-cs/strings.xml | 9 ++---- res/values-de/strings.xml | 9 ++---- res/values-es/strings.xml | 9 ++---- res/values-fa/strings.xml | 9 ++---- res/values-fr/strings.xml | 9 ++---- res/values-it/strings.xml | 9 ++---- res/values-ko/strings.xml | 9 ++---- res/values-lv/strings.xml | 9 ++---- res/values-pl/strings.xml | 9 ++---- res/values-pt/strings.xml | 9 ++---- res/values-ro/strings.xml | 9 ++---- res/values-ru/strings.xml | 9 ++---- res/values-tr/strings.xml | 9 ++---- res/values-vi/strings.xml | 9 ++---- res/values-zh-rCN/strings.xml | 9 ++---- res/values/arrays.xml | 14 -------- res/values/strings.xml | 9 ++---- res/xml/settings.xml | 3 +- srcs/juloo.keyboard2/Config.java | 9 ++++-- srcs/juloo.keyboard2/Keyboard2View.java | 2 +- srcs/juloo.keyboard2/VibratorCompat.java | 55 +++++++------------------------- 21 files changed, 52 insertions(+), 175 deletions(-) diff --git a/res/values-cs/strings.xml b/res/values-cs/strings.xml index 6e0ec1d..351bfbc 100644 --- a/res/values-cs/strings.xml +++ b/res/values-cs/strings.xml @@ -42,8 +42,8 @@ Stiskne Shift na začátku věty Přepnout na posledně užívanou klávesnici Jak bude klávesa pro přepnutí klávesnice reagovat - Vibrace - Preference intenzity vibrací při stisku klávesy + + Rozvržení zadávání PIN kódu Automaticky při psaní čísel, datumů a telefonních čísel Styl @@ -69,11 +69,6 @@ Velmi dlouhá Horizontální mezery mezi klávesami Vertikální mezery mezi klávesami - Deaktivovány - Dle systému - Silné - Střední - Slabé Další Dokončit Spustit diff --git a/res/values-de/strings.xml b/res/values-de/strings.xml index b454cc6..0d988ab 100644 --- a/res/values-de/strings.xml +++ b/res/values-de/strings.xml @@ -42,8 +42,8 @@ Umschalttaste am Satzanfang aktivieren Sofort zur nächsten Tastatur wechseln Verhalten der Tastaturumschalttaste - Vibration - Vibration bei Tastendruck ein-/ausschalten + + PIN-Eingabe-Layout Für die Nummern-, Datums- und Telefonnummern-Eingabe Design @@ -69,11 +69,6 @@ Sehr weit Horizontaler Abstand zwischen den Tasten Vertikaler Abstand zwischen den Tasten - Deaktiviert - System - Stark - Mittel - Schwach Nächstes Fertig Los diff --git a/res/values-es/strings.xml b/res/values-es/strings.xml index d8b7ea9..077111c 100644 --- a/res/values-es/strings.xml +++ b/res/values-es/strings.xml @@ -42,8 +42,8 @@ Presionar Mayús al principio de una oración Cambiar al último teclado usado Comportamiento de la tecla para cambiar diseño - Vibración - Habilitar/deshabilitar vibración al presionar una tecla + + Diseño de introducción de PIN Para escribir cifras, fechas y números telefónicos Estilo @@ -69,11 +69,6 @@ Muy larga Espaciado horizontal entre las teclas Espaciado vertical entre las teclas - Deshabilitada - Igual al sistema - Fuerte - Media - Suave Siguiente Hecho Ir diff --git a/res/values-fa/strings.xml b/res/values-fa/strings.xml index b8e7b96..78c51b6 100644 --- a/res/values-fa/strings.xml +++ b/res/values-fa/strings.xml @@ -42,8 +42,8 @@ در شروع جملات دگرساز را فشار دهید انتقال به آخرین صفحه کلید استفاده شده رفتار کلید تغییردهنده صفحه کلید - لرزش - فعال/غیرفعال کردن لرزش در زمان فشار دادن کلیدها + + سبک @@ -69,11 +69,6 @@ بسیار دور فاصله افقی بین کلیدها فاصله عمودی بین کلیدها - - - - - بعدی اتمام برو diff --git a/res/values-fr/strings.xml b/res/values-fr/strings.xml index f1bb9c3..1028a8f 100644 --- a/res/values-fr/strings.xml +++ b/res/values-fr/strings.xml @@ -42,8 +42,8 @@ Activer Shift au début des phrases Changer vers le clavier utilisé en dernier Comportement de la touche de changement de clavier - Vibreur - Vibration a chaque touche + + Clavier PIN Lors de la saisie de nombres, de dates et de numéros de téléphone Style @@ -69,11 +69,6 @@ Très longue Espacement horizontal entre les touches Espacement vertical entre les touches - Désactivé - Système - Fort - Moyen - Léger Suiv. Fin Aller diff --git a/res/values-it/strings.xml b/res/values-it/strings.xml index 5ee8ec4..b237254 100644 --- a/res/values-it/strings.xml +++ b/res/values-it/strings.xml @@ -42,8 +42,8 @@ Premi Shift all\'inizio di una frase - Vibrazione - Abilita/Disabilita Vibrazione alla pressione dei tasti + + Stile @@ -69,11 +69,6 @@ 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 5e023b4..9b3f659 100644 --- a/res/values-ko/strings.xml +++ b/res/values-ko/strings.xml @@ -42,8 +42,8 @@ - 진동 - 키 누를 때 진동 키거/끄기 + + 스타일 @@ -69,11 +69,6 @@ 매우 넓음 키보드 양 옆 간격 키보드 세로 간격 - - - - - 다음 확인 Go diff --git a/res/values-lv/strings.xml b/res/values-lv/strings.xml index 4a80a2c..8c3234f 100644 --- a/res/values-lv/strings.xml +++ b/res/values-lv/strings.xml @@ -42,8 +42,8 @@ Piespiest Shift teikuma sākumā Pārslēgties uz pēdējo izmantoto tastatūru Tastatūras pārslēgšanas taustiņa uzvedība - Trīcēšana - Iespējot/atspējot taustiņa piespiešanas trīcēšanu + + Piespraust ievadīšanas izkārtojumu Kad ievada skaitļus, datumus un tālruņa numurus Izskata pielāgojumi @@ -69,11 +69,6 @@ Ļoti tāls Līmeniskais attālums starp taustiņiem Stateniskais attālums starp taustiņiem - Atspējota - Sistēmas - Spēcīga - Vidēja - Vāja Nākamais Darīts Aiziet diff --git a/res/values-pl/strings.xml b/res/values-pl/strings.xml index 27bb10c..5639bc2 100644 --- a/res/values-pl/strings.xml +++ b/res/values-pl/strings.xml @@ -42,8 +42,8 @@ Naciśnij Shift na początku zdania Przełącz na ostatnio używaną klawiaturę Działanie klawisza przełączającego klawiaturę - Wibracje - Wł./wył. wibrację przy naciśnięciu klawisza + + Układ klawiatury PIN Podczas wpisywania liczb, dat i numerów telefonu Styl @@ -69,11 +69,6 @@ Bardzo duża Odległość pomiędzy klawiszami w poziomie Odległość pomiędzy klawiszami w pionie - Wyłączone - Systemowe - Silne - Normalne - Słabe Dalej OK Przejdź diff --git a/res/values-pt/strings.xml b/res/values-pt/strings.xml index d7dd843..c2d2629 100644 --- a/res/values-pt/strings.xml +++ b/res/values-pt/strings.xml @@ -42,8 +42,8 @@ Aciona o shift no início de cada frase Alternar para o último teclado usado Comportamento da tecla de troca de teclado - Vibração - Ativar/desativar vibração ao digitar + + Layout PIN Quando digitando números, datas ou números de telefone Estilo @@ -69,11 +69,6 @@ Muito longo Distância horizontal entre teclas Distância vertical entre teclas - Desabilitado - Sistema - Intenso - Médio - Suave Próximo Pronto Ir diff --git a/res/values-ro/strings.xml b/res/values-ro/strings.xml index a28e65f..6487dc8 100644 --- a/res/values-ro/strings.xml +++ b/res/values-ro/strings.xml @@ -42,8 +42,8 @@ Autoapăsare Shift la începutul fiecărei propoziții Schimbă la ultima tastatură folosită Comportamentul tastei pentru schimbarea tastaturii - Vibrație - Activați/dezactivați vibrația la apăsarea tastelor + + Stil @@ -69,11 +69,6 @@ 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 5b914b8..3ebb217 100644 --- a/res/values-ru/strings.xml +++ b/res/values-ru/strings.xml @@ -42,8 +42,8 @@ Автонажатие Shift в начале каждого предложения Переключаться к последней используемой клавиатуре Поведение клавиши переключения клавиатуры - Вибрация - Включение/выключение вибрации при нажатии клавиши + + Стиль @@ -69,11 +69,6 @@ Очень далеко Горизонтальное расстояние между клавишами Расстояние по вертикали между клавишами - - - - - Далее Ввод Go diff --git a/res/values-tr/strings.xml b/res/values-tr/strings.xml index 9796a04..57f7af4 100644 --- a/res/values-tr/strings.xml +++ b/res/values-tr/strings.xml @@ -42,8 +42,8 @@ Noktadan sonra ve her cümlenin başında büyük harf yapar Son kullanılan klavyeye geç Klavye değistirme tuşunun davranışını belirler - Titreşim - Tuşlara basılınca titremeyi aç/kapat + + NumPad Sayıları, tarihleri ve telefon numaralarını yazarken Tarz @@ -69,11 +69,6 @@ Çok uzun Tuşlar arasındaki yatay boşluk Tuşlar arasındaki dikey boşluk - Aktif değil - Sistem - Şiddetli - Orta - Hafif Sonraki Tamam ileri diff --git a/res/values-vi/strings.xml b/res/values-vi/strings.xml index 4b01bed..800e6ea 100644 --- a/res/values-vi/strings.xml +++ b/res/values-vi/strings.xml @@ -42,8 +42,8 @@ Nhấn Shift ở đầu câu - Sự rung - Bật/tắt rung khi nhấn + + Kiểu cách @@ -69,11 +69,6 @@ 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 df8f65a..fb2f91d 100644 --- a/res/values-zh-rCN/strings.xml +++ b/res/values-zh-rCN/strings.xml @@ -42,8 +42,8 @@ 在句子的开头自动按下Shift 切换到最近使用的键盘 切换键盘按钮的行为 - 振动 - 启用或者禁用按下按键时振动 + + 样式 @@ -69,11 +69,6 @@ 非常长 按键的左右边距 按键的上下边距 - 禁用 - 使用系统振动强度 - - - 下一项 完成 前往 diff --git a/res/values/arrays.xml b/res/values/arrays.xml index 42e1738..04d13f9 100644 --- a/res/values/arrays.xml +++ b/res/values/arrays.xml @@ -54,18 +54,4 @@ 25 35 - - @string/pref_vibration_e_disabled - @string/pref_vibration_e_system - @string/pref_vibration_e_strong - @string/pref_vibration_e_medium - @string/pref_vibration_e_light - - - disabled - system - strong - medium - light - diff --git a/res/values/strings.xml b/res/values/strings.xml index 50ed6b3..a85f374 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -42,8 +42,8 @@ Press Shift at the beginning of a sentence Switch to the last used keyboard Behavior of the keyboard-switching key - Vibration - Enable/disable vibration on keypress + Custom vibration + Vibration intensity Pin entry layout When typing numbers, dates and phone numbers Style @@ -69,11 +69,6 @@ Very far Horizontal spacing between the keys Vertical spacing between the keys - Disabled - System - Strong - Medium - Light Next Done Go diff --git a/res/xml/settings.xml b/res/xml/settings.xml index f6467d6..653a3b0 100644 --- a/res/xml/settings.xml +++ b/res/xml/settings.xml @@ -21,7 +21,8 @@ - + + diff --git a/srcs/juloo.keyboard2/Config.java b/srcs/juloo.keyboard2/Config.java index 1b6a76a..53360de 100644 --- a/srcs/juloo.keyboard2/Config.java +++ b/srcs/juloo.keyboard2/Config.java @@ -35,7 +35,10 @@ final class Config public boolean number_row; public float swipe_dist_px; public float slide_step_px; - public VibratorCompat.VibrationBehavior vibration_behavior; + // Let the system handle vibration when false. + public boolean vibrate_custom; + // Control the vibration if [vibrate_custom] is true. + public long vibrate_duration; public long longPressTimeout; public long longPressInterval; public float margin_bottom; @@ -130,8 +133,8 @@ final class Config float swipe_dist_value = Float.valueOf(_prefs.getString("swipe_dist", "15")); swipe_dist_px = swipe_dist_value / 25.f * swipe_scaling; slide_step_px = swipe_dist_px / 4.f; - vibration_behavior = - VibratorCompat.VibrationBehavior.of_string(_prefs.getString("vibration_behavior", "system")); + vibrate_custom = _prefs.getBoolean("vibrate_custom", false); + vibrate_duration = _prefs.getInt("vibrate_duration", 20); longPressTimeout = _prefs.getInt("longpress_timeout", 600); longPressInterval = _prefs.getInt("longpress_interval", 65); margin_bottom = get_dip_pref_oriented(dm, "margin_bottom", 7, 3); diff --git a/srcs/juloo.keyboard2/Keyboard2View.java b/srcs/juloo.keyboard2/Keyboard2View.java index 3ef9957..205bbae 100644 --- a/srcs/juloo.keyboard2/Keyboard2View.java +++ b/srcs/juloo.keyboard2/Keyboard2View.java @@ -234,7 +234,7 @@ public class Keyboard2View extends View private void vibrate() { - VibratorCompat.vibrate(this, _config.vibration_behavior); + VibratorCompat.vibrate(this, _config); } @Override diff --git a/srcs/juloo.keyboard2/VibratorCompat.java b/srcs/juloo.keyboard2/VibratorCompat.java index 2795c71..4a9debe 100644 --- a/srcs/juloo.keyboard2/VibratorCompat.java +++ b/srcs/juloo.keyboard2/VibratorCompat.java @@ -8,32 +8,24 @@ import android.view.View; public final class VibratorCompat { - public static void vibrate(View v, VibrationBehavior b) + public static void vibrate(View v, Config config) { - switch (b) + if (config.vibrate_custom) { - case DISABLED: - break; - case SYSTEM: - if (VERSION.SDK_INT >= 8) - v.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, - HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING); - break; - case STRONG: - vibrator_vibrate(v, 90); - break; - case MEDIUM: - vibrator_vibrate(v, 45); - break; - case LIGHT: - vibrator_vibrate(v, 20); - break; + if (config.vibrate_duration > 0) + vibrator_vibrate(v, config.vibrate_duration); + } + else + { + if (VERSION.SDK_INT >= 8) + v.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, + HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING); } } /** Use the older [Vibrator] when the newer API is not available or the user wants more control. */ - static void vibrator_vibrate(View v, int duration) + static void vibrator_vibrate(View v, long duration) { try { @@ -53,29 +45,4 @@ public final class VibratorCompat } return vibrator_service; } - - public static enum VibrationBehavior - { - DISABLED, - SYSTEM, - STRONG, - MEDIUM, - LIGHT; - - VibrationBehavior() {} - - /** Defaults [SYSTEM] for unrecognized strings. */ - public static VibrationBehavior of_string(String s) - { - switch (s) - { - case "disabled": return DISABLED; - case "system": return SYSTEM; - case "strong": return STRONG; - case "medium": return MEDIUM; - case "light": return LIGHT; - default: return SYSTEM; - } - } - } } -- cgit v1.2.3