mirror of
https://github.com/Julow/Unexpected-Keyboard.git
synced 2024-11-25 00:33:24 +01:00
Option to disable key repeat
Internally "key repeat" is reword into "long press" when the same mechanism was used for both features. The constraint that 'timeoutWhat' must be set to '-1' when no message is expected has been lifted to simplify the code.
This commit is contained in:
parent
bf33230c26
commit
bdb080657d
@ -40,6 +40,7 @@ Tato aplikace neobsahuje žádné reklamy, nevyužívá připojení k síti a je
|
||||
<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">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>
|
||||
|
@ -40,6 +40,7 @@ Diese App enthält keine Werbung, benötigt keinen Netzwerkzugriff und ist quell
|
||||
<string name="pref_swipe_dist_summary">Abstand der Zeichen in den Ecken der Tasten (%s)</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>
|
||||
|
@ -40,6 +40,7 @@ La misma no contiene ningún anuncio/publicidad, no realiza peticiones de red y
|
||||
<string name="pref_swipe_dist_summary">Distancia de caracteres en las esquinas de las teclas (%s)</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>
|
||||
|
@ -40,6 +40,7 @@ This application contains no ads, doesn't make any network requests and is Open
|
||||
<string name="pref_swipe_dist_summary">فاصله حروف از گوشههای کلیدها )(%s)</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>
|
||||
|
@ -40,6 +40,7 @@ Cette application ne contient pas de publicité, n'accède pas au réseau et est
|
||||
<string name="pref_swipe_dist_summary">La distance des caractères dans les coins (%s)</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>
|
||||
|
@ -40,6 +40,7 @@ This application contains no ads, doesn't make any network requests and is Open
|
||||
<string name="pref_swipe_dist_summary">Distanza dei caratteri negli angoli dei tasti (%s)</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> -->
|
||||
|
@ -40,6 +40,7 @@ This application contains no ads, doesn't make any network requests and is Open
|
||||
<string name="pref_swipe_dist_summary">키 모서리 문자의 입력 범위 (%s)</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> -->
|
||||
|
@ -40,6 +40,7 @@ Tagad lieliski piemērota izmantošanai ikdienā.
|
||||
<string name="pref_swipe_dist_summary">Taustiņu stūros esošo rakstzīmju attālums (%s)</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>
|
||||
|
@ -40,6 +40,7 @@ Aplikacja nie zawiera reklam, nie żąda dostępu do internetu, a jej kod źród
|
||||
<string name="pref_swipe_dist_summary">Odległość znaków od rogów klawiszy (%s)</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>
|
||||
|
@ -40,6 +40,7 @@ Este aplicativo não contém anúncios, não faz nenhuma solicitação de rede e
|
||||
<string name="pref_swipe_dist_summary">Distância até acionar os cantos das teclas (%s)</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>
|
||||
|
@ -40,6 +40,7 @@ Această aplicație nu conține publicitate, nu folosește rețeaua deloc și e
|
||||
<string name="pref_swipe_dist_summary">Distanța dintre caracterele din colțurile tastelor (%s)</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>
|
||||
|
@ -40,6 +40,7 @@
|
||||
<string name="pref_swipe_dist_summary">Расстояние между символами в углах клавиш (%s)</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">CapsLock двойным нажатием Shift</string>
|
||||
<string name="pref_lock_double_tap_summary">Также можно активировать модификатор долгим нажатием</string>
|
||||
<string name="pref_category_behavior">Поведение</string>
|
||||
|
@ -40,6 +40,7 @@ Bu uygulama açık kaynaklıdır. Reklam içermez ve internete bağlanmaz."</str
|
||||
<string name="pref_swipe_dist_summary">Tuşların köşelerinden kaydırma mesafesi (%s)</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>
|
||||
|
@ -40,6 +40,7 @@
|
||||
<string name="pref_swipe_dist_summary">Відстань між символами в кутах клавіш (%s)</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 для Caps Lock</string>
|
||||
<string name="pref_lock_double_tap_summary">Ви можете заблокувати будь-який модифікатор, утримуючи його</string>
|
||||
<string name="pref_category_behavior">Поведінка</string>
|
||||
|
@ -40,6 +40,7 @@ Bây giờ đã hoàn hảo cho việc sử dụng hàng ngày.
|
||||
<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">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> -->
|
||||
|
@ -40,6 +40,7 @@
|
||||
<string name="pref_swipe_dist_summary">输入按键四角的符号需要滑动的距离 (%s)</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>
|
||||
|
@ -40,6 +40,7 @@ This application contains no ads, doesn't make any network requests and is Open
|
||||
<string name="pref_swipe_dist_summary">Distance of characters in the corners of the keys (%s)</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>
|
||||
|
@ -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">
|
||||
|
@ -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;
|
||||
@ -152,6 +153,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;
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user