Remove the modulated repeat

It allowed to modulate the repeat speed of some keys (arrow, backspace,
delete) by move the finger farther or closer to the key.

In practice, this wasn't pratical and doesn't seem popular. It is
removed in favor of a better mechanism for moving the cursor.
This commit is contained in:
Jules Aguillon 2023-01-22 23:13:30 +01:00
parent f7f4d4d6aa
commit f4032e3be9
17 changed files with 8 additions and 90 deletions

View File

@ -36,8 +36,6 @@
<string name="pref_long_interval_title">Interval opakování znaků</string> <string name="pref_long_interval_title">Interval opakování znaků</string>
<string name="pref_vibrate_title">Vibrace</string> <string name="pref_vibrate_title">Vibrace</string>
<string name="pref_vibrate_summary">Zapnout/Vypnout vibrace při stisku klávesy</string> <string name="pref_vibrate_summary">Zapnout/Vypnout vibrace při stisku klávesy</string>
<string name="pref_precise_repeat_title">Precizní posun kurzoru</string>
<string name="pref_precise_repeat_summary">Zda-li posun prstem ovlivňuje rychlost kurzoru</string>
<string name="pref_lock_double_tap_title">Dvojklik pro aktivaci caps lock(u)</string> <string name="pref_lock_double_tap_title">Dvojklik pro aktivaci caps lock(u)</string>
<string name="pref_lock_double_tap_summary">Dvojklik namísto držení modifikačních kláves po nějakou dobu</string> <string name="pref_lock_double_tap_summary">Dvojklik namísto držení modifikačních kláves po nějakou dobu</string>
<string name="pref_category_style">Styl</string> <string name="pref_category_style">Styl</string>

View File

@ -36,8 +36,6 @@
<string name="pref_long_interval_title">Intervall der Tastenwiederholung</string> <string name="pref_long_interval_title">Intervall der Tastenwiederholung</string>
<string name="pref_vibrate_title">Vibration</string> <string name="pref_vibrate_title">Vibration</string>
<string name="pref_vibrate_summary">Vibration bei Tastendruck ein-/ausschalten</string> <string name="pref_vibrate_summary">Vibration bei Tastendruck ein-/ausschalten</string>
<string name="pref_precise_repeat_title">Präzise Cursorsteuerung</string>
<string name="pref_precise_repeat_summary">Geschwindigkeit der Tastenwiederholung durch weniger oder mehr Wischen anpassen</string>
<string name="pref_lock_double_tap_title">Umschalttaste mit Doppeltippen einrasten</string> <string name="pref_lock_double_tap_title">Umschalttaste mit Doppeltippen einrasten</string>
<string name="pref_lock_double_tap_summary">Anstatt Taste längere Zeit gedrückt zu halten</string> <string name="pref_lock_double_tap_summary">Anstatt Taste längere Zeit gedrückt zu halten</string>
<string name="pref_category_style">Design</string> <string name="pref_category_style">Design</string>

View File

@ -36,8 +36,6 @@
<string name="pref_long_interval_title">Intervalo de repetición de tecla</string> <string name="pref_long_interval_title">Intervalo de repetición de tecla</string>
<string name="pref_vibrate_title">Vibración</string> <string name="pref_vibrate_title">Vibración</string>
<string name="pref_vibrate_summary">Habilitar/deshabilitar vibración al presionar una tecla</string> <string name="pref_vibrate_summary">Habilitar/deshabilitar vibración al presionar una tecla</string>
<string name="pref_precise_repeat_title">Movimientos de cursor preciso</string>
<string name="pref_precise_repeat_summary">Modular la velocidad de repetición de teclas según si se desliza más o menos</string>
<!-- <string name="pref_lock_double_tap_title">Double tap on shift for caps lock</string> --> <!-- <string name="pref_lock_double_tap_title">Double tap on shift for caps lock</string> -->
<!-- <string name="pref_lock_double_tap_summary">You can lock any modifier by holding it</string> --> <!-- <string name="pref_lock_double_tap_summary">You can lock any modifier by holding it</string> -->
<string name="pref_category_style">Estilo</string> <string name="pref_category_style">Estilo</string>

View File

