Merge branch 'master' into clipboard

This commit is contained in:
Jules Aguillon 2024-07-06 13:44:55 +02:00
commit caa397dd70
23 changed files with 85 additions and 64 deletions

View File

@ -85,7 +85,7 @@ The following optional properties define the effects of swipes:
You can define a swipe only once with either compass-point or numeric notation. Unexpected Keyboard automatically puts a small legend in that direction from the center of the key.
* `slider`: If `slider="true"`, and the key also has `w` and `e` properties, then the key tracks horizontal finger motion precisely and sends the `w` and `e` keystrokes repeatedly. In built-in layouts, this makes the space bar send left and right characters as the user slides on the space bar.
* `anticircle`: The key value to send when doing an anti-clockwise gesture on the key. (The clockwise gesture applies a Shift modifier and the round-trip gesture applies a Fn modifier. These results can be redefined using a modmap, as explained below.)
* `anticircle`: The key value to send when doing an anti-clockwise gesture on the key.
### Layout
A key may have the following properties to control the row's layout:
@ -97,26 +97,26 @@ Normally, a key's width is 1.0 unit. Unexpected Keyboard occupies the full width
### Extra legend
* `indication`: An optional extra legend to show under the main label. For example, `<key key0="2" indication="ABC" />` displays ABC at the bottom of the 2 key, as on a pinpad or some telephones. If the key also defines a downward swipe with `s` or `key8`, the legends overlap.
## Possible key values
The properties that define the effects of tapping or swiping a key may be one of the built-in strings documented on [this page](Possible-key-values). For example, `se="cut"` says that a southeast swipe produces the "cut" key (Ctrl-C).
### Possible key values
Some of those strings begin with `loc `. These are place-holders; the tap or swipe does nothing unless enabled through the "Add keys to keyboard" option in the Settings menu, or implicitly enabled by the language the device is set to use. For example, `ne="loc accent_aigu"` says that a northeast swipe produces the acute accent combinatorial key—if enabled.
The possible key values are described in [this page](Possible-key-values.md).
If the string defining a tap or a swipe is anything other than one of the built-in strings, the defined string is output *verbatim.* This is what most of the taps and swipes on a typical keyboard do. So `key0="a"` simply outputs the letter a.
The string can output multiple characters, but cannot combine the built-in strings to specify a sequence of keystrokes.
In a layout, a key value can also start with the `loc` prefix. These are place-holders, the tap or swipe does nothing unless enabled through the "Add keys to keyboard" option in the Settings menu, or implicitly enabled by the language the device is set to use.
For example, `ne="loc accent_aigu"` says that a northeast swipe produces the acute accent combinatorial key—if enabled.
## Modmap
The `<modmap>`...`</modmap>` pair encloses custom mappings for modifier keys. The modmap is placed inside the `<keyboard>`...`</keyboard>` pair, but outside any row. A layout can have at most one modmap.
A modmap can contain the following tags, each of which must have an `a` and a `b` property:
* `<shift a="`...`" b="`...`" />` —This says that, if the Shift modifier is on (or the user made a clockwise gesture on a key), and if the key would normally generate the value after "a", it must instead generate the value after "b".
* `<fn a="`...`" b="`...`" />` —This says that, if the Fn modifier is on (or the user made a round-trip gesture on a key), and if the key would normally generate the value after "a", it must instead generate the value after "b".
* `<shift a="before" b="after" />` If the Shift modifier is on, the key `before` is changed into `after`.
* `<fn a="before" b="after" />` If the Fn modifier is on, the key `before` is changed into `after`.
The "a" and "b" values are as specified above in **Possible key values**. A `<fn`...`/>` tag modifies a gesture only if no `<shift`...`/>` tag did.
Valid values for `before` and `after` are listed in [Possible key values](Possible-key-values.md).
There can be as many of these tags inside `<modmap>` as needed.
The clockwise circle and the round-trip gestures are affected by both Shift and Fn modmaps. The Shift mappings are used first and if that did not modify the key, the Fn mappings are used instead.
### Examples
① Turkish keyboards use the Latin alphabet, but when "i" is shifted, it should produce "İ". This is achieved with the following modmap:

View File

@ -1,6 +1,9 @@
# Key values
This is an exhaustive list of special values accepted for the `key0` through `key8` or `nw` through `se` attributes on a key. Any string that does not exactly match these will be printed verbatim.
This is an exhaustive list of special values accepted for the `key0` through `key8` or `nw` through `se` attributes on a key.
Any string that does not exactly match these will be printed verbatim.
A key can output multiple characters, but cannot combine multiple built-in key values.
## Escape codes
Value | Escape code for

