mirror of
https://github.com/SimpleMobileTools/Simple-Keyboard.git
synced 2025-06-05 21:49:26 +02:00
improving the UX related to long pressing space
This commit is contained in:
@ -1140,7 +1140,7 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut
|
|||||||
mHandler!!.sendMessageDelayed(msg, REPEAT_START_DELAY.toLong())
|
mHandler!!.sendMessageDelayed(msg, REPEAT_START_DELAY.toLong())
|
||||||
// if the user long presses Space, move the cursor after swipine left/right
|
// if the user long presses Space, move the cursor after swipine left/right
|
||||||
if (mKeys[mCurrentKey].codes.firstOrNull() == MyKeyboard.KEYCODE_SPACE) {
|
if (mKeys[mCurrentKey].codes.firstOrNull() == MyKeyboard.KEYCODE_SPACE) {
|
||||||
mLastSpaceMoveX = touchX
|
mLastSpaceMoveX = -1
|
||||||
} else {
|
} else {
|
||||||
repeatKey(true)
|
repeatKey(true)
|
||||||
}
|
}
|
||||||
@ -1181,6 +1181,10 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (mIsLongPressingSpace) {
|
if (mIsLongPressingSpace) {
|
||||||
|
if (mLastSpaceMoveX == -1) {
|
||||||
|
mLastSpaceMoveX = mLastX
|
||||||
|
}
|
||||||
|
|
||||||
val diff = mLastX - mLastSpaceMoveX
|
val diff = mLastX - mLastSpaceMoveX
|
||||||
|
|
||||||
if (diff < -mSpaceMoveThreshold) {
|
if (diff < -mSpaceMoveThreshold) {
|
||||||
|
Reference in New Issue
Block a user