From 097a9173499208484617e3fcf4a2a8f14a8bc0c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=B9=E7=94=B2=E4=BB=91?= Date: Mon, 6 Jun 2022 14:10:41 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E4=BC=98=E5=8C=96=E5=90=8E=E9=80=80?= =?UTF-8?q?=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/yameida/worktool/service/GlobalMethod.kt | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/org/yameida/worktool/service/GlobalMethod.kt b/app/src/main/java/org/yameida/worktool/service/GlobalMethod.kt index e1dee01..f253c17 100644 --- a/app/src/main/java/org/yameida/worktool/service/GlobalMethod.kt +++ b/app/src/main/java/org/yameida/worktool/service/GlobalMethod.kt @@ -107,9 +107,8 @@ fun getRoot(ignoreCheck: Boolean): AccessibilityNodeInfo { */ fun backPress() { val textView = AccessibilityUtil.findOneByClazz(getRoot(), Views.TextView) - if (textView != null && textView.text.isNullOrBlank()) { - LogUtils.d("找到回退按钮") - AccessibilityUtil.performClick(textView) + if (textView != null && textView.text.isNullOrBlank() && AccessibilityUtil.performClick(textView)) { + LogUtils.v("找到回退按钮") } else { val ivButton = AccessibilityUtil.findOneByClazz(getRoot(), Views.ImageView) if (ivButton != null && ivButton.isClickable && AccessibilityUtil.findFrontNode(ivButton) == null) { @@ -120,8 +119,13 @@ fun backPress() { val button = AccessibilityUtil.findOneByClazz(getRoot(), Views.Button) if (button != null && button.childCount > 0) { AccessibilityUtil.performClick(button.getChild(0)) - } else { + } else if (button != null) { AccessibilityUtil.performClick(button) + } else { + LogUtils.d("未找到BT按钮") + if (AccessibilityUtil.findTextAndClick(getRoot(), "确定")) { + LogUtils.d("尝试点击确定") + } } } }