@ -36,8 +36,6 @@
<string name="pref_long_interval_title">Écart entre les répétitions</string> <string name="pref_long_interval_title">Écart entre les répétitions</string>
<string name="pref_vibrate_title">Vibreur</string> <string name="pref_vibrate_title">Vibreur</string>
<string name="pref_vibrate_summary">Vibration a chaque touche</string> <string name="pref_vibrate_summary">Vibration a chaque touche</string>
<string name="pref_precise_repeat_title">Mouvement précis du curseur</string>
<string name="pref_precise_repeat_summary">Modifier la vitesse de répétition en bougeant le doigt</string>
<string name="pref_lock_double_tap_title">Appuyer deux fois pour bloquer la majuscule</string> <string name="pref_lock_double_tap_title">Appuyer deux fois pour bloquer la majuscule</string>
<string name="pref_lock_double_tap_summary">Un appui long bloque la majuscule</string> <string name="pref_lock_double_tap_summary">Un appui long bloque la majuscule</string>
<string name="pref_category_style">Style</string> <string name="pref_category_style">Style</string>

View File

@ -36,8 +36,6 @@
<string name="pref_long_interval_title">Intervallo ripetizione tasto</string> <string name="pref_long_interval_title">Intervallo ripetizione tasto</string>
<string name="pref_vibrate_title">Vibrazione</string> <string name="pref_vibrate_title">Vibrazione</string>
<string name="pref_vibrate_summary">Abilita/Disabilita Vibrazione alla pressione dei tasti</string> <string name="pref_vibrate_summary">Abilita/Disabilita Vibrazione alla pressione dei tasti</string>
<string name="pref_precise_repeat_title">Movimento puntatore preciso</string>
<string name="pref_precise_repeat_summary">Modula la veocità della ripetizione con lo swipe</string>
<string name="pref_lock_double_tap_title">Doppio tocco su Shift per attivare CapsLock</string> <string name="pref_lock_double_tap_title">Doppio tocco su Shift per attivare CapsLock</string>
<string name="pref_lock_double_tap_summary">Invece di premere i modificatori a lungo</string> <string name="pref_lock_double_tap_summary">Invece di premere i modificatori a lungo</string>
<string name="pref_category_style">Stile</string> <string name="pref_category_style">Stile</string>

View File

@ -36,8 +36,6 @@
<string name="pref_long_interval_title">키 반복 간격</string> <string name="pref_long_interval_title">키 반복 간격</string>
<string name="pref_vibrate_title">진동</string> <string name="pref_vibrate_title">진동</string>
<string name="pref_vibrate_summary">키 누를 때 진동 키거/끄기</string> <string name="pref_vibrate_summary">키 누를 때 진동 키거/끄기</string>
<string name="pref_precise_repeat_title">정확한 커서 움직임</string>
<string name="pref_precise_repeat_summary">더 많거나 적은 스와이프로 키 반복 조절</string>
<!-- <string name="pref_lock_double_tap_title">Double tap on shift for caps lock</string> --> <!-- <string name="pref_lock_double_tap_title">Double tap on shift for caps lock</string> -->
<!-- <string name="pref_lock_double_tap_summary">You can lock any modifier by holding it</string> --> <!-- <string name="pref_lock_double_tap_summary">You can lock any modifier by holding it</string> -->
<string name="pref_category_style">스타일</string> <string name="pref_category_style">스타일</string>

View File

@ -36,8 +36,6 @@
<string name="pref_long_interval_title">Taustiņa atkārtošanās aizture</string> <string name="pref_long_interval_title">Taustiņa atkārtošanās aizture</string>
<string name="pref_vibrate_title">Trīcēšana</string> <string name="pref_vibrate_title">Trīcēšana</string>
<string name="pref_vibrate_summary">Iespējot/atspējot taustiņa piespiešanas trīcēšanu</string> <string name="pref_vibrate_summary">Iespējot/atspējot taustiņa piespiešanas trīcēšanu</string>
<string name="pref_precise_repeat_title">Pielāgojama kursora kustība</string>
<string name="pref_precise_repeat_summary">Mainīt taustiņa atkārtošanās ātrumu ar pavilkšanas attālumu</string>
<string name="pref_lock_double_tap_title">Divkāršs piesitiens burtslēgam</string> <string name="pref_lock_double_tap_title">Divkāršs piesitiens burtslēgam</string>
<string name="pref_lock_double_tap_summary">Tā vietā, lai ilstoši piespiestu pārveidotāju</string> <string name="pref_lock_double_tap_summary">Tā vietā, lai ilstoši piespiestu pārveidotāju</string>
<string name="pref_category_style">Izskata pielāgojumi</string> <string name="pref_category_style">Izskata pielāgojumi</string>

