fix 工作台优先使用click
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package org.yameida.worktool.service
|
||||
|
||||
import android.os.Build
|
||||
import android.view.accessibility.AccessibilityNodeInfo
|
||||
import org.yameida.worktool.Constant
|
||||
import org.yameida.worktool.model.WeworkMessageBean
|
||||
@@ -274,7 +275,11 @@ object WeworkOperationImpl {
|
||||
goHomeTab("工作台")
|
||||
val node = AccessibilityUtil.scrollAndFindByText(getRoot(), "微盘")
|
||||
if (node != null) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
AccessibilityUtil.clickByNode(WeworkController.weworkService, node)
|
||||
} else {
|
||||
AccessibilityUtil.performClick(node)
|
||||
}
|
||||
val buttonList = AccessibilityUtil.findAllByClazz(getRoot(), Views.Button)
|
||||
if (buttonList.size >= 4) {
|
||||
AccessibilityUtil.performClick(buttonList[2])
|
||||
@@ -316,7 +321,11 @@ object WeworkOperationImpl {
|
||||
goHomeTab("工作台")
|
||||
val node = AccessibilityUtil.scrollAndFindByText(getRoot(), "微盘")
|
||||
if (node != null) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
AccessibilityUtil.clickByNode(WeworkController.weworkService, node)
|
||||
} else {
|
||||
AccessibilityUtil.performClick(node)
|
||||
}
|
||||
val buttonList = AccessibilityUtil.findAllByClazz(getRoot(), Views.Button)
|
||||
if (buttonList.size >= 4) {
|
||||
AccessibilityUtil.performClick(buttonList[2])
|
||||
@@ -623,12 +632,14 @@ object WeworkOperationImpl {
|
||||
*/
|
||||
private fun createGroup(): Boolean {
|
||||
goHomeTab("工作台")
|
||||
val textViewGroup = AccessibilityUtil.scrollAndFindByText(getRoot(), "客户群", "居民群")
|
||||
if (AccessibilityUtil.performClick(textViewGroup)) {
|
||||
val groupTv = AccessibilityUtil.scrollAndFindByText(getRoot(), "客户群", "居民群")
|
||||
?: return false
|
||||
if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.N
|
||||
&& AccessibilityUtil.clickByNode(WeworkController.weworkService, groupTv))
|
||||
|| AccessibilityUtil.performClick(groupTv)) {
|
||||
LogUtils.d("进入客户群应用")
|
||||
val textView = AccessibilityUtil.findOneByText(getRoot(), "创建一个客户群", "创建一个居民群")
|
||||
AccessibilityUtil.performClick(textView)
|
||||
return true
|
||||
return AccessibilityUtil.performClick(textView)
|
||||
} else {
|
||||
LogUtils.d("未找到客户群应用")
|
||||
return false
|
||||
|
||||
@@ -381,7 +381,7 @@ object AccessibilityUtil {
|
||||
var currentTime = startTime
|
||||
while (currentTime - startTime <= timeout) {
|
||||
val result = findOnceByText(node, *textList, exact = exact)
|
||||
LogUtils.v("text: $textList result == null: ${result == null}")
|
||||
LogUtils.v("text: ${textList.joinToString()} result == null: ${result == null}")
|
||||
if (result != null) return result
|
||||
sleep(SHORT_INTERVAL)
|
||||
if (root) {
|
||||
@@ -391,7 +391,7 @@ object AccessibilityUtil {
|
||||
}
|
||||
currentTime = System.currentTimeMillis()
|
||||
}
|
||||
Log.e(tag, "findOneByText: not found: $textList")
|
||||
Log.e(tag, "findOneByText: not found: ${textList.joinToString()}")
|
||||
return null
|
||||
}
|
||||
|
||||
@@ -402,7 +402,7 @@ object AccessibilityUtil {
|
||||
): AccessibilityNodeInfo? {
|
||||
if (node == null) return null
|
||||
val textNodeList = findAllOnceByText(node, *textList, exact = exact)
|
||||
LogUtils.v("text: $textList count: " + textNodeList.size)
|
||||
LogUtils.v("text: ${textList.joinToString()} count: " + textNodeList.size)
|
||||
if (exact) return textNodeList[0]
|
||||
else if (textNodeList.size > 0) {
|
||||
for (textNode in textNodeList) {
|
||||
@@ -436,7 +436,7 @@ object AccessibilityUtil {
|
||||
var currentTime = startTime
|
||||
while (currentTime - startTime <= timeout) {
|
||||
val result = findAllOnceByText(node, *textList, exact = exact)
|
||||
LogUtils.v("text: $textList count: " + result.size)
|
||||
LogUtils.v("text: ${textList.joinToString()} count: " + result.size)
|
||||
if (result.size >= minSize) return result
|
||||
sleep(SHORT_INTERVAL)
|
||||
if (root) {
|
||||
@@ -446,7 +446,7 @@ object AccessibilityUtil {
|
||||
}
|
||||
currentTime = System.currentTimeMillis()
|
||||
}
|
||||
Log.e(tag, "findAllByText: not found: $textList")
|
||||
Log.e(tag, "findAllByText: not found: ${textList.joinToString()}")
|
||||
return arrayListOf()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user