do not show the popup preview at caps lock, space, clear and enter

This commit is contained in:
tibbi 2022-01-09 13:34:19 +01:00
parent 12a83947a5
commit 5f22eaf00c
2 changed files with 12 additions and 23 deletions

View File

@ -742,14 +742,8 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut
oldKey.onReleased(mCurrentKeyIndex == NOT_A_KEY)
invalidateKey(oldKeyIndex)
val keyCode = oldKey.codes[0]
sendAccessibilityEventForUnicodeCharacter(
AccessibilityEvent.TYPE_VIEW_HOVER_EXIT,
keyCode
)
// TODO: We need to implement AccessibilityNodeProvider for this view.
sendAccessibilityEventForUnicodeCharacter(
AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED, keyCode
)
sendAccessibilityEventForUnicodeCharacter(AccessibilityEvent.TYPE_VIEW_HOVER_EXIT, keyCode)
sendAccessibilityEventForUnicodeCharacter(AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED, keyCode)
}
if (mCurrentKeyIndex != NOT_A_KEY && keys.size > mCurrentKeyIndex) {
@ -758,10 +752,7 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut
invalidateKey(mCurrentKeyIndex)
val keyCode = newKey.codes[0]
sendAccessibilityEventForUnicodeCharacter(AccessibilityEvent.TYPE_VIEW_HOVER_ENTER, keyCode)
// TODO: We need to implement AccessibilityNodeProvider for this view.
sendAccessibilityEventForUnicodeCharacter(
AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUSED, keyCode
)
sendAccessibilityEventForUnicodeCharacter(AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUSED, keyCode)
}
}
@ -863,17 +854,16 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut
mPopupPreviewY += popupHeight
}
if (previewPopup.isShowing) {
previewPopup.update(
mPopupPreviewX, mPopupPreviewY,
popupWidth, popupHeight
)
} else {
previewPopup.width = popupWidth
previewPopup.height = popupHeight
previewPopup.showAtLocation(mPopupParent, Gravity.NO_GRAVITY, mPopupPreviewX, mPopupPreviewY)
if (key.label.isNotEmpty()) {
if (previewPopup.isShowing) {
previewPopup.update(mPopupPreviewX, mPopupPreviewY, popupWidth, popupHeight)
} else {
previewPopup.width = popupWidth
previewPopup.height = popupHeight
previewPopup.showAtLocation(mPopupParent, Gravity.NO_GRAVITY, mPopupPreviewX, mPopupPreviewY)
}
mPreviewText!!.visibility = VISIBLE
}
mPreviewText!!.visibility = VISIBLE
}
private fun sendAccessibilityEventForUnicodeCharacter(eventType: Int, code: Int) {

View File

@ -115,7 +115,6 @@
app:codes="32"
app:iconPreview="@null"
app:isRepeatable="true"
app:keyLabel=""
app:keyWidth="60%p" />
<Key
app:codes="46"