fix getGroupInfo

This commit is contained in:
尹甲仑
2022-05-27 16:58:08 +08:00
parent 565dae2b6c
commit fd485a1a74
5 changed files with 14 additions and 7 deletions

View File

@@ -33,6 +33,7 @@
android:name="org.yameida.worktool.activity.ListenActivity" android:name="org.yameida.worktool.activity.ListenActivity"
android:label="@string/app_name" android:label="@string/app_name"
android:screenOrientation="portrait" android:screenOrientation="portrait"
android:windowSoftInputMode="adjustUnspecified|stateHidden"
android:theme="@style/AppTheme"> android:theme="@style/AppTheme">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />

View File

@@ -1,8 +1,10 @@
package org.yameida.worktool.service package org.yameida.worktool.service
import android.graphics.Rect
import android.view.accessibility.AccessibilityNodeInfo import android.view.accessibility.AccessibilityNodeInfo
import com.blankj.utilcode.util.GsonUtils import com.blankj.utilcode.util.GsonUtils
import com.blankj.utilcode.util.LogUtils import com.blankj.utilcode.util.LogUtils
import com.blankj.utilcode.util.ScreenUtils
import org.yameida.worktool.Constant import org.yameida.worktool.Constant
import org.yameida.worktool.model.WeworkMessageBean import org.yameida.worktool.model.WeworkMessageBean
import org.yameida.worktool.model.WeworkMessageListBean import org.yameida.worktool.model.WeworkMessageListBean
@@ -31,6 +33,14 @@ fun goHomeTab(title: String): Boolean {
val list = getRoot().findAccessibilityNodeInfosByText("消息") val list = getRoot().findAccessibilityNodeInfosByText("消息")
for (item in list) { for (item in list) {
if (item.parent.parent.parent.childCount == 5) { if (item.parent.parent.parent.childCount == 5) {
//处理侧边栏抽屉打开
if (title == "消息") {
val rect = Rect()
item.getBoundsInScreen(rect)
if (rect.left > ScreenUtils.getScreenWidth() / 2) {
goHomeTab("工作台")
}
}
atHome = true atHome = true
val tempList = getRoot().findAccessibilityNodeInfosByText(title) val tempList = getRoot().findAccessibilityNodeInfosByText(title)
for (tempItem in tempList) { for (tempItem in tempList) {

View File

@@ -115,7 +115,7 @@ object WeworkGetImpl {
val weworkMessageBean = WeworkMessageBean() val weworkMessageBean = WeworkMessageBean()
weworkMessageBean.type = WeworkMessageBean.GET_GROUP_INFO weworkMessageBean.type = WeworkMessageBean.GET_GROUP_INFO
val tvManagerFlag = val tvManagerFlag =
AccessibilityUtil.findOneByText(getRoot(), "由企业微信用户创建,可邀请微信用户进群", "该群由企业微信用户创建") AccessibilityUtil.findOneByText(getRoot(), "微信用户创建")
val button = AccessibilityUtil.findFrontNode(tvManagerFlag) val button = AccessibilityUtil.findFrontNode(tvManagerFlag)
val tvGroupName = AccessibilityUtil.findOneByClazz(button, Views.TextView) val tvGroupName = AccessibilityUtil.findOneByClazz(button, Views.TextView)
if (tvGroupName != null && tvGroupName.text != null) { if (tvGroupName != null && tvGroupName.text != null) {

View File

@@ -485,7 +485,7 @@ object WeworkOperationImpl {
private fun groupRename(groupName: String): Boolean { private fun groupRename(groupName: String): Boolean {
if (WeworkRoomUtil.intoGroupManager()) { if (WeworkRoomUtil.intoGroupManager()) {
val textView = val textView =
AccessibilityUtil.findOneByText(getRoot(), "由企业微信用户创建,可邀请微信用户进群", "该群由企业微信用户创建") AccessibilityUtil.findOneByText(getRoot(), "微信用户创建")
val button = AccessibilityUtil.findFrontNode(textView) val button = AccessibilityUtil.findFrontNode(textView)
if (button != null) { if (button != null) {
AccessibilityUtil.performClick(button) AccessibilityUtil.performClick(button)

View File

@@ -119,11 +119,7 @@ object WeworkRoomUtil {
* @return true 成功进入群管理页 * @return true 成功进入群管理页
*/ */
fun intoGroupManager(): Boolean { fun intoGroupManager(): Boolean {
if (AccessibilityUtil.findOneByText( if (AccessibilityUtil.findOneByText(getRoot(), "微信用户创建") != null) {
getRoot(),
"由企业微信用户创建,可邀请微信用户进群",
"该群由企业微信用户创建"
) != null) {
return true return true
} }
val list = findOneByClazz(getRoot(), Views.ListView) val list = findOneByClazz(getRoot(), Views.ListView)