Reduce longpress timeout for shift (caps lock) and symbols (for numpad) (#924)

This commit is contained in:
Devy Ballard 2024-06-30 00:39:08 -06:00 committed by GitHub
parent 57b99e27b0
commit 05e9af9bc6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 5 additions and 14 deletions

View file

@ -56,7 +56,6 @@ public final class PointerTracker implements PointerTrackerQueue.Element,
public final int mSuppressKeyPreviewAfterBatchInputDuration;
public final int mKeyRepeatStartTimeout;
public final int mKeyRepeatInterval;
public final int mLongPressShiftLockTimeout;
public PointerTrackerParams(final TypedArray mainKeyboardViewAttr) {
mKeySelectionByDraggingFinger = mainKeyboardViewAttr.getBoolean(
@ -71,8 +70,6 @@ public final class PointerTracker implements PointerTrackerQueue.Element,
R.styleable.MainKeyboardView_keyRepeatStartTimeout, 0);
mKeyRepeatInterval = mainKeyboardViewAttr.getInt(
R.styleable.MainKeyboardView_keyRepeatInterval, 0);
mLongPressShiftLockTimeout = mainKeyboardViewAttr.getInt(
R.styleable.MainKeyboardView_longPressShiftLockTimeout, 0);
}
}
@ -1176,12 +1173,12 @@ public final class PointerTracker implements PointerTrackerQueue.Element,
}
private int getLongPressTimeout(final int code) {
if (code == KeyCode.SHIFT) {
return sParams.mLongPressShiftLockTimeout;
}
final int longpressTimeout = Settings.getInstance().getCurrent().mKeyLongpressTimeout;
if (mIsInSlidingKeyInput) {
// We use longer timeout for sliding finger input started from the modifier key.
if (code == KeyCode.SHIFT || code == KeyCode.SYMBOL_ALPHA) {
// We use slightly longer timeout for shift-lock and the numpad long-press.
return longpressTimeout * 3 / 2;
} else if (mIsInSlidingKeyInput) {
// We use longer timeout for sliding finger input started from a modifier key.
return longpressTimeout * MULTIPLIER_FOR_LONG_PRESS_TIMEOUT_IN_SLIDING_INPUT;
}
return longpressTimeout;

View file

@ -94,8 +94,6 @@
<attr name="keyRepeatStartTimeout" format="integer" />
<!-- Key repeat interval in millisecond. -->
<attr name="keyRepeatInterval" format="integer" />
<!-- Long press timeout of shift key to shift lock in millisecond. -->
<attr name="longPressShiftLockTimeout" format="integer" />
<!-- Ignore special key timeout while typing in millisecond. -->
<attr name="ignoreAltCodeKeyTimeout" format="integer" />
<!-- Background resource for key press feedback.-->

View file

@ -37,9 +37,6 @@
<integer name="config_accessibility_long_press_key_timeout">3000</integer>
<integer name="config_max_popup_keys_column">5</integer>
<!-- Long pressing shift will invoke caps-lock if > 0, never invoke caps-lock if == 0 -->
<integer name="config_longpress_shift_lock_timeout">1200</integer>
<!-- Sliding key input preview parameters -->
<dimen name="config_sliding_key_input_preview_width">8.0dp</dimen>
<!-- Percentages of sliding key input preview body and shadow, in proportion to the width.

View file

@ -61,7 +61,6 @@
<item name="slidingKeyInputPreviewShadowRatio">@integer/config_sliding_key_input_preview_shadow_ratio</item>
<item name="keyRepeatStartTimeout">@integer/config_key_repeat_start_timeout</item>
<item name="keyRepeatInterval">@integer/config_key_repeat_interval</item>
<item name="longPressShiftLockTimeout">@integer/config_longpress_shift_lock_timeout</item>
<item name="ignoreAltCodeKeyTimeout">@integer/config_ignore_alt_code_key_timeout</item>
<item name="popupKeysKeyboardLayout">@layout/popup_keys_keyboard</item>
<item name="showPopupKeysKeyboardAtTouchedPoint">@bool/config_show_popup_keys_keyboard_at_touched_point</item>