View File

@ -38,8 +38,9 @@ Tato aplikace neobsahuje žádné reklamy, nevyužívá připojení k síti a je
<string name="pref_category_typing">Psaní</string>
<string name="pref_swipe_dist_title">Vzdálenost posunutí prstem</string>
<string name="pref_swipe_dist_summary">Jak daleko je třeba posunout prst pro zadání znaku/znaménka v rohu klávey (%s)</string>
<string name="pref_long_timeout_title">Časová prodleva opakování znaků</string>
<!-- <string name="pref_long_timeout_title">Long press timeout</string> -->
<string name="pref_long_interval_title">Interval opakování znaků</string>
<!-- <string name="pref_keyrepeat_enabled">Key repeat on long press</string> -->
<string name="pref_lock_double_tap_title">Dvojklik pro aktivaci Capslock(u)</string>
<string name="pref_lock_double_tap_summary">Umožňuje zamknout Shift dvojklikem, namísto podržení</string>
<string name="pref_category_behavior">Chování</string>

View File

@ -38,8 +38,9 @@ Diese App enthält keine Werbung, benötigt keinen Netzwerkzugriff und ist quell
<string name="pref_category_typing">Tippen</string>
<string name="pref_swipe_dist_title">Länge der Wischgeste</string>
<string name="pref_swipe_dist_summary">Abstand der Zeichen in den Ecken der Tasten (%s)</string>
<string name="pref_long_timeout_title">Zeitüberschreitung bei Tastenwiederholung</string>
<!-- <string name="pref_long_timeout_title">Long press timeout</string> -->
<string name="pref_long_interval_title">Intervall der Tastenwiederholung</string>
<!-- <string name="pref_keyrepeat_enabled">Key repeat on long press</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_category_behavior">Verhalten</string>

View File

@ -38,8 +38,9 @@ La misma no contiene ningún anuncio/publicidad, no realiza peticiones de red y
<string name="pref_category_typing">Escritura</string>
<string name="pref_swipe_dist_title">Distancia de deslizamiento</string>
<string name="pref_swipe_dist_summary">Distancia de caracteres en las esquinas de las teclas (%s)</string>
<string name="pref_long_timeout_title">Tiempo de espera para repetir tecla</string>
<!-- <string name="pref_long_timeout_title">Long press timeout</string> -->
<string name="pref_long_interval_title">Intervalo de repetición de tecla</string>
<!-- <string name="pref_keyrepeat_enabled">Key repeat on long press</string> -->
<string name="pref_lock_double_tap_title">Doble toque en Mayús para bloquear las mayúsculas</string>
<string name="pref_lock_double_tap_summary">Se puede bloquear cualquier modificador manteniéndolo presionado</string>
<string name="pref_category_behavior">Comportamiento</string>

View File

@ -38,8 +38,9 @@ This application contains no ads, doesn't make any network requests and is Open
<string name="pref_category_typing">درحال نوشتن</string>
<string name="pref_swipe_dist_title">فاصله کشیدن</string>
<string name="pref_swipe_dist_summary">فاصله حروف از گوشه‌های کلیدها )(%s)</string>
<string name="pref_long_timeout_title">درنگ تکرار کلید</string>
<!-- <string name="pref_long_timeout_title">Long press timeout</string> -->
<string name="pref_long_interval_title">فاصله تکرار کلید</string>
<!-- <string name="pref_keyrepeat_enabled">Key repeat on long press</string> -->
<string name="pref_lock_double_tap_title">دوبار ضربه روی دگرساز برای فعال شدن کپس لاک</string>
<string name="pref_lock_double_tap_summary">شما میتوانید قفل کنید هر میانبری را با نگه داشتن آن</string>
<string name="pref_category_behavior">ٰرفتار</string>

View File

@ -38,8 +38,9 @@ Cette application ne contient pas de publicité, n'accède pas au réseau et est
<string name="pref_category_typing">Saisie</string>
<string name="pref_swipe_dist_title">Distance de swipe</string>
<string name="pref_swipe_dist_summary">La distance des caractères dans les coins (%s)</string>
<string name="pref_long_timeout_title">Délai avant répétition</string>
<!-- <string name="pref_long_timeout_title">Long press timeout</string> -->
<string name="pref_long_interval_title">Écart entre les répétitions</string>
<!-- <string name="pref_keyrepeat_enabled">Key repeat on long press</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_category_behavior">Comportement</string>

