update 兼容底部4tab

This commit is contained in:
gallonyin
2022-12-17 20:18:30 +08:00
parent 7f9d1abad6
commit 99660b4788
2 changed files with 12 additions and 5 deletions

View File

@@ -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
}
/**

View File

@@ -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)