mirror of
https://github.com/gkd-kit/gkd.git
synced 2024-11-15 19:22:26 +08:00
This commit is contained in:
parent
c8a1e00077
commit
0da83e36aa
|
@ -76,6 +76,7 @@ class A11yService : AccessibilityService(), OnCreate, OnA11yConnected, OnA11yEve
|
|||
onA11yConnected()
|
||||
}
|
||||
|
||||
override val a11yEventCallbacks = mutableListOf<(AccessibilityEvent) -> Unit>()
|
||||
override fun onAccessibilityEvent(event: AccessibilityEvent?) {
|
||||
if (event == null || !event.isUseful()) return
|
||||
onA11yEvent(event)
|
||||
|
|
|
@ -43,12 +43,15 @@ interface OnDestroy : CanOnCallback {
|
|||
}
|
||||
|
||||
interface OnA11yEvent : CanOnCallback {
|
||||
val a11yEventCallbacks: MutableList<(AccessibilityEvent) -> Unit>
|
||||
get() = getCallbacks(6)
|
||||
|
||||
fun onA11yEvent(f: (AccessibilityEvent) -> Unit) {
|
||||
getCallbacks<(AccessibilityEvent) -> Unit>(6).add(f)
|
||||
a11yEventCallbacks.add(f)
|
||||
}
|
||||
|
||||
fun onA11yEvent(event: AccessibilityEvent) {
|
||||
getCallbacks<(AccessibilityEvent) -> Unit>(6).forEach { it(event) }
|
||||
a11yEventCallbacks.forEach { it(event) }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user