View File

@ -38,8 +38,9 @@ This application contains no ads, doesn't make any network requests and is Open
<string name="pref_category_typing">Digitando</string>
<string name="pref_swipe_dist_title">Distanza swipe</string>
<string name="pref_swipe_dist_summary">Distanza dei caratteri negli angoli dei tasti (%s)</string>
<string name="pref_long_timeout_title">Timeout ripetizione tasto</string>
<!-- <string name="pref_long_timeout_title">Long press timeout</string> -->
<string name="pref_long_interval_title">Intervallo ripetizione tasto</string>
<!-- <string name="pref_keyrepeat_enabled">Key repeat on long press</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_category_behavior">Behavior</string> -->

View File

@ -38,8 +38,9 @@ This application contains no ads, doesn't make any network requests and is Open
<string name="pref_category_typing">타자</string>
<string name="pref_swipe_dist_title">스와이프 범위</string>
<string name="pref_swipe_dist_summary">키 모서리 문자의 입력 범위 (%s)</string>
<string name="pref_long_timeout_title">키 길게 누르기 지연</string>
<!-- <string name="pref_long_timeout_title">Long press timeout</string> -->
<string name="pref_long_interval_title">키 반복 간격</string>
<!-- <string name="pref_keyrepeat_enabled">Key repeat on long press</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_category_behavior">Behavior</string> -->

View File

@ -38,8 +38,9 @@ Tagad lieliski piemērota izmantošanai ikdienā.
<string name="pref_category_typing">Rakstīšana</string>
<string name="pref_swipe_dist_title">Pavilkšanas attālums</string>
<string name="pref_swipe_dist_summary">Taustiņu stūros esošo rakstzīmju attālums (%s)</string>
<string name="pref_long_timeout_title">Taustiņa atkārtošanās ātrums</string>
<!-- <string name="pref_long_timeout_title">Long press timeout</string> -->
<string name="pref_long_interval_title">Taustiņa atkārtošanās aizture</string>
<!-- <string name="pref_keyrepeat_enabled">Key repeat on long press</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_category_behavior">Uzvedība</string>

View File

@ -38,8 +38,9 @@ Aplikacja nie zawiera reklam, nie żąda dostępu do internetu, a jej kod źród
<string name="pref_category_typing">Pisanie</string>
<string name="pref_swipe_dist_title">Odległość przesuwania</string>
<string name="pref_swipe_dist_summary">Odległość znaków od rogów klawiszy (%s)</string>
<string name="pref_long_timeout_title">Opóźnienie powtarzania naciśnięć klawisza</string>
<!-- <string name="pref_long_timeout_title">Long press timeout</string> -->
<string name="pref_long_interval_title">Czas pomiędzy powtórzeniami</string>
<!-- <string name="pref_keyrepeat_enabled">Key repeat on long press</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_category_behavior">Zachowanie</string>

View File

@ -38,8 +38,9 @@ Este aplicativo não contém anúncios, não faz nenhuma solicitação de rede e
<string name="pref_category_typing">Digitação</string>
<string name="pref_swipe_dist_title">Distância a deslizar</string>
<string name="pref_swipe_dist_summary">Distância até acionar os cantos das teclas (%s)</string>
<string name="pref_long_timeout_title">Tempo até repetir tecla</string>
<!-- <string name="pref_long_timeout_title">Long press timeout</string> -->
<string name="pref_long_interval_title">Intervalo de repetição de tecla</string>
<!-- <string name="pref_keyrepeat_enabled">Key repeat on long press</string> -->
<string name="pref_lock_double_tap_title">Tecle duas vezes no shift para travá-lo acionado</string>
<string name="pref_lock_double_tap_summary">Ao invés de apertar e segurar por um tempo</string>
<string name="pref_category_behavior">Comportamento</string>

View File