View File

@ -36,8 +36,6 @@
<string name="pref_long_interval_title">Czas pomiędzy powtórzeniami</string> <string name="pref_long_interval_title">Czas pomiędzy powtórzeniami</string>
<string name="pref_vibrate_title">Wibracja</string> <string name="pref_vibrate_title">Wibracja</string>
<string name="pref_vibrate_summary">Wł./wył. wibrację przy naciśnięciu klawisza</string> <string name="pref_vibrate_summary">Wł./wył. wibrację przy naciśnięciu klawisza</string>
<string name="pref_precise_repeat_title">Dokładne poruszanie kursorem</string>
<string name="pref_precise_repeat_summary">Reguluj prędkość powtarzania naciśnięć klawisza poprzez przesunięcie dalej lub bliżej</string>
<string name="pref_lock_double_tap_title">Naciśnij Shift podwójnie, aby włączyć caps lock</string> <string name="pref_lock_double_tap_title">Naciśnij Shift podwójnie, aby włączyć caps lock</string>
<string name="pref_lock_double_tap_summary">Możesz zablokować modyfikator poprzez jego długie naciśnięcie</string> <string name="pref_lock_double_tap_summary">Możesz zablokować modyfikator poprzez jego długie naciśnięcie</string>
<string name="pref_category_style">Styl</string> <string name="pref_category_style">Styl</string>

View File

@ -36,8 +36,6 @@
<string name="pref_long_interval_title">Intervalo de repetição de tecla</string> <string name="pref_long_interval_title">Intervalo de repetição de tecla</string>
<string name="pref_vibrate_title">Vibração</string> <string name="pref_vibrate_title">Vibração</string>
<string name="pref_vibrate_summary">Ativar/desativar vibração ao digitar</string> <string name="pref_vibrate_summary">Ativar/desativar vibração ao digitar</string>
<string name="pref_precise_repeat_title">Precisão nos movimentos do cursor</string>
<string name="pref_precise_repeat_summary">Varia a velocidade de repetição a depender do quanto deslizar</string>
<string name="pref_lock_double_tap_title">Tecle duas vezes no shift para caixa alta</string> <string name="pref_lock_double_tap_title">Tecle duas vezes no shift para caixa alta</string>
<string name="pref_lock_double_tap_summary">Ao invés de apertar e segurar por um tempo</string> <string name="pref_lock_double_tap_summary">Ao invés de apertar e segurar por um tempo</string>
<string name="pref_category_style">Estilo</string> <string name="pref_category_style">Estilo</string>

View File

@ -36,8 +36,6 @@
<string name="pref_long_interval_title">Интервал повтора клавиш</string> <string name="pref_long_interval_title">Интервал повтора клавиш</string>
<string name="pref_vibrate_title">Вибрация</string> <string name="pref_vibrate_title">Вибрация</string>
<string name="pref_vibrate_summary">Включение/выключение вибрации при нажатии клавиши</string> <string name="pref_vibrate_summary">Включение/выключение вибрации при нажатии клавиши</string>
<string name="pref_precise_repeat_title">Точные перемещения курсора</string>
<string name="pref_precise_repeat_summary">Изменяйте скорость повтора клавиш, проводя пальцем больше или меньше</string>
<string name="pref_lock_double_tap_title">Двойное нажатие на Shift активирует Caps lock</string> <string name="pref_lock_double_tap_title">Двойное нажатие на Shift активирует Caps lock</string>
<string name="pref_lock_double_tap_summary">Вы можете активировать модификатор, удерживая клавишу</string> <string name="pref_lock_double_tap_summary">Вы можете активировать модификатор, удерживая клавишу</string>
<string name="pref_category_style">Стиль</string> <string name="pref_category_style">Стиль</string>

View File

