Skip to content

Commit 57262b3

Browse files
committed
refactor(项目重构): 统一版本管理并优化项目结构- 在根目录 build.gradle 中统一管理所有依赖的版本
- 更新 AssistsService 类为开放类,支持继承 - 新增 SelectToSpeakService 类,继承自 AssistsService - 调整 simple 项目的依赖,使用本地模块替代远程仓库 - 移除 AndroidManifest.xml 中的冗余注释 - 统一代码格式,提高可读性
1 parent 28ee936 commit 57262b3

File tree

9 files changed

+115
-60
lines changed

9 files changed

+115
-60
lines changed

assists-mp/build.gradle

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,12 @@ plugins {
66

77
android {
88
namespace 'com.ven.assists_mp'
9-
compileSdk 34
9+
compileSdk rootProject.ext.compileSdk
1010

1111
defaultConfig {
12-
minSdk 24
13-
14-
15-
versionCode 4
16-
versionName "3.2.0"
12+
minSdk rootProject.ext.minSdk
13+
versionCode rootProject.ext.versionCode
14+
versionName rootProject.ext.versionName
1715

1816
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
1917
consumerProguardFiles "consumer-rules.pro"
@@ -33,8 +31,8 @@ android {
3331
}
3432

3533
dependencies {
36-
implementation 'androidx.activity:activity-ktx:1.9.0'
37-
implementation 'androidx.core:core-ktx:1.13.1'
34+
implementation "androidx.activity:activity-ktx:${rootProject.ext.activityKtxVersion}"
35+
implementation "androidx.core:core-ktx:${rootProject.ext.coreKtxVersion}"
3836
implementation project(':assists')
3937
}
4038

@@ -45,7 +43,7 @@ afterEvaluate {
4543
from components.release
4644
groupId = 'com.github.ven-coder'
4745
artifactId = 'assists-mp'
48-
version = '3.2.11'
46+
version = rootProject.ext.mavenVersion
4947
}
5048
}
5149
}

assists-opcv/build.gradle

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,12 @@ plugins {
66

77
android {
88
namespace 'com.ven.assists_opcv'
9-
compileSdk 34
9+
compileSdk rootProject.ext.compileSdk
1010

1111
defaultConfig {
12-
minSdk 24
13-
14-
versionCode 4
15-
versionName "3.2.0"
12+
minSdk rootProject.ext.minSdk
13+
versionCode rootProject.ext.versionCode
14+
versionName rootProject.ext.versionName
1615

1716
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
1817
consumerProguardFiles "consumer-rules.pro"
@@ -32,8 +31,8 @@ android {
3231
}
3332

3433
dependencies {
35-
implementation 'androidx.core:core-ktx:1.13.1'
36-
api 'org.opencv:opencv:4.9.0'
34+
implementation "androidx.core:core-ktx:${rootProject.ext.coreKtxVersion}"
35+
api "org.opencv:opencv:${rootProject.ext.opencvVersion}"
3736
implementation project(':assists')
3837
implementation project(':assists-mp')
3938
}
@@ -45,7 +44,7 @@ afterEvaluate {
4544
from components.release
4645
groupId = 'com.github.ven-coder'
4746
artifactId = 'assists-opcv'
48-
version = '3.2.11'
47+
version = rootProject.ext.mavenVersion
4948
}
5049
}
5150
}

assists/build.gradle

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,12 @@ apply plugin: 'kotlin-kapt'
55
apply plugin: 'org.jetbrains.dokka'
66
android {
77
namespace 'com.ven.assists.base'
8-
compileSdk 34
8+
compileSdk rootProject.ext.compileSdk
99

1010
defaultConfig {
11-
minSdk 24
12-
13-
versionCode 4
14-
versionName "3.2.0"
11+
minSdk rootProject.ext.minSdk
12+
versionCode rootProject.ext.versionCode
13+
versionName rootProject.ext.versionName
1514

1615
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
1716
consumerProguardFiles "consumer-rules.pro"
@@ -33,14 +32,12 @@ android {
3332
}
3433
}
3534

36-
37-
3835
dependencies {
39-
implementation 'androidx.core:core-ktx:1.13.1'
40-
implementation 'androidx.activity:activity-ktx:1.9.0'
41-
implementation 'androidx.appcompat:appcompat:1.6.1'
42-
implementation platform('org.jetbrains.kotlin:kotlin-bom:1.8.22')
43-
api 'com.blankj:utilcodex:1.31.1'
36+
implementation "androidx.core:core-ktx:${rootProject.ext.coreKtxVersion}"
37+
implementation "androidx.activity:activity-ktx:${rootProject.ext.activityKtxVersion}"
38+
implementation "androidx.appcompat:appcompat:${rootProject.ext.appcompatVersion}"
39+
implementation platform("org.jetbrains.kotlin:kotlin-bom:${rootProject.ext.kotlinBomVersion}")
40+
api "com.blankj:utilcodex:${rootProject.ext.utilcodexVersion}"
4441
}
4542

4643
dokkaHtml {
@@ -52,15 +49,14 @@ dokkaHtml {
5249
// }
5350
}
5451

55-
5652
afterEvaluate {
5753
publishing {
5854
publications {
5955
release(MavenPublication) {
6056
from components.release
6157
groupId = 'com.github.ven-coder'
6258
artifactId = 'assists-base'
63-
version = '3.2.11'
59+
version = rootProject.ext.mavenVersion
6460
}
6561
}
6662
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package com.google.android.accessibility.selecttospeak
2+
3+
import com.ven.assists.service.AssistsService
4+
5+
/**
6+
* 使用这个无障碍服务可以解决一些应用混淆节点的问题
7+
*/
8+
class SelectToSpeakService: AssistsService() {
9+
}

assists/src/main/java/com/ven/assists/service/AssistsService.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import java.util.Collections
1313
* 负责处理无障碍服务的生命周期和事件分发
1414
* 提供全局服务实例访问和监听器管理功能
1515
*/
16-
class AssistsService : AccessibilityService() {
16+
open class AssistsService : AccessibilityService() {
1717
companion object {
1818
/**
1919
* 全局服务实例

build.gradle

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,48 @@
22

33

44
buildscript {
5+
ext {
6+
// SDK 版本
7+
compileSdk = 34
8+
minSdk = 24
9+
targetSdk = 33
10+
11+
// 应用版本
12+
versionCode = 5
13+
versionName = "3.2.12"
14+
mavenVersion = "3.2.12"
15+
16+
// 依赖库版本
17+
coreKtxVersion = "1.13.1"
18+
activityKtxVersion = "1.9.0"
19+
appcompatVersion = "1.6.1"
20+
kotlinBomVersion = "1.8.22"
21+
utilcodexVersion = "1.31.1"
22+
opencvVersion = "4.9.0"
23+
24+
// Room
25+
roomVersion = "2.4.3"
26+
27+
// UI相关
28+
constraintlayoutVersion = "2.1.4"
29+
materialVersion = "1.8.0"
30+
recyclerviewVersion = "1.3.0"
31+
xpopupVersion = "2.9.17"
32+
flexboxVersion = "3.0.0"
33+
34+
// 网络相关
35+
ok2curlVersion = "0.8.0"
36+
okgoVersion = "3.0.4"
37+
okhttpLoggingVersion = "4.10.0"
38+
39+
// 图片加载
40+
glideVersion = "4.15.1"
41+
42+
// Gradle 插件版本
43+
gradleVersion = "7.3.0"
44+
kotlinGradleVersion = "1.7.10"
45+
dokkaVersion = "1.8.10"
46+
}
547
repositories {
648
maven { url 'https://maven.aliyun.com/nexus/content/groups/public/' }
749
maven { url "https://maven.aliyun.com/repository/public" }
@@ -15,8 +57,6 @@ buildscript {
1557
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10"
1658

1759
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
18-
// classpath 'com.github.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'
19-
// classpath 'com.github.johnrengelman.shadow:com.github.johnrengelman.shadow.gradle.plugin:7.1.2'
2060

2161
}
2262
}

simple/build.gradle

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ apply plugin: 'kotlin-android'
33
apply plugin: 'kotlin-kapt'
44

55
android {
6-
compileSdk 34
6+
compileSdk rootProject.ext.compileSdk
77
defaultConfig {
88
applicationId "com.ven.assists.demo"
9-
minSdk 24
10-
targetSdk 33
11-
versionCode 5
12-
versionName "3.2.0"
9+
minSdk rootProject.ext.minSdk
10+
targetSdk rootProject.ext.targetSdk
11+
versionCode rootProject.ext.versionCode
12+
versionName rootProject.ext.versionName
1313
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
1414

1515
ndk {
@@ -51,23 +51,23 @@ android {
5151

5252
dependencies {
5353
implementation fileTree(dir: 'libs', include: ['*.jar'])
54-
// implementation project(':assists')
55-
// implementation project(':assists-mp')
56-
// implementation project(':assists-opcv')
57-
implementation "com.github.ven-coder.Assists:assists-base:v3.2.1"
58-
implementation "com.github.ven-coder.Assists:assists-opcv:v3.2.1"
59-
implementation "com.github.ven-coder.Assists:assists-mp:v3.2.1"
60-
implementation "androidx.room:room-runtime:2.4.3"
61-
implementation 'androidx.room:room-ktx:2.4.3'
62-
implementation 'com.github.mrmike:ok2curl:0.8.0'
63-
implementation 'androidx.appcompat:appcompat:1.6.1'
64-
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
65-
implementation 'com.github.li-xiaojun:XPopup:2.9.17'
66-
implementation 'com.google.android.material:material:1.8.0'
67-
implementation 'androidx.recyclerview:recyclerview:1.3.0'
68-
implementation 'com.github.bumptech.glide:glide:4.15.1'
69-
annotationProcessor 'com.github.bumptech.glide:compiler:4.15.1'
70-
implementation 'com.lzy.net:okgo:3.0.4'
71-
implementation "com.squareup.okhttp3:logging-interceptor:4.10.0"
72-
implementation 'com.google.android.flexbox:flexbox:3.0.0'
54+
implementation project(':assists')
55+
implementation project(':assists-mp')
56+
implementation project(':assists-opcv')
57+
// implementation "com.github.ven-coder.Assists:assists-base:v3.2.11"
58+
// implementation "com.github.ven-coder.Assists:assists-opcv:v3.2.11"
59+
// implementation "com.github.ven-coder.Assists:assists-mp:v3.2.11"
60+
implementation "androidx.room:room-runtime:${rootProject.ext.roomVersion}"
61+
implementation "androidx.room:room-ktx:${rootProject.ext.roomVersion}"
62+
implementation "com.github.mrmike:ok2curl:${rootProject.ext.ok2curlVersion}"
63+
implementation "com.lzy.net:okgo:${rootProject.ext.okgoVersion}"
64+
implementation "com.squareup.okhttp3:logging-interceptor:${rootProject.ext.okhttpLoggingVersion}"
65+
implementation "androidx.appcompat:appcompat:${rootProject.ext.appcompatVersion}"
66+
implementation "androidx.constraintlayout:constraintlayout:${rootProject.ext.constraintlayoutVersion}"
67+
implementation "com.github.li-xiaojun:XPopup:${rootProject.ext.xpopupVersion}"
68+
implementation "com.google.android.material:material:${rootProject.ext.materialVersion}"
69+
implementation "androidx.recyclerview:recyclerview:${rootProject.ext.recyclerviewVersion}"
70+
implementation "com.github.bumptech.glide:glide:${rootProject.ext.glideVersion}"
71+
annotationProcessor "com.github.bumptech.glide:compiler:${rootProject.ext.glideVersion}"
72+
implementation "com.google.android.flexbox:flexbox:${rootProject.ext.flexboxVersion}"
7373
}

simple/src/main/AndroidManifest.xml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,21 @@
6666
android:name=".ImageGalleryActivity"
6767
android:exported="false" />
6868

69+
<!-- <service-->
70+
<!-- android:name="com.ven.assists.service.AssistsService"-->
71+
<!-- android:enabled="true"-->
72+
<!-- android:exported="true"-->
73+
<!-- android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE">-->
74+
<!-- &lt;!&ndash;android:priority="10000" 可提高服务在设置中的权重,排在前面 &ndash;&gt;-->
75+
<!-- <intent-filter android:priority="10000">-->
76+
<!-- <action android:name="android.accessibilityservice.AccessibilityService" />-->
77+
<!-- </intent-filter>-->
78+
<!-- <meta-data-->
79+
<!-- android:name="android.accessibilityservice"-->
80+
<!-- android:resource="@xml/assists_service" />-->
81+
<!-- </service>-->
6982
<service
70-
android:name="com.ven.assists.service.AssistsService"
83+
android:name="com.google.android.accessibility.selecttospeak.SelectToSpeakService"
7184
android:enabled="true"
7285
android:exported="true"
7386
android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE">

simple/src/main/java/com/ven/assists/simple/MainActivity.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import com.ven.assists.simple.overlays.OverlayAdvanced
2525
import com.ven.assists.simple.overlays.OverlayBasic
2626
import com.ven.assists.simple.overlays.OverlayPro
2727
import com.ven.assists.utils.CoroutineWrapper
28+
import com.ven.assists.utils.NodeClassValue
2829
import kotlinx.coroutines.delay
2930

3031

@@ -130,7 +131,6 @@ class MainActivity : AppCompatActivity(), AssistsServiceListener {
130131
setContentView(viewBind.root)
131132
AssistsService.listeners.add(this)
132133
checkPermission()
133-
134134
}
135135

136136
private fun checkPermission() {

0 commit comments

Comments
 (0)