@ -38,8 +38,9 @@ Această aplicație nu conține publicitate, nu folosește rețeaua deloc și e
<string name="pref_category_typing">Tipărire</string>
<string name="pref_swipe_dist_title">Distanța de glisare</string>
<string name="pref_swipe_dist_summary">Distanța dintre caracterele din colțurile tastelor (%s)</string>
<string name="pref_long_timeout_title">Timeout pentru repetarea tastelor</string>
<!-- <string name="pref_long_timeout_title">Long press timeout</string> -->
<string name="pref_long_interval_title">Intervalul de repetare a tastelor</string>
<!-- <string name="pref_keyrepeat_enabled">Key repeat on long press</string> -->
<string name="pref_lock_double_tap_title">Apăsare dublă pe Shift activează Caps Lock</string>
<string name="pref_lock_double_tap_summary">Puteți activa orice modificator, ținându-l apăsat</string>
<string name="pref_category_behavior">Comportament</string>

View File

@ -38,8 +38,9 @@
<string name="pref_category_typing">Набор текста</string>
<string name="pref_swipe_dist_title">Длина жеста</string>
<string name="pref_swipe_dist_summary">Расстояние между символами в углах клавиш (%s)</string>
<string name="pref_long_timeout_title">Задержка повтора клавиш</string>
<string name="pref_long_timeout_title">Задержка долгого нажатия</string>
<string name="pref_long_interval_title">Интервал повтора клавиш</string>
<string name="pref_keyrepeat_enabled">Повтор клавиши при долгом нажатии</string>
<string name="pref_lock_double_tap_title">CapsLock двойным нажатием Shift</string>
<string name="pref_lock_double_tap_summary">Также можно активировать модификатор долгим нажатием</string>
<string name="pref_category_behavior">Поведение</string>

View File

@ -38,8 +38,9 @@ Bu uygulama açık kaynaklıdır. Reklam içermez ve internete bağlanmaz."</str
<string name="pref_category_typing">Yazma</string>
<string name="pref_swipe_dist_title">Kaydırma mesafesi</string>
<string name="pref_swipe_dist_summary">Tuşların köşelerinden kaydırma mesafesi (%s)</string>
<string name="pref_long_timeout_title">Tuşların tekrarlaması için geçmesi gereken süre</string>
<!-- <string name="pref_long_timeout_title">Long press timeout</string> -->
<string name="pref_long_interval_title">Tuşların tekrarlama sıklığı</string>
<!-- <string name="pref_keyrepeat_enabled">Key repeat on long press</string> -->
<string name="pref_lock_double_tap_title">CapsLock için Shift tuşuna çift bas</string>
<string name="pref_lock_double_tap_summary">Uzun basarak CapsLock açılabilir</string>
<string name="pref_category_behavior">Klavye davranışı</string>

View File

@ -38,8 +38,9 @@
<string name="pref_category_typing">Введення</string>
<string name="pref_swipe_dist_title">Відстань проведення</string>
<string name="pref_swipe_dist_summary">Відстань між символами в кутах клавіш (%s)</string>
<string name="pref_long_timeout_title">Час очікування повтору клавіші</string>
<string name="pref_long_timeout_title">Час очікування тривалого натискання</string>
<string name="pref_long_interval_title">Інтервал повторення клавіш</string>
<string name="pref_keyrepeat_enabled">Повторення клавіші при тривалому натисканні</string>
<string name="pref_lock_double_tap_title">Двічі торкніться Shift для Caps Lock</string>
<string name="pref_lock_double_tap_summary">Ви можете заблокувати будь-який модифікатор, утримуючи його</string>
<string name="pref_category_behavior">Поведінка</string>

View File

@ -38,8 +38,9 @@ Bây giờ đã hoàn hảo cho việc sử dụng hàng ngày.
<string name="pref_category_typing"></string>
<string name="pref_swipe_dist_title">Khoảng cách vuốt</string>
<string name="pref_swipe_dist_summary">Khoảng cách giữa các ký tự ở góc phím (%s)</string>
<string name="pref_long_timeout_title">Thời hạn lặp phím</string>
<!-- <string name="pref_long_timeout_title">Long press timeout</string> -->
<string name="pref_long_interval_title">Khoảng thời gian lặp phím</string>
<!-- <string name="pref_keyrepeat_enabled">Key repeat on long press</string> -->
<string name="pref_lock_double_tap_title">Nhấn hai lần Shift để bật Caps Lock</string>
<string name="pref_lock_double_tap_summary">Bạn có thể khóa phím hỗ trợ bằng cách giữ vào nó</string>
<!-- <string name="pref_category_behavior">Behavior</string> -->

View File