@ -36,8 +36,6 @@
<string name="pref_long_interval_title">Tuş tekrarlama aralığı</string> <string name="pref_long_interval_title">Tuş tekrarlama aralığı</string>
<string name="pref_vibrate_title">Titreşim</string> <string name="pref_vibrate_title">Titreşim</string>
<string name="pref_vibrate_summary">Tuşa basıldığında titreşimi etkinleştir</string> <string name="pref_vibrate_summary">Tuşa basıldığında titreşimi etkinleştir</string>
<string name="pref_precise_repeat_title">İmleç hareketini ayarla</string>
<string name="pref_precise_repeat_summary">Tuş tekrar hızını az ya da çok kaydırarak ayarla</string>
<!-- <string name="pref_lock_double_tap_title">Double tap on shift for caps lock</string> --> <!-- <string name="pref_lock_double_tap_title">Double tap on shift for caps lock</string> -->
<!-- <string name="pref_lock_double_tap_summary">You can lock any modifier by holding it</string> --> <!-- <string name="pref_lock_double_tap_summary">You can lock any modifier by holding it</string> -->
<string name="pref_category_style">Stil</string> <string name="pref_category_style">Stil</string>

View File

@ -36,8 +36,6 @@
<string name="pref_long_interval_title">长按后每次重复输入的时间间隔</string> <string name="pref_long_interval_title">长按后每次重复输入的时间间隔</string>
<string name="pref_vibrate_title">振动</string> <string name="pref_vibrate_title">振动</string>
<string name="pref_vibrate_summary">启用或者禁用按下按键时振动</string> <string name="pref_vibrate_summary">启用或者禁用按下按键时振动</string>
<string name="pref_precise_repeat_title">精确控制光标移速</string>
<string name="pref_precise_repeat_summary">按键重复按下速度由手指滑动的距离决定</string>
<string name="pref_lock_double_tap_title">双击Shift键锁定大写</string> <string name="pref_lock_double_tap_title">双击Shift键锁定大写</string>
<string name="pref_lock_double_tap_summary">任何时候都可以长按修改键以锁定</string> <string name="pref_lock_double_tap_summary">任何时候都可以长按修改键以锁定</string>
<string name="pref_category_style">样式</string> <string name="pref_category_style">样式</string>

View File

@ -36,8 +36,6 @@
<string name="pref_long_interval_title">Key repeat interval</string> <string name="pref_long_interval_title">Key repeat interval</string>
<string name="pref_vibrate_title">Vibration</string> <string name="pref_vibrate_title">Vibration</string>
<string name="pref_vibrate_summary">Enable/disable vibration on keypress</string> <string name="pref_vibrate_summary">Enable/disable vibration on keypress</string>
<string name="pref_precise_repeat_title">Precise cursor movements</string>
<string name="pref_precise_repeat_summary">Modulate key repeat speed by swiping more or less</string>
<string name="pref_lock_double_tap_title">Double tap on shift for caps lock</string> <string name="pref_lock_double_tap_title">Double tap on shift for caps lock</string>
<string name="pref_lock_double_tap_summary">You can lock any modifier by holding it</string> <string name="pref_lock_double_tap_summary">You can lock any modifier by holding it</string>
<string name="pref_category_style">Style</string> <string name="pref_category_style">Style</string>

View File

