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,11 +854,9 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut
mPopupPreviewY += popupHeight mPopupPreviewY += popupHeight
} }
if (key.label.isNotEmpty()) {
if (previewPopup.isShowing) { if (previewPopup.isShowing) {
previewPopup.update( previewPopup.update(mPopupPreviewX, mPopupPreviewY, popupWidth, popupHeight)
mPopupPreviewX, mPopupPreviewY,
popupWidth, popupHeight
)
} else { } else {
previewPopup.width = popupWidth previewPopup.width = popupWidth
previewPopup.height = popupHeight previewPopup.height = popupHeight
@ -875,6 +864,7 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut
} }
mPreviewText!!.visibility = VISIBLE mPreviewText!!.visibility = VISIBLE
} }
}
private fun sendAccessibilityEventForUnicodeCharacter(eventType: Int, code: Int) { private fun sendAccessibilityEventForUnicodeCharacter(eventType: Int, code: Int) {
if (mAccessibilityManager.isEnabled) { if (mAccessibilityManager.isEnabled) {

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"