@ -38,8 +38,9 @@
<string name="pref_category_typing">输入</string>
<string name="pref_swipe_dist_title">滑动触发距离</string>
<string name="pref_swipe_dist_summary">输入按键四角的符号需要滑动的距离 (%s)</string>
<string name="pref_long_timeout_title">长按到开始重复输入的时间</string>
<!-- <string name="pref_long_timeout_title">Long press timeout</string> -->
<string name="pref_long_interval_title">长按后每次重复输入的时间间隔</string>
<!-- <string name="pref_keyrepeat_enabled">Key repeat on long press</string> -->
<string name="pref_lock_double_tap_title">双击 Shift 键锁定大写</string>
<string name="pref_lock_double_tap_summary">任何时候长按修饰键均可将其锁定</string>
<string name="pref_category_behavior">行为</string>

View File

@ -38,8 +38,9 @@ This application contains no ads, doesn't make any network requests and is Open
<string name="pref_category_typing">Typing</string>
<string name="pref_swipe_dist_title">Swiping distance</string>
<string name="pref_swipe_dist_summary">Distance of characters in the corners of the keys (%s)</string>
<string name="pref_long_timeout_title">Key repeat timeout</string>
<string name="pref_long_timeout_title">Long press timeout</string>
<string name="pref_long_interval_title">Key repeat interval</string>
<string name="pref_keyrepeat_enabled">Key repeat on long press</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_category_behavior">Behavior</string>

View File

@ -16,7 +16,8 @@
<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="circle_sensitivity" android:title="@string/pref_circle_sensitivity_title" android:summary="%s" android:defaultValue="2" android:entries="@array/pref_circle_sensitivity_entries" android:entryValues="@array/pref_circle_sensitivity_values"/>
<juloo.keyboard2.prefs.IntSlideBarPreference android:key="longpress_timeout" android:title="@string/pref_long_timeout_title" android:summary="%sms" android:defaultValue="600" min="50" max="2000"/>
<juloo.keyboard2.prefs.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="keyrepeat_enabled" android:title="@string/pref_keyrepeat_enabled" android:defaultValue="true"/>
<juloo.keyboard2.prefs.IntSlideBarPreference android:key="longpress_interval" android:dependency="keyrepeat_enabled" android:title="@string/pref_long_interval_title" android:summary="%sms" android:defaultValue="25" min="5" max="100"/>
<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"/>
</PreferenceCategory>
<PreferenceCategory android:title="@string/pref_category_behavior">

View File

@ -47,6 +47,7 @@ public final class Config
public long vibrate_duration;
public long longPressTimeout;
public long longPressInterval;
public boolean keyrepeat_enabled;
public float margin_bottom;
public float keyHeight;
public float horizontal_margin;
@ -153,6 +154,7 @@ public final class Config
vibrate_duration = _prefs.getInt("vibrate_duration", 20);
longPressTimeout = _prefs.getInt("longpress_timeout", 600);
longPressInterval = _prefs.getInt("longpress_interval", 65);
keyrepeat_enabled = _prefs.getBoolean("keyrepeat_enabled", true);
margin_bottom = get_dip_pref_oriented(dm, "margin_bottom", 7, 3);
key_vertical_margin = get_dip_pref(dm, "key_vertical_margin", 1.5f) / 100;
key_horizontal_margin = get_dip_pref(dm, "key_horizontal_margin", 2) / 100;

View File

