From 05e9af9bc6494c972368c4ef6bdcef7ef5c4a8d6 Mon Sep 17 00:00:00 2001 From: Devy Ballard <69347329+devycarol@users.noreply.github.com> Date: Sun, 30 Jun 2024 00:39:08 -0600 Subject: [PATCH] Reduce longpress timeout for shift (caps lock) and symbols (for numpad) (#924) --- .../helium314/keyboard/keyboard/PointerTracker.java | 13 +++++-------- app/src/main/res/values/attrs.xml | 2 -- app/src/main/res/values/config-common.xml | 3 --- app/src/main/res/values/themes-common.xml | 1 - 4 files changed, 5 insertions(+), 14 deletions(-) diff --git a/app/src/main/java/helium314/keyboard/keyboard/PointerTracker.java b/app/src/main/java/helium314/keyboard/keyboard/PointerTracker.java index 6feb056a..e476352f 100644 --- a/app/src/main/java/helium314/keyboard/keyboard/PointerTracker.java +++ b/app/src/main/java/helium314/keyboard/keyboard/PointerTracker.java @@ -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; diff --git a/app/src/main/res/values/attrs.xml b/app/src/main/res/values/attrs.xml index 35dd5d32..e21e2fa3 100644 --- a/app/src/main/res/values/attrs.xml +++ b/app/src/main/res/values/attrs.xml @@ -94,8 +94,6 @@ - - diff --git a/app/src/main/res/values/config-common.xml b/app/src/main/res/values/config-common.xml index ee30cee4..946d838a 100644 --- a/app/src/main/res/values/config-common.xml +++ b/app/src/main/res/values/config-common.xml @@ -37,9 +37,6 @@ 3000 5 - - 1200 - 8.0dp