Fixed a bug when some keyboard's change layout button doesn't work as expected

This commit is contained in:
merkost 2023-06-09 12:22:38 +10:00
parent 09bc110eb6
commit 56d3ff4b85
1 changed files with 4 additions and 1 deletions

View File

@ -1390,12 +1390,15 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut
} }
showPreview(NOT_A_KEY) showPreview(NOT_A_KEY)
Arrays.fill(mKeyIndices, 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 we're not on a repeating key (which sends on a DOWN event)
if (mRepeatKeyIndex == NOT_A_KEY && !mMiniKeyboardOnScreen && !mAbortKey) { if (mRepeatKeyIndex == NOT_A_KEY && !mMiniKeyboardOnScreen && !mAbortKey) {
detectAndSendKey(mCurrentKey, touchX, touchY, eventTime) detectAndSendKey(mCurrentKey, touchX, touchY, eventTime)
} }
if (mKeys.getOrNull(mCurrentKey)?.code == KEYCODE_SPACE && !mIsLongPressingSpace) { if (currentKeyCode == KEYCODE_SPACE && !mIsLongPressingSpace) {
detectAndSendKey(mCurrentKey, touchX, touchY, eventTime) detectAndSendKey(mCurrentKey, touchX, touchY, eventTime)
} }