@ -47,7 +47,6 @@
<ListPreference android:key="swipe_dist" android:title="@string/pref_swipe_dist_title" android:summary="@string/pref_swipe_dist_summary" android:defaultValue="15" android:entries="@array/pref_swipe_dist_entries" android:entryValues="@array/pref_swipe_dist_values"/> <ListPreference android:key="swipe_dist" android:title="@string/pref_swipe_dist_title" android:summary="@string/pref_swipe_dist_summary" android:defaultValue="15" android:entries="@array/pref_swipe_dist_entries" android:entryValues="@array/pref_swipe_dist_values"/>
<juloo.common.IntSlideBarPreference android:key="longpress_timeout" android:title="@string/pref_long_timeout_title" android:summary="%sms" android:defaultValue="600" min="50" max="2000"/> <juloo.common.IntSlideBarPreference android:key="longpress_timeout" android:title="@string/pref_long_timeout_title" android:summary="%sms" android:defaultValue="600" min="50" max="2000"/>
<juloo.common.IntSlideBarPreference android:key="longpress_interval" android:title="@string/pref_long_interval_title" android:summary="%sms" android:defaultValue="25" min="5" max="100"/> <juloo.common.IntSlideBarPreference android:key="longpress_interval" android:title="@string/pref_long_interval_title" android:summary="%sms" android:defaultValue="25" 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"/>
<CheckBoxPreference android:key="lock_double_tap" android:title="@string/pref_lock_double_tap_title" android:summary="@string/pref_lock_double_tap_summary" android:defaultValue="false"/> <CheckBoxPreference android:key="lock_double_tap" android:title="@string/pref_lock_double_tap_title" android:summary="@string/pref_lock_double_tap_summary" android:defaultValue="false"/>
<CheckBoxPreference android:key="vibrate_enabled" android:title="@string/pref_vibrate_title" android:summary="@string/pref_vibrate_summary" android:defaultValue="true"/> <CheckBoxPreference android:key="vibrate_enabled" android:title="@string/pref_vibrate_title" android:summary="@string/pref_vibrate_summary" android:defaultValue="true"/>
</PreferenceCategory> </PreferenceCategory>

View File

@ -41,7 +41,6 @@ final class Config
public int keyboardOpacity; // 0 - 255 public int keyboardOpacity; // 0 - 255
public int keyOpacity; // 0 - 255 public int keyOpacity; // 0 - 255
public int keyActivatedOpacity; // 0 - 255 public int keyActivatedOpacity; // 0 - 255
public boolean preciseRepeat;
public boolean double_tap_lock_shift; public boolean double_tap_lock_shift;
public float characterSize; // Ratio public float characterSize; // Ratio
public int accents; // Values are R.values.pref_accents_v_* public int accents; // Values are R.values.pref_accents_v_*
@ -142,7 +141,6 @@ final class Config
horizontal_margin = horizontal_margin =
get_dip_pref(dm, oriented_pref("horizontal_margin"), get_dip_pref(dm, oriented_pref("horizontal_margin"),
res.getDimension(R.dimen.horizontal_margin)); res.getDimension(R.dimen.horizontal_margin));
preciseRepeat = _prefs.getBoolean("precise_repeat", true);
double_tap_lock_shift = _prefs.getBoolean("lock_double_tap", false); double_tap_lock_shift = _prefs.getBoolean("lock_double_tap", false);
characterSize = characterSize =
_prefs.getFloat("character_size", 1.f) _prefs.getFloat("character_size", 1.f)

View File

@ -78,7 +78,7 @@ final class KeyValue
public static final int FLAG_LOCK = (1 << 21); public static final int FLAG_LOCK = (1 << 21);
// Special keys are not repeated and don't clear latched modifiers. // Special keys are not repeated and don't clear latched modifiers.
public static final int FLAG_SPECIAL = (1 << 22); public static final int FLAG_SPECIAL = (1 << 22);
public static final int FLAG_PRECISE_REPEAT = (1 << 23); // Free flag: (1 << 23);
// Rendering flags. // Rendering flags.
public static final int FLAG_KEY_FONT = (1 << 24); // special font file public static final int FLAG_KEY_FONT = (1 << 24); // special font file
public static final int FLAG_SMALLER_FONT = (1 << 25); // 25% smaller symbols public static final int FLAG_SMALLER_FONT = (1 << 25); // 25% smaller symbols
@ -328,10 +328,10 @@ final class KeyValue
addKeyeventKey("esc", "Esc", KeyEvent.KEYCODE_ESCAPE, FLAG_SMALLER_FONT); addKeyeventKey("esc", "Esc", KeyEvent.KEYCODE_ESCAPE, FLAG_SMALLER_FONT);
addKeyeventKey("enter", 0x0E, KeyEvent.KEYCODE_ENTER, 0); addKeyeventKey("enter", 0x0E, KeyEvent.KEYCODE_ENTER, 0);
addKeyeventKey("up", 0x05, KeyEvent.KEYCODE_DPAD_UP, FLAG_PRECISE_REPEAT); addKeyeventKey("up", 0x05, KeyEvent.KEYCODE_DPAD_UP, 0);
addKeyeventKey("right", 0x06, KeyEvent.KEYCODE_DPAD_RIGHT, FLAG_PRECISE_REPEAT); addKeyeventKey("right", 0x06, KeyEvent.KEYCODE_DPAD_RIGHT, 0);
addKeyeventKey("down", 0x07, KeyEvent.KEYCODE_DPAD_DOWN, FLAG_PRECISE_REPEAT); addKeyeventKey("down", 0x07, KeyEvent.KEYCODE_DPAD_DOWN, 0);
addKeyeventKey("left", 0x08, KeyEvent.KEYCODE_DPAD_LEFT, FLAG_PRECISE_REPEAT); addKeyeventKey("left", 0x08, KeyEvent.KEYCODE_DPAD_LEFT, 0);
addKeyeventKey("page_up", 0x02, KeyEvent.KEYCODE_PAGE_UP, 0); addKeyeventKey("page_up", 0x02, KeyEvent.KEYCODE_PAGE_UP, 0);
addKeyeventKey("page_down", 0x03, KeyEvent.KEYCODE_PAGE_DOWN, 0); addKeyeventKey("page_down", 0x03, KeyEvent.KEYCODE_PAGE_DOWN, 0);
addKeyeventKey("home", 0x0B, KeyEvent.KEYCODE_MOVE_HOME, 0); addKeyeventKey("home", 0x0B, KeyEvent.KEYCODE_MOVE_HOME, 0);

