-
Notifications
You must be signed in to change notification settings - Fork 192
v2.0.0文档
Ven edited this page Jun 8, 2024
·
1 revision
- 整理api
- 增加
- 浮窗支持拖动修改大小
-
- 根据类型查找元素
- 在当前元素范围下,根据类型查找元素
- 获取当前页面所有元素
- 获取指定元素下所有子元素
- 查找第一个可点击的父元素
- 拓展-获取元素在屏幕中的范围
- 拓展-手势点击元素所处的位置
- 拓展-点击元素
- 拓展-手势长按元素所处的位置
- 修复
- 基准分辨率获取对应当前分辨率的坐标部分机型不一致问题
allprojects {
repositories {
//添加JitPack仓库
maven { url 'https://jitpack.io' }
}
}dependencies {
//添加依赖
implementation 'com.github.ven-coder:assists:2.0.0'
}一定要在主模块中注册服务,不然进程被杀服务也会自动被关闭需要再次开启(小米可保持杀进程保持开启,其他vivo、oppo、鸿蒙机型似乎不行)
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.ven.assists.simple">
<application
android:name="com.ven.assists.simple.App"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:requestLegacyExternalStorage="true"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:usesCleartextTraffic="true">
<!-- 添加以下代码 -->
<service
android:name="com.ven.assist.AssistsService"
android:enabled="true"
android:exported="true"
android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE">
<intent-filter>
<action android:name="android.accessibilityservice.AccessibilityService" />
</intent-filter>
<meta-data
android:name="android.accessibilityservice"
android:resource="@xml/assists_service" />
</service>
</application>
</manifest>至此,开启无障碍服务后即可使用包装的API了
步骤器可以帮助快速实现复杂的业务场景,比如自动发朋友圈、获取微信所有好友昵称、自动删除好友...等等都是一些逻辑较多的业务场景,步骤器可帮助快速实现。 前提: 已完成前面的配置
直接在接口onImpl(collector: StepCollector)写逻辑
//OpenWechat为该业务场景的分类
class OpenWechat:StepImpl {
override fun onImpl(collector: StepCollector) {
//步骤1逻辑
collector.next(1) {//1为该步骤的标识
//步骤1逻辑
...
//执行步骤2,this::class.java为当前StepImpl实现类的步骤逻辑,如果传其他的StepImpl就会执行指定的StepImpl逻辑
StepManager.execute(this::class.java, 2)
}.next(2) {
//步骤2逻辑
...
//下一步
StepManager.execute(this::class.java, 3)
}.next(2) {
//步骤3逻辑
...
//下一步
StepManager.execute(this::class.java, 4)
}
其他步骤
...
}
}
执行前请确保无障碍服务已开启
//从OpenWechat的步骤1开始执行,isBegin需要为true,默认false
StepManager.execute(OpenWechat::class.java, 1, isBegin = true)具体的使用可以下载查看demo源码
扫码下载