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