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,12 +255,28 @@ fun createCacheTransform(): CacheTransform {
|
|||
}
|
||||
}
|
||||
}
|
||||
var vidCacheNode: AccessibilityNodeInfo? = null
|
||||
var vidCacheValue: CharSequence? = null
|
||||
val transform = Transform(
|
||||
getAttr = { node, name ->
|
||||
if (name == "index") {
|
||||
node.getIndexX()
|
||||
} else {
|
||||
getAttr(node, name)
|
||||
when (name) {
|
||||
"vid" -> {
|
||||
if (node === vidCacheNode) {
|
||||
vidCacheValue
|
||||
} else {
|
||||
vidCacheNode = node
|
||||
vidCacheValue = node.getVid()
|
||||
vidCacheValue
|
||||
}
|
||||
}
|
||||
|
||||
"index" -> {
|
||||
node.getIndexX()
|
||||
}
|
||||
|
||||
else -> {
|
||||
getAttr(node, name)
|
||||
}
|
||||
}
|
||||
},
|
||||
getName = { node -> node.className },
|
||||
|
|
Loading…
Reference in New Issue
Block a user