abouttreesummaryrefslogcommitdiff
diff options
context:
space:
mode:
authorJules Aguillon2021-04-20 00:34:21 +0200
committerJules Aguillon2021-04-20 00:34:21 +0200
commit5dec9c12154b6eec752c9fa88fde0b392b78db61 (patch)
tree935141d5d914bd7e9b12127da2762e6d3801def6
parent83b3212d3d880e19ed6298d1182a88207d11be07 (diff)
downloadunexpected-keyboard-5dec9c12154b6eec752c9fa88fde0b392b78db61.tar.gz
unexpected-keyboard-5dec9c12154b6eec752c9fa88fde0b392b78db61.zip
Add a setting for precise repeat
-rw-r--r--res/values/strings.xml2
-rw-r--r--res/xml/settings.xml6
-rw-r--r--srcs/juloo.keyboard2/Config.java3
-rw-r--r--srcs/juloo.keyboard2/Keyboard2View.java2
4 files changed, 12 insertions, 1 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml
index e53b4b6..fc6860d 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -23,6 +23,8 @@
<string name="pref_vibrate_summary">Enable/Disable vibrations on key down</string>
<string name="pref_vibrate_duration_title">Duration</string>
<string name="pref_vibrate_duration_summary">%sms</string>
+ <string name="pref_precise_repeat_title">Precise cursor movements</string>
+ <string name="pref_precise_repeat_summary">Modulate the speed of movements by swiping more or less</string>
<string name="pref_category_style">Style</string>
<string name="pref_margin_bottom_title">Margin bottom</string>
diff --git a/res/xml/settings.xml b/res/xml/settings.xml
index 8c37179..ef4e232 100644
--- a/res/xml/settings.xml
+++ b/res/xml/settings.xml
@@ -33,6 +33,12 @@
min="5"
max="100"
/>
+ <CheckBoxPreference
+ android:key="precise_repeat"
+ android:title="@string/pref_precise_repeat_title"
+ android:summary="@string/pref_precise_repeat_summary"
+ android:defaultValue="true"
+ />
</PreferenceCategory>
<PreferenceCategory android:title="@string/pref_category_vibrate">
<CheckBoxPreference
diff --git a/srcs/juloo.keyboard2/Config.java b/srcs/juloo.keyboard2/Config.java
index 366cc0c..779e2c5 100644
--- a/srcs/juloo.keyboard2/Config.java
+++ b/srcs/juloo.keyboard2/Config.java
@@ -23,6 +23,7 @@ class Config
public float keyHeight;
public float horizontalMargin;
public boolean disableAccentKeys;
+ public boolean preciseRepeat;
public boolean shouldOfferSwitchingToNextInputMethod;
@@ -46,6 +47,7 @@ class Config
keyHeight = res.getDimension(R.dimen.key_height);
horizontalMargin = res.getDimension(R.dimen.horizontal_margin);
disableAccentKeys = false;
+ preciseRepeat = true;
// from prefs
refresh();
// initialized later
@@ -68,6 +70,7 @@ class Config
keyHeight = getDipPref(prefs, "key_height", keyHeight);
horizontalMargin = getDipPref(prefs, "horizontal_margin", horizontalMargin);
disableAccentKeys = prefs.getBoolean("disable_accent_keys", disableAccentKeys);
+ preciseRepeat = prefs.getBoolean("precise_repeat", preciseRepeat);
}
private float getDipPref(SharedPreferences prefs, String pref_name, float def)
diff --git a/srcs/juloo.keyboard2/Keyboard2View.java b/srcs/juloo.keyboard2/Keyboard2View.java
index e59dd5f..3035d03 100644
--- a/srcs/juloo.keyboard2/Keyboard2View.java
+++ b/srcs/juloo.keyboard2/Keyboard2View.java
@@ -310,7 +310,7 @@ public class Keyboard2View extends View
{
long nextInterval = _config.longPressInterval;
boolean doVibrate = true;
- if ((key.flags & KeyValue.FLAG_PRECISE_REPEAT) != 0)
+ if (_config.preciseRepeat && (key.flags & KeyValue.FLAG_PRECISE_REPEAT) != 0)
{
// Modulate repeat interval depending on the distance of the pointer
float accel = Math.min(4.f, Math.max(0.3f, key.ptrDist / (_config.subValueDist * 15.f)));