Skip to content

Commit 44d913b

Browse files
authored
Merge pull request #189 from Merkost/scandinavian_fix
Keyboard change layout button fix
2 parents c8a449b + d372956 commit 44d913b

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

app/src/main/kotlin/com/simplemobiletools/keyboard/views/MyKeyboardView.kt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1079,8 +1079,8 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut
10791079

10801080
// fix a glitch with long pressing backspace, then clicking some letter
10811081
if (mRepeatKeyIndex != NOT_A_KEY) {
1082-
val key = mKeys[mRepeatKeyIndex]
1083-
if (key.code == KEYCODE_DELETE) {
1082+
val key = mKeys.getOrNull(mRepeatKeyIndex)
1083+
if (key?.code == KEYCODE_DELETE) {
10841084
mHandler?.removeMessages(MSG_REPEAT)
10851085
mRepeatKeyIndex = NOT_A_KEY
10861086
}
@@ -1315,12 +1315,13 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut
13151315
}
13161316
showPreview(NOT_A_KEY)
13171317
Arrays.fill(mKeyIndices, NOT_A_KEY)
1318+
1319+
val currentKeyCode = mKeys.getOrNull(mCurrentKey)?.code
1320+
13181321
// If we're not on a repeating key (which sends on a DOWN event)
13191322
if (mRepeatKeyIndex == NOT_A_KEY && !mMiniKeyboardOnScreen && !mAbortKey) {
13201323
detectAndSendKey(mCurrentKey, touchX, touchY, eventTime)
1321-
}
1322-
1323-
if (mKeys.getOrNull(mCurrentKey)?.code == KEYCODE_SPACE && !mIsLongPressingSpace) {
1324+
} else if (currentKeyCode == KEYCODE_SPACE && !mIsLongPressingSpace) {
13241325
detectAndSendKey(mCurrentKey, touchX, touchY, eventTime)
13251326
}
13261327

0 commit comments

Comments
 (0)