mirror of
https://github.com/gkd-kit/gkd.git
synced 2024-11-16 03:32:38 +08:00
perf: cache vid
This commit is contained in:
parent
3a8fa8583d
commit
8169624e39
|
@ -255,13 +255,29 @@ fun createCacheTransform(): CacheTransform {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
var vidCacheNode: AccessibilityNodeInfo? = null
|
||||||
|
var vidCacheValue: CharSequence? = null
|
||||||
val transform = Transform(
|
val transform = Transform(
|
||||||
getAttr = { node, name ->
|
getAttr = { node, name ->
|
||||||
if (name == "index") {
|
when (name) {
|
||||||
node.getIndexX()
|
"vid" -> {
|
||||||
|
if (node === vidCacheNode) {
|
||||||
|
vidCacheValue
|
||||||
} else {
|
} else {
|
||||||
|
vidCacheNode = node
|
||||||
|
vidCacheValue = node.getVid()
|
||||||
|
vidCacheValue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
"index" -> {
|
||||||
|
node.getIndexX()
|
||||||
|
}
|
||||||
|
|
||||||
|
else -> {
|
||||||
getAttr(node, name)
|
getAttr(node, name)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
getName = { node -> node.className },
|
getName = { node -> node.className },
|
||||||
getChildren = getChildrenCache,
|
getChildren = getChildrenCache,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user