update 优化at
This commit is contained in:
@@ -1574,38 +1574,33 @@ object WeworkOperationImpl {
|
|||||||
AccessibilityUtil.findOnceByClazz(getRoot(), Views.EditText), "@"
|
AccessibilityUtil.findOnceByClazz(getRoot(), Views.EditText), "@"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
val atFlag = AccessibilityUtil.findOneByText(getRoot(), "选择提醒的人", timeout = 2000, exact = true)
|
val atFlag = AccessibilityUtil.findOneByText(getRoot(), "选择提醒的人", exact = true)
|
||||||
if (atFlag != null) {
|
if (atFlag != null) {
|
||||||
val rv = AccessibilityUtil.findOneByClazz(getRoot(), Views.RecyclerView)
|
val searchFlag = AccessibilityUtil.findOneByText(getRoot(), "搜索", exact = true)
|
||||||
if (rv != null) {
|
val container = AccessibilityUtil.findBackNode(searchFlag, minChildCount = 2)?.parent
|
||||||
AccessibilityUtil.findTextInput(getRoot(), at.replace("\\(.*?\\)".toRegex(), ""))
|
if (container != null) {
|
||||||
val atNode =
|
val atNode = AccessibilityUtil.findOnceByTextRegex(container, "${RegexHelper.reverseRegexTitle(at)}(@.*)?")
|
||||||
AccessibilityUtil.findOneByText(rv, at.replace("\\(.*?\\)".toRegex(), ""), root = false, timeout = 2000)
|
|
||||||
if (atNode != null) {
|
if (atNode != null) {
|
||||||
AccessibilityUtil.performClick(atNode)
|
AccessibilityUtil.performClick(atNode)
|
||||||
|
} else {
|
||||||
|
AccessibilityUtil.findTextInput(getRoot(), at)
|
||||||
|
val atNodeList = AccessibilityUtil.findAllByTextRegex(container, "${RegexHelper.reverseRegexTitle(at)}(@.*)?", root = false, minSize = 2)
|
||||||
|
if (atNodeList.size > 1 && at != "@所有人") {
|
||||||
|
AccessibilityUtil.performClick(atNodeList[1])
|
||||||
} else {
|
} else {
|
||||||
LogUtils.e("未找到at人: $at")
|
LogUtils.e("未找到at人: $at")
|
||||||
atFailed = true
|
atFailed = true
|
||||||
backPress()
|
backPress()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
sleep(Constant.POP_WINDOW_INTERVAL)
|
sleep(Constant.POP_WINDOW_INTERVAL)
|
||||||
} else {
|
} else {
|
||||||
val searchFlag = AccessibilityUtil.findOnceByText(getRoot(), "搜索", exact = true)
|
LogUtils.e("未找到搜索按钮和@列表")
|
||||||
val list = AccessibilityUtil.findBackNode(searchFlag, minChildCount = 2)
|
|
||||||
if (list != null) {
|
|
||||||
AccessibilityUtil.findTextInput(getRoot(), at.replace("\\(.*?\\)".toRegex(), ""))
|
|
||||||
val atNode =
|
|
||||||
AccessibilityUtil.findOneByText(list, at.replace("\\(.*?\\)".toRegex(), ""), root = false, timeout = 2000)
|
|
||||||
if (atNode != null) {
|
|
||||||
AccessibilityUtil.performClick(atNode)
|
|
||||||
} else {
|
|
||||||
LogUtils.e("未找到at人: $at")
|
|
||||||
atFailed = true
|
|
||||||
backPress()
|
backPress()
|
||||||
}
|
|
||||||
sleep(Constant.POP_WINDOW_INTERVAL)
|
sleep(Constant.POP_WINDOW_INTERVAL)
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
|
LogUtils.e("未找到选择提醒的人按钮")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -631,7 +631,7 @@ object AccessibilityUtil {
|
|||||||
timeout: Long = 5000,
|
timeout: Long = 5000,
|
||||||
root: Boolean = true,
|
root: Boolean = true,
|
||||||
minSize: Int = 1
|
minSize: Int = 1
|
||||||
): List<AccessibilityNodeInfo> {
|
): ArrayList<AccessibilityNodeInfo> {
|
||||||
var node = node ?: return arrayListOf()
|
var node = node ?: return arrayListOf()
|
||||||
val startTime = System.currentTimeMillis()
|
val startTime = System.currentTimeMillis()
|
||||||
var currentTime = startTime
|
var currentTime = startTime
|
||||||
@@ -692,7 +692,7 @@ object AccessibilityUtil {
|
|||||||
timeout: Long = 5000,
|
timeout: Long = 5000,
|
||||||
root: Boolean = true,
|
root: Boolean = true,
|
||||||
minSize: Int = 1
|
minSize: Int = 1
|
||||||
): List<AccessibilityNodeInfo> {
|
): ArrayList<AccessibilityNodeInfo> {
|
||||||
var node = node ?: return arrayListOf()
|
var node = node ?: return arrayListOf()
|
||||||
val startTime = System.currentTimeMillis()
|
val startTime = System.currentTimeMillis()
|
||||||
var currentTime = startTime
|
var currentTime = startTime
|
||||||
|
|||||||
Reference in New Issue
Block a user