From ff01678ba688778d67f824a0be56634974c1b0e8 Mon Sep 17 00:00:00 2001 From: Jules Aguillon Date: Fri, 24 Jun 2022 22:00:23 +0200 Subject: [PATCH] Revert "Remove the vibration settings" Bring back the "Vibration" option. The duration option isn't added back because the vibration settings are still handled by Android. In fact, the option has no effect if the vibration are disabled in the system settings. This partially reverts commit ef03dfed5c802a855c4655204eee39a8769cfed7. --- res/values-de/strings.xml | 2 ++ res/values-es/strings.xml | 2 ++ res/values-fr/strings.xml | 2 ++ res/values-ko/strings.xml | 2 ++ res/values-lv/strings.xml | 2 ++ res/values-pt/strings.xml | 2 ++ res/values-tr/strings.xml | 2 ++ res/values-zh-rCN/strings.xml | 2 ++ res/values/strings.xml | 2 ++ res/xml/settings.xml | 1 + srcs/juloo.keyboard2/Config.java | 3 +++ srcs/juloo.keyboard2/Keyboard2View.java | 2 ++ 12 files changed, 24 insertions(+) diff --git a/res/values-de/strings.xml b/res/values-de/strings.xml index 585fd5a..4727f36 100644 --- a/res/values-de/strings.xml +++ b/res/values-de/strings.xml @@ -15,6 +15,8 @@ Abstand der Zeichen in den Ecken der Tasten (%s) Zeitüberschreitung bei Tastenwiederholung Intervall der Tastenwiederholung + Vibration + Vibration bei Tastendruck ein-/ausschalten Präzise Cursorsteuerung Geschwindigkeit der Tastenwiederholung durch weniger oder mehr Wischen anpassen Sperrbare Hilfstasten diff --git a/res/values-es/strings.xml b/res/values-es/strings.xml index 2688b64..0a8a9ec 100644 --- a/res/values-es/strings.xml +++ b/res/values-es/strings.xml @@ -13,6 +13,8 @@ Distancia de caracteres en las esquinas de las letras (%s) Tiempo de espera de repetición de tecla Intervalo de repetición de tecla + Vibración + Habilitar/deshabilitar vibración al presionar una tecla Movimientos de cursor preciso Modular la velocidad de repetición de teclas según si se desliza más o menos Bloqueo de teclas modificadoras diff --git a/res/values-fr/strings.xml b/res/values-fr/strings.xml index 02ff1ff..ea8b4e7 100644 --- a/res/values-fr/strings.xml +++ b/res/values-fr/strings.xml @@ -13,6 +13,8 @@ La distance des caractères dans les coins (%s) Délai avant répétition Écart entre répétitions + Vibreur + Vibration a chaque touche Mouvement précis du curseur Modifier la vitesse de répétition en bougeant le doigt Style diff --git a/res/values-ko/strings.xml b/res/values-ko/strings.xml index 41058d1..22262de 100644 --- a/res/values-ko/strings.xml +++ b/res/values-ko/strings.xml @@ -13,6 +13,8 @@ 키 모서리 문자의 입력 범위 (%s) 키 길게 누르기 지연 키 반복 간격 + 진동 + 키 누를 때 진동 키거/끄기 정확한 커서 움직임 더 많거나 적은 스와이프로 키 반복 조절 스타일 diff --git a/res/values-lv/strings.xml b/res/values-lv/strings.xml index 275a4dc..8239296 100644 --- a/res/values-lv/strings.xml +++ b/res/values-lv/strings.xml @@ -17,6 +17,8 @@ Taustiņu stūros esošo rakstzīmju attālums (%s) Taustiņa atkārtošanās ātrums Taustiņa atkārtošanās aizture + Trīcēšana + Iespējot/atspējot taustiņa piespiešanas trīcēšanu Pielāgojama kursora kustība Mainīt taustiņa atkārtošanās ātrumu ar pavilkšanas attālumu Slēdzami pārveidotājtaustiņi diff --git a/res/values-pt/strings.xml b/res/values-pt/strings.xml index e3dbd4e..5b842ae 100644 --- a/res/values-pt/strings.xml +++ b/res/values-pt/strings.xml @@ -17,6 +17,8 @@ Distância até acionar os cantos das teclas (%s) Tempo até repetir tecla Intervalo de repetição de tecla + Vibração + Ativar/desativar vibração ao digitar Precisão nos movimentos do cursor Varia a velocidade de repetição a depender do quanto deslizar Teclas traváveis diff --git a/res/values-tr/strings.xml b/res/values-tr/strings.xml index 8cffb2a..ddfe064 100644 --- a/res/values-tr/strings.xml +++ b/res/values-tr/strings.xml @@ -17,6 +17,8 @@ Tuşların köşelerindeki karakterlerin uzaklıkları (%s) Tuş tekrarlama beklemesi Tuş tekrarlama aralığı + Titreşim + Tuşa basıldığında titreşimi etkinleştir İmleç hareketini ayarla Tuş tekrar hızını az ya da çok kaydırarak ayarla Sabitlenebilir değiştiriciler diff --git a/res/values-zh-rCN/strings.xml b/res/values-zh-rCN/strings.xml index eb0cf48..db06828 100644 --- a/res/values-zh-rCN/strings.xml +++ b/res/values-zh-rCN/strings.xml @@ -15,6 +15,8 @@ 输入按键四角的符号需要滑动的距离 (%s) 长按到开始重复输入的时间 长按后每次重复输入的时间间隔 + 振动 + 启用或者禁用按下按键时振动 精确控制光标移速 按键重复按下速度由手指滑动的距离决定 组合键锁定 diff --git a/res/values/strings.xml b/res/values/strings.xml index 58292a6..88aefef 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -17,6 +17,8 @@ Distance of characters in the corners of the keys (%s) Key repeat timeout Key repeat interval + Vibration + Enable/disable vibration on keypress Precise cursor movements Modulate key repeat speed by swiping more or less Lockable modifiers diff --git a/res/xml/settings.xml b/res/xml/settings.xml index 3293f91..7a09aef 100644 --- a/res/xml/settings.xml +++ b/res/xml/settings.xml @@ -20,6 +20,7 @@ + diff --git a/srcs/juloo.keyboard2/Config.java b/srcs/juloo.keyboard2/Config.java index e02868a..2b900f6 100644 --- a/srcs/juloo.keyboard2/Config.java +++ b/srcs/juloo.keyboard2/Config.java @@ -26,6 +26,7 @@ final class Config public int layout; // Or '-1' for the system defaults public int programming_layout; // Or '-1' for none public float swipe_dist_px; + public boolean vibrateEnabled; public long longPressTimeout; public long longPressInterval; public float marginBottom; @@ -60,6 +61,7 @@ final class Config // default values layout = -1; programming_layout = -1; + vibrateEnabled = true; longPressTimeout = 600; longPressInterval = 65; marginBottom = res.getDimension(R.dimen.margin_bottom); @@ -115,6 +117,7 @@ final class Config // Take the mean of both dimensions as an approximation of the diagonal. float physical_scaling = (dm.widthPixels + dm.heightPixels) / (dm.xdpi + dm.ydpi); swipe_dist_px = Float.valueOf(prefs.getString("swipe_dist", "15")) * physical_scaling;; + vibrateEnabled = prefs.getBoolean("vibrate_enabled", vibrateEnabled); longPressTimeout = prefs.getInt("longpress_timeout", (int)longPressTimeout); longPressInterval = prefs.getInt("longpress_interval", (int)longPressInterval); marginBottom = getDipPref(dm, prefs, "margin_bottom", marginBottom); diff --git a/srcs/juloo.keyboard2/Keyboard2View.java b/srcs/juloo.keyboard2/Keyboard2View.java index 25edd00..fed2be6 100644 --- a/srcs/juloo.keyboard2/Keyboard2View.java +++ b/srcs/juloo.keyboard2/Keyboard2View.java @@ -185,6 +185,8 @@ public class Keyboard2View extends View private void vibrate() { + if (!_config.vibrateEnabled) + return ; if (VERSION.SDK_INT >= 5) { performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY,