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

View File

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