update 优化控件识别
This commit is contained in:
@@ -373,7 +373,7 @@ object WeworkGetImpl {
|
||||
}
|
||||
}
|
||||
if (saveAddress) {
|
||||
val tvAddressFlag = AccessibilityUtil.scrollAndFindByText(WeworkController.weworkService, getRoot(), "保存到通讯录")
|
||||
val tvAddressFlag = AccessibilityUtil.scrollAndFindByText(WeworkController.weworkService, getRoot(), "保存到通讯录", exact = true)
|
||||
val tvAddress = AccessibilityUtil.findBackNode(tvAddressFlag, minChildCount = 1)
|
||||
val addressDesc = AccessibilityUtil.findOnceByDesc(tvAddress, "false", "true", exact = true)
|
||||
if (addressDesc?.contentDescription == "false") {
|
||||
|
||||
@@ -403,7 +403,7 @@ object WeworkOperationImpl {
|
||||
): Boolean {
|
||||
val startTime = System.currentTimeMillis()
|
||||
goHomeTab("工作台")
|
||||
val node = AccessibilityUtil.scrollAndFindByText(WeworkController.weworkService, getRoot(), "微盘")
|
||||
val node = AccessibilityUtil.scrollAndFindByText(WeworkController.weworkService, getRoot(), "微盘", exact = true)
|
||||
if (node != null) {
|
||||
AccessibilityUtil.performClick(node)
|
||||
sleep(Constant.POP_WINDOW_INTERVAL)
|
||||
@@ -478,7 +478,7 @@ object WeworkOperationImpl {
|
||||
): Boolean {
|
||||
val startTime = System.currentTimeMillis()
|
||||
goHomeTab("工作台")
|
||||
val node = AccessibilityUtil.scrollAndFindByText(WeworkController.weworkService, getRoot(), "微盘")
|
||||
val node = AccessibilityUtil.scrollAndFindByText(WeworkController.weworkService, getRoot(), "微盘", exact = true)
|
||||
if (node != null) {
|
||||
AccessibilityUtil.performClick(node)
|
||||
sleep(Constant.POP_WINDOW_INTERVAL)
|
||||
@@ -1565,7 +1565,7 @@ object WeworkOperationImpl {
|
||||
fun clockIn(message: WeworkMessageBean): Boolean {
|
||||
val startTime = System.currentTimeMillis()
|
||||
goHomeTab("工作台")
|
||||
val node = AccessibilityUtil.scrollAndFindByText(WeworkController.weworkService, getRoot(), "打卡")
|
||||
val node = AccessibilityUtil.scrollAndFindByText(WeworkController.weworkService, getRoot(), "打卡", exact = true)
|
||||
if (node != null) {
|
||||
AccessibilityUtil.performClick(node)
|
||||
sleep(Constant.POP_WINDOW_INTERVAL)
|
||||
@@ -1761,7 +1761,7 @@ object WeworkOperationImpl {
|
||||
*/
|
||||
private fun createGroup(): Boolean {
|
||||
goHomeTab("工作台")
|
||||
val node = AccessibilityUtil.scrollAndFindByText(WeworkController.weworkService, getRoot(), "客户群", "居民群", "学员群")
|
||||
val node = AccessibilityUtil.scrollAndFindByText(WeworkController.weworkService, getRoot(), "客户群", "居民群", "学员群", exact = true)
|
||||
if (node != null) {
|
||||
AccessibilityUtil.performClick(node)
|
||||
sleep(Constant.POP_WINDOW_INTERVAL)
|
||||
|
||||
@@ -259,16 +259,17 @@ object AccessibilityUtil {
|
||||
service: AccessibilityService,
|
||||
nodeInfo: AccessibilityNodeInfo,
|
||||
vararg textList: String,
|
||||
exact: Boolean = false,
|
||||
maxRetry: Int = 3
|
||||
): AccessibilityNodeInfo? {
|
||||
val node = findOnceByText(nodeInfo, *textList)
|
||||
val node = findOnceByText(nodeInfo, *textList, exact = exact)
|
||||
if (node != null) {
|
||||
return node
|
||||
}
|
||||
var index = 0
|
||||
while (index++ < maxRetry) {
|
||||
performScrollDown(nodeInfo, 0)
|
||||
val node = findOnceByText(nodeInfo, *textList)
|
||||
val node = findOnceByText(nodeInfo, *textList, exact = exact)
|
||||
if (node != null) {
|
||||
return node
|
||||
}
|
||||
@@ -276,7 +277,7 @@ object AccessibilityUtil {
|
||||
index = 0
|
||||
while (index++ < maxRetry * 2) {
|
||||
performScrollUp(nodeInfo, 0)
|
||||
val node = findOnceByText(nodeInfo, *textList)
|
||||
val node = findOnceByText(nodeInfo, *textList, exact = exact)
|
||||
if (node != null) {
|
||||
return node
|
||||
}
|
||||
@@ -288,7 +289,7 @@ object AccessibilityUtil {
|
||||
index = 0
|
||||
while (index++ < maxRetry * 2) {
|
||||
scrollByXY(service, width / 2, (height / 2.2).toInt(), 0, -height / 3)
|
||||
val node = findOnceByText(nodeInfo, *textList)
|
||||
val node = findOnceByText(nodeInfo, *textList, exact = exact)
|
||||
if (node != null) {
|
||||
return node
|
||||
}
|
||||
@@ -296,7 +297,7 @@ object AccessibilityUtil {
|
||||
index = 0
|
||||
while (index++ < maxRetry * 3) {
|
||||
scrollByXY(service, width / 2, (height / 2.2).toInt(), 0, height / 3)
|
||||
val node = findOnceByText(nodeInfo, *textList)
|
||||
val node = findOnceByText(nodeInfo, *textList, exact = exact)
|
||||
if (node != null) {
|
||||
return node
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user