From e5a9ed679f0496769e363ef4117f5ab601aecd2d Mon Sep 17 00:00:00 2001 From: gallonyin Date: Mon, 18 Sep 2023 23:14:13 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E4=BC=98=E5=8C=96=E6=88=BF=E9=97=B4?= =?UTF-8?q?=E5=90=8D=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/yameida/worktool/utils/WeworkRoomUtil.kt | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/org/yameida/worktool/utils/WeworkRoomUtil.kt b/app/src/main/java/org/yameida/worktool/utils/WeworkRoomUtil.kt index bd97a18..20882ed 100644 --- a/app/src/main/java/org/yameida/worktool/utils/WeworkRoomUtil.kt +++ b/app/src/main/java/org/yameida/worktool/utils/WeworkRoomUtil.kt @@ -134,7 +134,7 @@ object WeworkRoomUtil { intoRoomPreInit() AccessibilityUtil.performClick(searchItem) val text = AccessibilityUtil.findAllOnceByClazz(searchItem.parent, Views.TextView).firstOrNull { it.text != null && !it.text.isNullOrBlank() } - val title = text?.toString() ?: title + val title = text?.text?.toString() ?: title LogUtils.d("进入房间: $title") AccessibilityUtil.waitForPageMissing("WwMainActivity", "GlobalSearchActivity") sleep(Constant.CHANGE_PAGE_INTERVAL) @@ -274,13 +274,14 @@ object WeworkRoomUtil { private fun checkRoom(title: String, strict: Boolean = false): Boolean { LogUtils.d("checkRoom(): $title") val titleList = getRoomTitle(print = false) + if (titleList.isEmpty()) { + return false + } val roomType = getRoomType() + val dealTitle = title.replace("…", "").replace("\\(.*?\\)".toRegex(), "") if (roomType != WeworkMessageBean.ROOM_TYPE_UNKNOWN - && (titleList.count { - it.replace("…", "").replace("\\(.*?\\)".toRegex(), "") == title.replace("…", "") - .replace("\\(.*?\\)".toRegex(), "") - } > 0 - || (!strict && titleList.count { title.contains(it.replace("…", "").replace("\\(.*?\\)".toRegex(), "")) } > 0)) + && (titleList.count { dealTitle == it.replace("…", "").replace("\\(.*?\\)".toRegex(), "") } > 0 + || (!strict && titleList.count { dealTitle.contains(it.replace("…", "").replace("\\(.*?\\)".toRegex(), "")) } > 0)) ) { intoRoomPreInit() LogUtils.d("当前正在房间")