From 09bc110eb6b49980419bcd3debdec99b1191ba44 Mon Sep 17 00:00:00 2001 From: merkost Date: Fri, 9 Jun 2023 12:10:00 +1000 Subject: [PATCH 1/3] Fixed a bug when clicking on layout change and space at the same time --- .../com/simplemobiletools/keyboard/views/MyKeyboardView.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/keyboard/views/MyKeyboardView.kt b/app/src/main/kotlin/com/simplemobiletools/keyboard/views/MyKeyboardView.kt index 76b4125..5e969c2 100644 --- a/app/src/main/kotlin/com/simplemobiletools/keyboard/views/MyKeyboardView.kt +++ b/app/src/main/kotlin/com/simplemobiletools/keyboard/views/MyKeyboardView.kt @@ -1154,8 +1154,8 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut // fix a glitch with long pressing backspace, then clicking some letter if (mRepeatKeyIndex != NOT_A_KEY) { - val key = mKeys[mRepeatKeyIndex] - if (key.code == KEYCODE_DELETE) { + val key = mKeys.getOrNull(mRepeatKeyIndex) + if (key?.code == KEYCODE_DELETE) { mHandler?.removeMessages(MSG_REPEAT) mRepeatKeyIndex = NOT_A_KEY } From 56d3ff4b85fb1562920146468b17337f7f0e7977 Mon Sep 17 00:00:00 2001 From: merkost Date: Fri, 9 Jun 2023 12:22:38 +1000 Subject: [PATCH 2/3] Fixed a bug when some keyboard's change layout button doesn't work as expected --- .../com/simplemobiletools/keyboard/views/MyKeyboardView.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/keyboard/views/MyKeyboardView.kt b/app/src/main/kotlin/com/simplemobiletools/keyboard/views/MyKeyboardView.kt index 5e969c2..9525d3a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/keyboard/views/MyKeyboardView.kt +++ b/app/src/main/kotlin/com/simplemobiletools/keyboard/views/MyKeyboardView.kt @@ -1390,12 +1390,15 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut } showPreview(NOT_A_KEY) Arrays.fill(mKeyIndices, NOT_A_KEY) + + val currentKeyCode = mKeys.getOrNull(mCurrentKey)?.code + // If we're not on a repeating key (which sends on a DOWN event) if (mRepeatKeyIndex == NOT_A_KEY && !mMiniKeyboardOnScreen && !mAbortKey) { detectAndSendKey(mCurrentKey, touchX, touchY, eventTime) } - if (mKeys.getOrNull(mCurrentKey)?.code == KEYCODE_SPACE && !mIsLongPressingSpace) { + if (currentKeyCode == KEYCODE_SPACE && !mIsLongPressingSpace) { detectAndSendKey(mCurrentKey, touchX, touchY, eventTime) } From d3729565400efe489f2ddf74701fbdb3111fb064 Mon Sep 17 00:00:00 2001 From: merkost Date: Tue, 13 Jun 2023 14:19:46 +1000 Subject: [PATCH 3/3] Improved if statements for detectAndSendKey --- .../com/simplemobiletools/keyboard/views/MyKeyboardView.kt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/keyboard/views/MyKeyboardView.kt b/app/src/main/kotlin/com/simplemobiletools/keyboard/views/MyKeyboardView.kt index 9525d3a..7951cbf 100644 --- a/app/src/main/kotlin/com/simplemobiletools/keyboard/views/MyKeyboardView.kt +++ b/app/src/main/kotlin/com/simplemobiletools/keyboard/views/MyKeyboardView.kt @@ -1396,9 +1396,7 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut // If we're not on a repeating key (which sends on a DOWN event) if (mRepeatKeyIndex == NOT_A_KEY && !mMiniKeyboardOnScreen && !mAbortKey) { detectAndSendKey(mCurrentKey, touchX, touchY, eventTime) - } - - if (currentKeyCode == KEYCODE_SPACE && !mIsLongPressingSpace) { + } else if (currentKeyCode == KEYCODE_SPACE && !mIsLongPressingSpace) { detectAndSendKey(mCurrentKey, touchX, touchY, eventTime) }