From 99660b4788be814b7b2b033b6eecb6c100f72985 Mon Sep 17 00:00:00 2001 From: gallonyin Date: Sat, 17 Dec 2022 20:18:30 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E5=85=BC=E5=AE=B9=E5=BA=95=E9=83=A84t?= =?UTF-8?q?ab?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/org/yameida/worktool/service/GlobalMethod.kt | 11 ++++++++--- .../org/yameida/worktool/service/WeworkLoopImpl.kt | 6 ++++-- 2 files changed, 12 insertions(+), 5 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 0fc11d0..07e2a00 100644 --- a/app/src/main/java/org/yameida/worktool/service/GlobalMethod.kt +++ b/app/src/main/java/org/yameida/worktool/service/GlobalMethod.kt @@ -34,7 +34,8 @@ fun goHomeTab(title: String): Boolean { while (!atHome) { val list = AccessibilityUtil.findAllOnceByText(getRoot(), "消息", exact = true) for (item in list) { - if (item.parent?.parent?.parent?.childCount == 5) { + val childCount = item.parent?.parent?.parent?.childCount + if (childCount == 4 || childCount == 5) { //处理侧边栏抽屉打开 if (title == "消息") { val rect = Rect() @@ -46,7 +47,8 @@ fun goHomeTab(title: String): Boolean { atHome = true val tempList = AccessibilityUtil.findAllOnceByText(getRoot(), title, exact = true) for (tempItem in tempList) { - if (tempItem.parent?.parent?.parent?.childCount == 5) { + val tempChildCount = tempItem.parent?.parent?.parent?.childCount + if (tempChildCount == 4 || tempChildCount == 5) { AccessibilityUtil.performClick(tempItem) sleep(300) find = true @@ -74,7 +76,10 @@ fun goHomeTab(title: String): Boolean { */ fun isAtHome(): Boolean { val list = AccessibilityUtil.findAllOnceByText(getRoot(), "消息", exact = true) - return list.count { it.parent?.parent?.parent?.childCount == 5 } > 0 + return list.count { + val childCount = it.parent?.parent?.parent?.childCount + childCount == 4 || childCount == 5 + } > 0 } /** diff --git a/app/src/main/java/org/yameida/worktool/service/WeworkLoopImpl.kt b/app/src/main/java/org/yameida/worktool/service/WeworkLoopImpl.kt index f52703f..edc581f 100644 --- a/app/src/main/java/org/yameida/worktool/service/WeworkLoopImpl.kt +++ b/app/src/main/java/org/yameida/worktool/service/WeworkLoopImpl.kt @@ -51,7 +51,8 @@ object WeworkLoopImpl { fun getFriendRequest(): Boolean { val list = AccessibilityUtil.findAllOnceByText(getRoot(), "通讯录", exact = true) for (item in list) { - if (item.parent?.parent?.parent?.childCount == 5) { + val childCount = item.parent?.parent?.parent?.childCount + if (childCount == 4 || childCount == 5) { if (item.parent != null && item.parent.childCount > 1) { LogUtils.d("通讯录有红点") AccessibilityUtil.performClick(item) @@ -228,7 +229,8 @@ object WeworkLoopImpl { val list = AccessibilityUtil.findAllOnceByText(getRoot(), "消息", exact = true) for (item in list) { - if (item.parent?.parent?.parent?.childCount == 5) { + val childCount = item.parent?.parent?.parent?.childCount + if (childCount == 4 || childCount == 5) { if (item.parent != null && item.parent.childCount > 1) { LogUtils.d("消息有红点") AccessibilityUtil.clickByNode(WeworkController.weworkService, item)