Skip to content

Commit e0fa3fd

Browse files
committed
Ensure no multiple capital letters appear without using delay
This fixes the issue of capitalizing two letters when SHIFT is active, but it does not use delay. It instead always updates shift state right right after a key press, to ensure it is in the right state as soon as next key is typed. This removes the delay added in #210.
1 parent 25918d4 commit e0fa3fd

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

app/src/main/kotlin/com/simplemobiletools/keyboard/services/SimpleKeyboardIME.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -260,14 +260,13 @@ class SimpleKeyboardIME : InputMethodService(), OnKeyboardActionListener, Shared
260260
}
261261
}
262262
inputConnection.commitText(codeChar.toString(), 1)
263+
updateShiftKeyState()
263264
}
264265
}
265266

266267
else -> {
267268
inputConnection.commitText(codeChar.toString(), 1)
268-
if (originalText == null) {
269-
updateShiftKeyState()
270-
}
269+
updateShiftKeyState()
271270
}
272271
}
273272
}

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

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1218,14 +1218,12 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut
12181218
val secondKeyIndex = getPressedKeyIndex(newPointerX, newPointerY)
12191219
showPreview(secondKeyIndex)
12201220

1221-
mHandler!!.postDelayed({
1222-
detectAndSendKey(secondKeyIndex, newPointerX, newPointerY, eventTime)
1221+
detectAndSendKey(secondKeyIndex, newPointerX, newPointerY, eventTime)
12231222

1224-
val secondKeyCode = mKeys.getOrNull(secondKeyIndex)?.code
1225-
if (secondKeyCode != null) {
1226-
mOnKeyboardActionListener!!.onPress(secondKeyCode)
1227-
}
1228-
}, REPEAT_INTERVAL.toLong())
1223+
val secondKeyCode = mKeys.getOrNull(secondKeyIndex)?.code
1224+
if (secondKeyCode != null) {
1225+
mOnKeyboardActionListener!!.onPress(secondKeyCode)
1226+
}
12291227

12301228
showPreview(NOT_A_KEY)
12311229
invalidateKey(mCurrentKey)

0 commit comments

Comments
 (0)