From 0c1a13c3922ca583ea55b2d76dbe436f90b10d68 Mon Sep 17 00:00:00 2001 From: lisonge Date: Wed, 31 Jan 2024 21:48:16 +0800 Subject: [PATCH] perf: click --- .../kotlin/li/songe/gkd/data/GkdAction.kt | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/li/songe/gkd/data/GkdAction.kt b/app/src/main/kotlin/li/songe/gkd/data/GkdAction.kt index b73c64a..c483e03 100644 --- a/app/src/main/kotlin/li/songe/gkd/data/GkdAction.kt +++ b/app/src/main/kotlin/li/songe/gkd/data/GkdAction.kt @@ -57,7 +57,16 @@ val clickCenter: ActionFc = { context, node -> } val click: ActionFc = { context, node -> - if (node.isClickable) clickNode(context, node) else clickCenter(context, node) + if (node.isClickable) { + val result = clickNode(context, node) + if (result.result) { + result + } else { + clickCenter(context, node) + } + } else { + clickCenter(context, node) + } } val longClickNode: ActionFc = { _, node -> @@ -96,7 +105,16 @@ val longClickCenter: ActionFc = { context, node -> val longClick: ActionFc = { context, node -> - if (node.isLongClickable) longClickNode(context, node) else longClickCenter(context, node) + if (node.isLongClickable) { + val result = longClickNode(context, node) + if (result.result) { + result + } else { + longClickCenter(context, node) + } + } else { + longClickCenter(context, node) + } } val backFc: ActionFc = { context, _ ->