update 等待进入页面
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
package org.yameida.worktool.utils
|
||||
|
||||
import android.util.Log
|
||||
import java.lang.Thread.sleep
|
||||
import org.yameida.worktool.service.WeworkController
|
||||
|
||||
|
||||
/**
|
||||
* 无障碍服务扩展类
|
||||
* 注意:操作均为阻塞式,原则上本工具类所有操作都应在子线程执行
|
||||
*/
|
||||
object AccessibilityExtraUtil {
|
||||
private const val tag = "AccessibilityExtraUtil"
|
||||
private const val SHORT_INTERVAL = 150L
|
||||
private const val SCROLL_INTERVAL_NATIVE = 500L
|
||||
private const val SCROLL_INTERVAL = 800L
|
||||
|
||||
/**
|
||||
* 等待进入页面
|
||||
* @param clazz 页面Class
|
||||
* @param timeout 检查超时时间
|
||||
*/
|
||||
fun loadingPage(
|
||||
clazz: String,
|
||||
timeout: Long = 5000
|
||||
): Boolean {
|
||||
val service = WeworkController.weworkService
|
||||
val startTime = System.currentTimeMillis()
|
||||
var currentTime = startTime
|
||||
while (currentTime - startTime <= timeout) {
|
||||
if (service.currentClass == clazz) {
|
||||
Log.v(tag, "loadingPage: $clazz")
|
||||
return true
|
||||
}
|
||||
sleep(SHORT_INTERVAL)
|
||||
currentTime = System.currentTimeMillis()
|
||||
}
|
||||
Log.e(tag, "loadingPage: not found: $clazz current: ${service.currentClass}")
|
||||
return false
|
||||
}
|
||||
|
||||
}
|
||||
@@ -106,7 +106,7 @@ object FloatWindowHelper {
|
||||
.append("\n")
|
||||
.append(WeworkController.weworkService.currentClass)
|
||||
newFile.writeBytes(printNodeClazzTree.toString().toByteArray())
|
||||
LogUtils.i("打印节点文件存储本地成功 $filePath")
|
||||
LogUtils.i("打印节点文件存储本地成功 $filePath", "当前页面: ${WeworkController.weworkService.currentClass}")
|
||||
}
|
||||
ShareUtil.share("*", newFile)
|
||||
}
|
||||
|
||||
@@ -112,7 +112,10 @@ object WeworkRoomUtil {
|
||||
val needTrim = title.contains(Constant.regTrimTitle)
|
||||
val trimTitle = title.replace(Constant.regTrimTitle, "")
|
||||
AccessibilityUtil.findTextInput(getRoot(), trimTitle)
|
||||
sleep(Constant.CHANGE_PAGE_INTERVAL)
|
||||
if (!AccessibilityExtraUtil.loadingPage("com.tencent.wework.contact.controller.GlobalSearchActivity")) {
|
||||
LogUtils.e("未找到搜索页")
|
||||
return false
|
||||
}
|
||||
//消息页搜索结果列表
|
||||
val selectListView = findOneByClazz(getRoot(), Views.ListView)
|
||||
val reverseRegexTitle = RegexHelper.reverseRegexTitle(trimTitle)
|
||||
|
||||
Reference in New Issue
Block a user