View File

@ -147,11 +147,6 @@ public final class Pointers implements Handler.Callback
public void onTouchDown(float x, float y, int pointerId, KeyboardData.Key key) public void onTouchDown(float x, float y, int pointerId, KeyboardData.Key key)
{ {
// Ignore new presses while a modulated key is active. On some devices,
// ghost touch events can happen while the pointer travels on top of other
// keys.
if (isModulatedKeyPressed())
return;
// Don't take latched modifiers into account if an other key is pressed. // Don't take latched modifiers into account if an other key is pressed.
// The other key already "own" the latched modifiers and will clear them. // The other key already "own" the latched modifiers and will clear them.
Modifiers mods = getModifiers(isOtherPointerDown()); Modifiers mods = getModifiers(isOtherPointerDown());
@ -207,7 +202,6 @@ public final class Pointers implements Handler.Callback
float dx = x - ptr.downX; float dx = x - ptr.downX;
float dy = y - ptr.downY; float dy = y - ptr.downY;
float dist = Math.abs(dx) + Math.abs(dy); float dist = Math.abs(dx) + Math.abs(dy);
ptr.ptrDist = dist;
int direction; int direction;
if (dist < _config.swipe_dist_px) if (dist < _config.swipe_dist_px)
@ -237,12 +231,6 @@ public final class Pointers implements Handler.Callback
int old_flags = ptr.flags; int old_flags = ptr.flags;
ptr.value = newValue; ptr.value = newValue;
ptr.flags = newValue.getFlags(); ptr.flags = newValue.getFlags();
// Keep the keyrepeat going between modulated keys.
if ((old_flags & ptr.flags & KeyValue.FLAG_PRECISE_REPEAT) == 0)
{
stopKeyRepeat(ptr);
startKeyRepeat(ptr);
}
_handler.onPointerDown(true); _handler.onPointerDown(true);
} }
} }
@ -299,16 +287,6 @@ public final class Pointers implements Handler.Callback
_handler.onPointerFlagsChanged(shouldVibrate); _handler.onPointerFlagsChanged(shouldVibrate);
} }
private boolean isModulatedKeyPressed()
{
for (Pointer ptr : _ptrs)
{
if ((ptr.flags & KeyValue.FLAG_PRECISE_REPEAT) != 0)
return true;
}
return false;
}
// Key repeat // Key repeat
/** Message from [_keyrepeat_handler]. */ /** Message from [_keyrepeat_handler]. */
@ -320,7 +298,8 @@ public final class Pointers implements Handler.Callback
if (ptr.timeoutWhat == msg.what) if (ptr.timeoutWhat == msg.what)
{ {
if (handleKeyRepeat(ptr)) if (handleKeyRepeat(ptr))
_keyrepeat_handler.sendEmptyMessageDelayed(msg.what, nextRepeatInterval(ptr)); _keyrepeat_handler.sendEmptyMessageDelayed(msg.what,
_config.longPressInterval);
else else
ptr.timeoutWhat = -1; ptr.timeoutWhat = -1;
return true; return true;
@ -329,17 +308,6 @@ public final class Pointers implements Handler.Callback
return false; return false;
} }
private long nextRepeatInterval(Pointer ptr)
{
long t = _config.longPressInterval;
if (_config.preciseRepeat && (ptr.flags & KeyValue.FLAG_PRECISE_REPEAT) != 0)
{
// Modulate repeat interval depending on the distance of the pointer
t = (long)((float)t * 2.f / modulatePreciseRepeat(ptr));
}
return t;
}
private static int uniqueTimeoutWhat = 0; private static int uniqueTimeoutWhat = 0;
private void startKeyRepeat(Pointer ptr) private void startKeyRepeat(Pointer ptr)
@ -348,11 +316,7 @@ public final class Pointers implements Handler.Callback
return; return;
int what = (uniqueTimeoutWhat++); int what = (uniqueTimeoutWhat++);
ptr.timeoutWhat = what; ptr.timeoutWhat = what;
long timeout = _config.longPressTimeout; _keyrepeat_handler.sendEmptyMessageDelayed(what, _config.longPressTimeout);
// Faster repeat timeout for modulated keys
if ((ptr.flags & KeyValue.FLAG_PRECISE_REPEAT) != 0)
timeout /= 2;
_keyrepeat_handler.sendEmptyMessageDelayed(what, timeout);
} }
private void stopKeyRepeat(Pointer ptr) private void stopKeyRepeat(Pointer ptr)
@ -361,7 +325,6 @@ public final class Pointers implements Handler.Callback
{ {
_keyrepeat_handler.removeMessages(ptr.timeoutWhat); _keyrepeat_handler.removeMessages(ptr.timeoutWhat);
ptr.timeoutWhat = -1; ptr.timeoutWhat = -1;
ptr.repeatingPtrDist = -1.f;
} }
} }
@ -381,16 +344,6 @@ public final class Pointers implements Handler.Callback
return true; return true;
} }
private float modulatePreciseRepeat(Pointer ptr)
{
if (ptr.repeatingPtrDist < 0.f)
ptr.repeatingPtrDist = ptr.ptrDist; // First repeat
if (ptr.ptrDist > ptr.repeatingPtrDist * 2.f)
ptr.repeatingPtrDist = ptr.ptrDist / 2.f; // Large swipe, move the middle point
float left = ptr.repeatingPtrDist / 2.f;
float accel = (ptr.ptrDist - left) / (ptr.repeatingPtrDist - left);
return Math.min(8.f, Math.max(0.1f, accel));
}
private static final class Pointer private static final class Pointer
{ {
@ -404,16 +357,12 @@ public final class Pointers implements Handler.Callback
public KeyValue value; public KeyValue value;
public float downX; public float downX;
public float downY; public float downY;
/** Distance of the pointer to the initial press. */
public float ptrDist;
/** Modifier flags at the time the key was pressed. */ /** Modifier flags at the time the key was pressed. */
public Modifiers modifiers; public Modifiers modifiers;
/** Flags of the value. Latch, lock and locked flags are updated. */ /** Flags of the value. Latch, lock and locked flags are updated. */
public int flags; public int flags;
/** Identify timeout messages. */ /** Identify timeout messages. */
public int timeoutWhat; public int timeoutWhat;
/** ptrDist at the first repeat, -1 otherwise. */
public float repeatingPtrDist;
public Pointer(int p, KeyboardData.Key k, KeyValue v, float x, float y, Modifiers m) public Pointer(int p, KeyboardData.Key k, KeyValue v, float x, float y, Modifiers m)
{ {
@ -423,11 +372,9 @@ public final class Pointers implements Handler.Callback
value = v; value = v;
downX = x; downX = x;
downY = y; downY = y;
ptrDist = 0.f;
modifiers = m; modifiers = m;
flags = (v == null) ? 0 : v.getFlags(); flags = (v == null) ? 0 : v.getFlags();
timeoutWhat = -1; timeoutWhat = -1;
repeatingPtrDist = -1.f;
} }
} }