@ -96,7 +96,7 @@ public final class KeyboardData
{
Row row = rows.get(i_row);
int i_col = p.col;
int i_col_end = p.col;
int i_col_end = Math.min(p.col, row.keys.size() - 1);
if (p.col == -1) { i_col = 0; i_col_end = row.keys.size() - 1; }
for (; i_col <= i_col_end; i_col++)
{

View File

@ -24,14 +24,14 @@ public final class Pointers implements Handler.Callback
/** Can't be locked, even when long pressing. */
public static final int FLAG_P_CANT_LOCK = (1 << 7);
private Handler _keyrepeat_handler;
private Handler _longpress_handler;
private ArrayList<Pointer> _ptrs = new ArrayList<Pointer>();
private IPointerEventHandler _handler;
private Config _config;
public Pointers(IPointerEventHandler h, Config c)
{
_keyrepeat_handler = new Handler(this);
_longpress_handler = new Handler(this);
_handler = h;
_config = c;
}
@ -62,7 +62,7 @@ public final class Pointers implements Handler.Callback
public void clear()
{
for (Pointer p : _ptrs)
stopKeyRepeat(p);
stopLongPress(p);
_ptrs.clear();
}
@ -142,7 +142,7 @@ public final class Pointers implements Handler.Callback
ptr.sliding.onTouchUp(ptr);
return;
}
stopKeyRepeat(ptr);
stopLongPress(ptr);
KeyValue ptr_value = ptr.value;
if (ptr.gesture != null && ptr.gesture.is_in_progress())
{
@ -206,7 +206,7 @@ public final class Pointers implements Handler.Callback
KeyValue value = _handler.modifyKey(key.keys[0], mods);
Pointer ptr = new Pointer(pointerId, key, value, x, y, mods);
_ptrs.add(ptr);
startKeyRepeat(ptr);
startLongPress(ptr);
_handler.onPointerDown(value, false);
}
@ -313,7 +313,7 @@ public final class Pointers implements Handler.Callback
else
{
ptr.value = apply_gesture(ptr, ptr.gesture.get_gesture());
restartKeyRepeat(ptr);
restartLongPress(ptr);
ptr.flags = 0; // Special behaviors are ignored during a gesture.
}
}
@ -382,7 +382,7 @@ public final class Pointers implements Handler.Callback
// Key repeat
/** Message from [_keyrepeat_handler]. */
/** Message from [_longpress_handler]. */
@Override
public boolean handleMessage(Message msg)
{
@ -390,11 +390,7 @@ public final class Pointers implements Handler.Callback
{
if (ptr.timeoutWhat == msg.what)
{
if (handleKeyRepeat(ptr))
_keyrepeat_handler.sendEmptyMessageDelayed(msg.what,
_config.longPressInterval);
else
ptr.timeoutWhat = -1;
handleLongPress(ptr);
return true;
}
}
@ -403,60 +399,62 @@ public final class Pointers implements Handler.Callback
private static int uniqueTimeoutWhat = 0;
private void startKeyRepeat(Pointer ptr)
private void startLongPress(Pointer ptr)
{
int what = (uniqueTimeoutWhat++);
ptr.timeoutWhat = what;
_keyrepeat_handler.sendEmptyMessageDelayed(what, _config.longPressTimeout);
_longpress_handler.sendEmptyMessageDelayed(what, _config.longPressTimeout);
}
private void stopKeyRepeat(Pointer ptr)
private void stopLongPress(Pointer ptr)
{
if (ptr.timeoutWhat != -1)
{
_keyrepeat_handler.removeMessages(ptr.timeoutWhat);
ptr.timeoutWhat = -1;
}
_longpress_handler.removeMessages(ptr.timeoutWhat);
}
private void restartKeyRepeat(Pointer ptr)
private void restartLongPress(Pointer ptr)
{
stopKeyRepeat(ptr);
startKeyRepeat(ptr);
stopLongPress(ptr);
startLongPress(ptr);
}
/** A pointer is repeating. Returns [true] if repeat should continue. */
private boolean handleKeyRepeat(Pointer ptr)
/** A pointer is long pressing. */
private void handleLongPress(Pointer ptr)
{
// Long press toggle lock on modifiers
if ((ptr.flags & FLAG_P_LATCHABLE) != 0)
{
if (!ptr.hasFlagsAny(FLAG_P_CANT_LOCK))
lockPointer(ptr, true);
return false;
return;
}
// Stop repeating: Latched key, no key
// Latched key, no key
if (ptr.hasFlagsAny(FLAG_P_LATCHED) || ptr.value == null)
return false;
return;
// Key is long-pressable
KeyValue kv = KeyModifier.modify_long_press(ptr.value);
if (!kv.equals(ptr.value))
{
ptr.value = kv;
_handler.onPointerDown(kv, true);
return true;
return;
}
// Stop repeating: Special keys
// Special keys
if (kv.hasFlagsAny(KeyValue.FLAG_SPECIAL))
return false;
_handler.onPointerHold(kv, ptr.modifiers);
return true;
return;
// For every other keys, key-repeat
if (_config.keyrepeat_enabled)
{
_handler.onPointerHold(kv, ptr.modifiers);
_longpress_handler.sendEmptyMessageDelayed(ptr.timeoutWhat,
_config.longPressInterval);
}
}
// Sliding
void startSliding(Pointer ptr, float x)
{
stopKeyRepeat(ptr);
stopLongPress(ptr);
ptr.flags |= FLAG_P_SLIDING;
ptr.sliding = new Sliding(x);
}