abouttreesummaryrefslogcommitdiff
path: root/srcs
diff options
context:
space:
mode:
authorJules Aguillon2022-06-24 22:00:23 +0200
committerJules Aguillon2022-06-24 22:00:23 +0200
commitff01678ba688778d67f824a0be56634974c1b0e8 (patch)
treea6878b95181c826daa515d8481d375a116b628ff /srcs
parentd74e8f3b0877570964715ff3d75435b5276cb69d (diff)
downloadunexpected-keyboard-ff01678ba688778d67f824a0be56634974c1b0e8.tar.gz
unexpected-keyboard-ff01678ba688778d67f824a0be56634974c1b0e8.zip
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.
Diffstat (limited to 'srcs')
-rw-r--r--srcs/juloo.keyboard2/Config.java3
-rw-r--r--srcs/juloo.keyboard2/Keyboard2View.java2
2 files changed, 5 insertions, 0 deletions
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,