forked from extern/Unexpected-Keyboard
Add a setting for precise repeat
This commit is contained in:
parent
83b3212d3d
commit
5dec9c1215
@ -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>
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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)));
|
||||
|
Loading…
Reference in New Issue
Block a user