fix: prevent unnecessary key invalidation when keyboard mode change.
This commit is contained in:
parent
acb82a5caa
commit
3972a917b8
|
@ -138,6 +138,7 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut
|
||||||
private var mLastKey = 0
|
private var mLastKey = 0
|
||||||
private var mLastCodeX = 0
|
private var mLastCodeX = 0
|
||||||
private var mLastCodeY = 0
|
private var mLastCodeY = 0
|
||||||
|
private var mLastKeyPressedCode = 0
|
||||||
private var mCurrentKey: Int = NOT_A_KEY
|
private var mCurrentKey: Int = NOT_A_KEY
|
||||||
private var mLastKeyTime = 0L
|
private var mLastKeyTime = 0L
|
||||||
private var mCurrentKeyTime = 0L
|
private var mCurrentKeyTime = 0L
|
||||||
|
@ -1281,8 +1282,8 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut
|
||||||
} else {
|
} else {
|
||||||
0
|
0
|
||||||
}
|
}
|
||||||
|
|
||||||
mOnKeyboardActionListener!!.onPress(onPressKey)
|
mOnKeyboardActionListener!!.onPress(onPressKey)
|
||||||
|
mLastKeyPressedCode = onPressKey
|
||||||
|
|
||||||
var wasHandled = false
|
var wasHandled = false
|
||||||
if (mCurrentKey >= 0 && mKeys[mCurrentKey].repeatable) {
|
if (mCurrentKey >= 0 && mKeys[mCurrentKey].repeatable) {
|
||||||
|
@ -1396,7 +1397,9 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut
|
||||||
detectAndSendKey(mCurrentKey, touchX, touchY, eventTime)
|
detectAndSendKey(mCurrentKey, touchX, touchY, eventTime)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mLastKeyPressedCode != KEYCODE_MODE_CHANGE) {
|
||||||
invalidateKey(keyIndex)
|
invalidateKey(keyIndex)
|
||||||
|
}
|
||||||
mRepeatKeyIndex = NOT_A_KEY
|
mRepeatKeyIndex = NOT_A_KEY
|
||||||
mOnKeyboardActionListener!!.onActionUp()
|
mOnKeyboardActionListener!!.onActionUp()
|
||||||
mIsLongPressingSpace = false
|
mIsLongPressingSpace = false
|
||||||
|
|
Loading…
Reference in New Issue