Compare commits
205 Commits
Author | SHA1 | Date | |
---|---|---|---|
8b657a8aab
|
|||
f0ab310620
|
|||
711e0ac730
|
|||
b1e83a1073
|
|||
b562337995
|
|||
6b990c50f8
|
|||
|
bae91688b1 | ||
|
a59d260321 | ||
|
e850a73c49 | ||
|
1dc725c294 | ||
ce89da3ee8
|
|||
81331dfe81
|
|||
20f1ceca4d
|
|||
fc8589f1ee
|
|||
|
67378b2ebf | ||
|
bf4ecd8345 | ||
6e8d900dc5
|
|||
3d12d3f4a5
|
|||
4b36437dac
|
|||
93789f163b
|
|||
32d8937ddb
|
|||
38c9d78f1e
|
|||
0ee03340da
|
|||
54ee2358cf
|
|||
55708eb96a
|
|||
c4de8ae448
|
|||
9e092742da
|
|||
fb27c107f4
|
|||
2be9a3d934
|
|||
d7dbecb65c
|
|||
6c2b3f12b3
|
|||
f1c520586a
|
|||
e9c99343c3
|
|||
20de713ffd
|
|||
3b78e8a515
|
|||
cf898092bd
|
|||
251a5151df
|
|||
59e93bc040
|
|||
d440e85be4
|
|||
e1dc99de01
|
|||
4eab1f7046
|
|||
3fc294dd8d
|
|||
a2c06cc201 | |||
6f39d5fdab | |||
5ada7585e3 | |||
31b8f157e5 | |||
e71f137f74 | |||
9e9bbcc8ca | |||
8043457a6e | |||
d4a1536d70 | |||
5c784f65f8 | |||
1c6c6e6480 | |||
4712d0063b | |||
583c72470b | |||
8cf945b670 | |||
6fba93e1fa | |||
288563ef68 | |||
d1e4c17817 | |||
c8ec50cb29 | |||
b6e042b9d0 | |||
3c4789d9a0 | |||
46ff5f4bcf | |||
09eeeeab5f | |||
f285e6f96d | |||
fb90d4051b | |||
911eb042a6 | |||
9d48732140 | |||
2d31d46cd2 | |||
3a1a20e688 | |||
24346c056f | |||
e05c8fce30 | |||
e1b15c4c0a | |||
5b99288ea8 | |||
da958920b3 | |||
035e07db89 | |||
90de1612f3 | |||
9d2a87449d | |||
7a8bc6c8f8 | |||
b1e1e15412 | |||
569d4e278a | |||
2729724e93 | |||
64f87bd69f | |||
8d80d0b11f | |||
c045529914 | |||
6799e1e52d | |||
b11bd6dc46 | |||
99a203bde6 | |||
99b736ef36 | |||
415ab22bfc | |||
5bfa7c74d3 | |||
2ba2ff0b35 | |||
3ac6647a25 | |||
18b6b907bf | |||
73762291f1 | |||
49563d8bc5 | |||
0678357048 | |||
b49b4b9b9e | |||
af927d3f19 | |||
73be5df304 | |||
e01102a928 | |||
a21d27b65c | |||
45dc67c609 | |||
c3c2c07b00 | |||
1b573ec296 | |||
95601466ef | |||
07c52eb10a | |||
81aa8a7ef9 | |||
48eb942167 | |||
fe11d0e67b | |||
5fffb0b154 | |||
316db6f887 | |||
17b3d8ac9a | |||
6d58f0330b | |||
1c42bc4def | |||
a3772e3673 | |||
af20fad070 | |||
e510e5d043 | |||
2ebc0bc2dc | |||
3e23c67ad2 | |||
6ff9a08366 | |||
8a90303228 | |||
5b411227d9 | |||
88db36a848 | |||
9b3585c309 | |||
8c38183869 | |||
a1bc86cb81 | |||
3fb12ae743 | |||
f23034639e | |||
ccff6c04fd | |||
48fbadb692 | |||
0594352859 | |||
9aceec38b6 | |||
b925296870 | |||
28b03d2205 | |||
aeb6654550 | |||
82ff6ac311 | |||
74ba88f201 | |||
3144a160d4 | |||
34bfb4660e | |||
8d10a17914 | |||
1edd92ca79 | |||
4b583df6ae | |||
f6d51a7633 | |||
a1791f327b | |||
3d78411738 | |||
72597510f2 | |||
5b371ba3da | |||
751b0c4ce5 | |||
73677d1c33 | |||
ed658c83e6 | |||
|
0b4c58293a | ||
|
5a51ef571a | ||
|
4bd738b206 | ||
4a0473892b | |||
14354ec06f | |||
7eca11ed18 | |||
4c13768500 | |||
e30afc4011 | |||
7a1c53ed17 | |||
a4d62137a2 | |||
beb8da210d | |||
60aecc67bf | |||
69faade0e4 | |||
4ecc694dd4 | |||
674f0a9cd7 | |||
b14b9e02e2 | |||
bacff6b275 | |||
5eb2729eb6 | |||
d93b4bdc7f | |||
f1e64c293c | |||
8b2663c3cb | |||
a5b1a57a93 | |||
d2dd6c9f88 | |||
e4d1ea8519 | |||
d293e4656d | |||
731cfc13d4 | |||
342128a692 | |||
c08facd9f6 | |||
3dfd69dbc7 | |||
d13aee534e | |||
9f8f21dc9a | |||
90258a07c1 | |||
c6bed6549e | |||
b26b78e268 | |||
ef97306151 | |||
26a4a11149 | |||
dc14585805 | |||
8841ad7f59 | |||
190f59451f | |||
7ce09ac4ef | |||
a182e0e4d5 | |||
bb69b762d0 | |||
e276ee4172 | |||
692acd3358 | |||
6360859255 | |||
22f8e14afb | |||
07a6fb6cf7 | |||
163eecc0b8 | |||
5707a8b394 | |||
11aa064b90 | |||
15b1bfa498 | |||
|
673dc8127b | ||
|
7d9c360c9d | ||
d5e885db6c | |||
7481bbd7ef |
1
.idea/gradle.xml
generated
@@ -14,7 +14,6 @@
|
|||||||
<option value="$PROJECT_DIR$/app" />
|
<option value="$PROJECT_DIR$/app" />
|
||||||
</set>
|
</set>
|
||||||
</option>
|
</option>
|
||||||
<option name="resolveModulePerSourceSet" value="false" />
|
|
||||||
</GradleProjectSettings>
|
</GradleProjectSettings>
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
|
15
.idea/misc.xml
generated
@@ -1,5 +1,20 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
|
<component name="DesignSurface">
|
||||||
|
<option name="filePathToZoomLevelMap">
|
||||||
|
<map>
|
||||||
|
<entry key="app/src/main/res/drawable-v24/dark_round.xml" value="0.4482051282051282" />
|
||||||
|
<entry key="app/src/main/res/drawable/bg_orange_round.xml" value="0.229" />
|
||||||
|
<entry key="app/src/main/res/drawable/bg_permotion_round.xml" value="0.2495" />
|
||||||
|
<entry key="app/src/main/res/drawable/button_round.xml" value="0.44871794871794873" />
|
||||||
|
<entry key="app/src/main/res/drawable/dark_round.xml" value="0.4482051282051282" />
|
||||||
|
<entry key="app/src/main/res/drawable/permotion_round.xml" value="0.4482051282051282" />
|
||||||
|
<entry key="app/src/main/res/drawable/red_round.xml" value="0.4482051282051282" />
|
||||||
|
<entry key="app/src/main/res/layout/activity_main.xml" value="0.3413246647704185" />
|
||||||
|
<entry key="app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml" value="0.2495" />
|
||||||
|
</map>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="11" project-jdk-type="JavaSDK">
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="11" project-jdk-type="JavaSDK">
|
||||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||||
</component>
|
</component>
|
||||||
|
6
.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
47
CONTRIBUTING.md
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
# 开始贡献
|
||||||
|
|
||||||
|
欢迎为此项目进行新版本的适配代码贡献!<br/>
|
||||||
|
|
||||||
|
## 分支规定
|
||||||
|
|
||||||
|
不管是直接 Push 代码还是提交 Pull Request,都必须使 commit 指向 master 分支。
|
||||||
|
|
||||||
|
## 代码格式规范
|
||||||
|
|
||||||
|
- 1.全部提交代码必须使用 IDE(Android Studio 或 IDEA) 进行格式化,未经格式化的代码将拒绝合并提交请求
|
||||||
|
- 2.代码必须使用 4 spaces 缩进格式化
|
||||||
|
|
||||||
|
## 代码注释规范
|
||||||
|
|
||||||
|
- 1.第一种注释方式:可使用在方法名或顶级变量名上
|
||||||
|
|
||||||
|
```kotlin
|
||||||
|
/** 注释内容 */
|
||||||
|
fun a() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 注释名称
|
||||||
|
* @param test 方法名称
|
||||||
|
* @return 返回值名称
|
||||||
|
*/
|
||||||
|
fun a(test: String) {
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
- 2.第二种注释方式:仅可使用在变量后方
|
||||||
|
|
||||||
|
```kotlin
|
||||||
|
val a = "" // 变量注释
|
||||||
|
```
|
||||||
|
|
||||||
|
- ⚠️ 注意:只允许两个 // 后方要有空格
|
||||||
|
|
||||||
|
## 项目要求
|
||||||
|
|
||||||
|
- 1.调试性质或大批量注释代码,禁止提交
|
||||||
|
- 2.类名和方法名仅能由开发者进行修改和提交,禁止随意修改项目名称、方法名称以及类名
|
||||||
|
- 3.禁止随意更新项目依赖以及增加新的依赖,有问题请提前提交到 issues 进行说明
|
||||||
|
- 4.禁止更新项目版本号,版本号交由开发者合并代码并发布 release 版本
|
||||||
|
- 5.代码语言要求,请统一使用 Kotlin,除特殊情况外,不接受其他语言的提交
|
||||||
|
- 6.以上
|
103
README.md
@@ -1,44 +1,67 @@
|
|||||||
# TSBattery
|
# TSBattery
|
||||||

|
|
||||||

|
|
||||||

|
|
||||||
<br/><br/>
|
|
||||||
TSBattery a new way to save your battery avoid cancer apps hacker it.<br/>
|
|
||||||
TSBattery 是一个旨在使 QQ、TIM 变得更省电的开源 Xposed 模块
|
|
||||||
# 开始使用
|
|
||||||
点击下载最新版本
|
|
||||||
<a href='https://github.com/fankes/TSBattery/releases'></a>
|
|
||||||
<br/><br/>
|
|
||||||
⚠️适配说明:此模块支持原生 Xposed、Lsposed(作用域 QQ、TIM 如果不起作用勾选系统框架)、EdXposed(不推荐)、太极无极(阴和阳)、Pine(梦境模块)
|
|
||||||
# 禁止任何商业用途
|
|
||||||
本模块完全开源免费,如果好用你可以打赏支持开发,严禁未经许可进行二改贩卖,违者必惩必究。
|
|
||||||
# 开始贡献
|
|
||||||
欢迎为此项目进行新版本的适配代码贡献!<br/>
|
|
||||||
## 代码规范:
|
|
||||||
### 1.全部提交代码必须使用 IDE(Android Studio 或 IDEA) 进行格式化,未经格式化的代码将拒绝合并提交请求
|
|
||||||
### 2.代码必须使用 4 spaces 缩进格式化
|
|
||||||
### 3.代码注释规范:
|
|
||||||
1.第一种注释方式:可使用在方法名或顶级变量名上
|
|
||||||
```kotlin
|
|
||||||
/** 注释内容 */
|
|
||||||
fun a() {
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
[](https://github.com/fankes/TSBattery)
|
||||||
* 注释名称
|
[](https://github.com/fankes/TSBattery/blob/master/LICENSE)
|
||||||
* @param test 方法名称
|
[](https://github.com/fankes/TSBattery/releases)
|
||||||
* @return 返回值名称
|
[](https://github.com/fankes/TSBattery/releases)
|
||||||
*/
|
[](https://github.com/Xposed-Modules-Repo/com.fankes.tsbattery/releases)
|
||||||
fun a(test: String) {
|
[](https://t.me/XiaofangInternet)
|
||||||
}
|
<br/><br/>
|
||||||
|
<br/>
|
||||||
|
A new way to save your battery avoid cancer apps hacker it.
|
||||||
|
|
||||||
|
TSBattery 是一个旨在使 QQ、TIM、微信 变得更省电的开源 Xposed 模块。
|
||||||
|
|
||||||
|
## Developer
|
||||||
|
|
||||||
|
[酷安 @星夜不荟](http://www.coolapk.com/u/876977)
|
||||||
|
|
||||||
|
## 适配说明
|
||||||
|
|
||||||
|
- 支持并建议使用 <b>LSPosed</b>(若作用域没有自动出现推荐请勾选 QQ、TIM、微信)
|
||||||
|
|
||||||
|
- 可以使用 <b>~~EdXposed~~</b>,但随时停止支持
|
||||||
|
|
||||||
|
- <b>太极无极 · 阴</b> 支持性不是很好,建议使用 <b>太极无极 · 阳</b>
|
||||||
|
|
||||||
|
- 支持 <b>Pine</b>(梦境模块) 但是部分功能有限制
|
||||||
|
|
||||||
|
- 请不要使用 <b>~~应用转生~~</b>,发生封号情况后果自负
|
||||||
|
|
||||||
|
## 请勿用于非法用途
|
||||||
|
|
||||||
|
- 本模块完全开源免费,如果好用你可以打赏支持开发,但是请不要用于非法用途。
|
||||||
|
|
||||||
|
- 本模块发布地址仅有 [Xposed-Modules-Repo](https://github.com/Xposed-Modules-Repo/com.fankes.tsbattery/releases)、
|
||||||
|
[Release](https://github.com/fankes/TSBattery/releases) 及 [蓝奏云](https://fankes.lanzouy.com/b02zfz3sj),从其他非正规渠道下载到的版本或对您造成任何影响均与我们无关。
|
||||||
|
|
||||||
|
## 开始贡献
|
||||||
|
|
||||||
|
欢迎为此项目进行新版本的适配代码贡献!<br/>
|
||||||
|
|
||||||
|
- [CONTRIBUTING](https://github.com/fankes/TSBattery/blob/master/CONTRIBUTING.md)
|
||||||
|
|
||||||
|
## 许可证
|
||||||
|
|
||||||
|
- [AGPL-3.0](https://www.gnu.org/licenses/agpl-3.0.html)
|
||||||
|
|
||||||
```
|
```
|
||||||
2.第二种注释方式:仅可使用在变量后方
|
Copyright (C) 2019-2022 Fankes Studio(qzmmcn@163.com)
|
||||||
```kotlin
|
|
||||||
val a = "" // 变量注释
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Affero General Public License as
|
||||||
|
published by the Free Software Foundation, either version 3 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Affero General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Affero General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
```
|
```
|
||||||
⚠️注意:只允许两个 // 后方要有空格
|
|
||||||
### 4.调试性质或大批量注释代码,禁止提交
|
Powered by [YukiHookAPI](https://github.com/fankes/YukiHookAPI)
|
||||||
### 5.类名和方法名仅能由开发者进行修改和提交,禁止随意修改项目名称、方法名称以及类名
|
|
||||||
### 6.禁止随意更新项目依赖以及增加新的依赖,有问题请提前提交到 issues 进行说明
|
版权所有 © 2019-2022 Fankes Studio(qzmmcn@163.com)
|
||||||
### 7.禁止更新项目版本号,版本号交由开发者合并代码并发布 release 版本
|
|
||||||
### 8.代码语言要求,请统一使用 Kotlin,除特殊情况外,不接受其他语言的提交
|
|
3
app/.gitignore
vendored
@@ -1 +1,2 @@
|
|||||||
/build
|
/build
|
||||||
|
/release
|
@@ -1,6 +1,7 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id 'com.android.application'
|
id 'com.android.application'
|
||||||
id 'kotlin-android'
|
id 'kotlin-android'
|
||||||
|
id 'com.google.devtools.ksp' version '1.7.10-1.0.6'
|
||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
@@ -14,49 +15,57 @@ android {
|
|||||||
v2SigningEnabled true
|
v2SigningEnabled true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
compileSdkVersion 31
|
compileSdkVersion 32
|
||||||
buildToolsVersion "31.0.0"
|
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "com.fankes.tsbattery"
|
applicationId "com.fankes.tsbattery"
|
||||||
minSdkVersion 22
|
minSdk 22
|
||||||
//noinspection ExpiredTargetSdkVersion
|
targetSdk 26
|
||||||
targetSdkVersion 28
|
versionCode rootProject.ext.appVersionCode
|
||||||
versionCode 7
|
versionName rootProject.ext.appVersionName
|
||||||
versionName "2.4"
|
|
||||||
|
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
release {
|
release {
|
||||||
minifyEnabled true
|
minifyEnabled rootProject.ext.enableR8
|
||||||
|
shrinkResources rootProject.ext.enableR8
|
||||||
|
zipAlignEnabled rootProject.ext.enableR8
|
||||||
signingConfig signingConfigs.debug
|
signingConfig signingConfigs.debug
|
||||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
compileOptions {
|
compileOptions {
|
||||||
sourceCompatibility JavaVersion.VERSION_1_8
|
sourceCompatibility JavaVersion.VERSION_11
|
||||||
targetCompatibility JavaVersion.VERSION_1_8
|
targetCompatibility JavaVersion.VERSION_11
|
||||||
}
|
}
|
||||||
kotlinOptions {
|
kotlinOptions {
|
||||||
jvmTarget = '1.8'
|
jvmTarget = '11'
|
||||||
|
freeCompilerArgs = [
|
||||||
|
'-Xno-param-assertions',
|
||||||
|
'-Xno-call-assertions',
|
||||||
|
'-Xno-receiver-assertions'
|
||||||
|
]
|
||||||
|
}
|
||||||
|
buildFeatures {
|
||||||
|
viewBinding true
|
||||||
|
}
|
||||||
|
lintOptions {
|
||||||
|
checkReleaseBuilds false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compileOnly 'de.robv.android.xposed:api:82'
|
compileOnly 'de.robv.android.xposed:api:82'
|
||||||
// 基础依赖包
|
implementation 'com.highcapable.yukihookapi:api:1.0.92'
|
||||||
implementation 'com.gyf.immersionbar:immersionbar:3.0.0'
|
ksp 'com.highcapable.yukihookapi:ksp-xposed:1.0.92'
|
||||||
// Fragment 快速实现
|
implementation 'com.github.duanhong169:drawabletoolbox:1.0.7'
|
||||||
implementation 'com.gyf.immersionbar:immersionbar-components:3.0.0'
|
implementation 'com.squareup.okhttp3:okhttp:5.0.0-alpha.7'
|
||||||
// Kotlin 扩展
|
implementation 'androidx.core:core-ktx:1.8.0'
|
||||||
implementation 'com.gyf.immersionbar:immersionbar-ktx:3.0.0'
|
implementation 'androidx.appcompat:appcompat:1.4.2'
|
||||||
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
implementation 'com.google.android.material:material:1.6.1'
|
||||||
implementation 'androidx.core:core-ktx:1.7.0'
|
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
||||||
implementation 'androidx.appcompat:appcompat:1.4.0'
|
|
||||||
implementation 'com.google.android.material:material:1.4.0'
|
|
||||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.2'
|
|
||||||
testImplementation 'junit:junit:4.13.2'
|
testImplementation 'junit:junit:4.13.2'
|
||||||
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
|
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
|
||||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
|
||||||
|
20
app/proguard-rules.pro
vendored
@@ -20,29 +20,25 @@
|
|||||||
# hide the original source file name.
|
# hide the original source file name.
|
||||||
#-renamesourcefileattribute SourceFile
|
#-renamesourcefileattribute SourceFile
|
||||||
|
|
||||||
-dontwarn
|
|
||||||
-ignorewarnings
|
-ignorewarnings
|
||||||
-optimizationpasses 10
|
-optimizationpasses 10
|
||||||
-dontusemixedcaseclassnames
|
-dontusemixedcaseclassnames
|
||||||
-dontoptimize
|
-dontoptimize
|
||||||
-verbose
|
-verbose
|
||||||
-overloadaggressively
|
-overloadaggressively
|
||||||
-repackageclasses o
|
|
||||||
-allowaccessmodification
|
-allowaccessmodification
|
||||||
-adaptclassstrings
|
-adaptclassstrings
|
||||||
-adaptresourcefilenames
|
-adaptresourcefilenames
|
||||||
-adaptresourcefilecontents
|
-adaptresourcefilecontents
|
||||||
|
|
||||||
#-optimizations !code/simplification/arithmetic,!code/simplification/cast,!field/*,!class/merging/*
|
-renamesourcefileattribute P
|
||||||
-renamesourcefileattribute H
|
|
||||||
-keepattributes SourceFile,LineNumberTable
|
-keepattributes SourceFile,LineNumberTable
|
||||||
|
|
||||||
-keep class android.support**
|
-assumenosideeffects class kotlin.jvm.internal.Intrinsics {
|
||||||
-keep class androidx**
|
public static *** throwUninitializedProperty(...);
|
||||||
|
public static *** throwUninitializedPropertyAccessException(...);
|
||||||
|
}
|
||||||
|
|
||||||
-keep public class * extends android.app.Activity
|
-keepclassmembers class * implements androidx.viewbinding.ViewBinding {
|
||||||
-keep public class * extends android.app.Application
|
*** inflate(android.view.LayoutInflater);
|
||||||
-keep public class * extends android.app.Service
|
}
|
||||||
-keep public class * extends android.content.ContentProvider
|
|
||||||
-keep public class * extends android.app.backup.BackupAgentHelper
|
|
||||||
-keep public class * extends android.preference.Preference
|
|
@@ -1,20 +0,0 @@
|
|||||||
{
|
|
||||||
"version": 3,
|
|
||||||
"artifactType": {
|
|
||||||
"type": "APK",
|
|
||||||
"kind": "Directory"
|
|
||||||
},
|
|
||||||
"applicationId": "com.fankes.tsbattery",
|
|
||||||
"variantName": "release",
|
|
||||||
"elements": [
|
|
||||||
{
|
|
||||||
"type": "SINGLE",
|
|
||||||
"filters": [],
|
|
||||||
"attributes": [],
|
|
||||||
"versionCode": 7,
|
|
||||||
"versionName": "2.4",
|
|
||||||
"outputFile": "app-release.apk"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"elementType": "File"
|
|
||||||
}
|
|
@@ -3,6 +3,16 @@
|
|||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
package="com.fankes.tsbattery">
|
package="com.fankes.tsbattery">
|
||||||
|
|
||||||
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||||
|
|
||||||
|
<!-- 作用域 APP -->
|
||||||
|
<queries>
|
||||||
|
<package android:name="com.tencent.mobileqq" />
|
||||||
|
<package android:name="com.tencent.tim" />
|
||||||
|
<package android:name="com.tencent.mm" />
|
||||||
|
</queries>
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:name=".application.TSApplication"
|
android:name=".application.TSApplication"
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
@@ -13,25 +23,23 @@
|
|||||||
android:theme="@style/Theme.TSBattery"
|
android:theme="@style/Theme.TSBattery"
|
||||||
tools:ignore="AllowBackup">
|
tools:ignore="AllowBackup">
|
||||||
|
|
||||||
<!-- 是否是xposed模块 -->
|
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="xposedmodule"
|
android:name="xposedmodule"
|
||||||
android:value="true" />
|
android:value="true" />
|
||||||
|
|
||||||
<!-- 模块描述 -->
|
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="xposeddescription"
|
android:name="xposeddescription"
|
||||||
android:value="抵制毒瘤,拒绝疯狂耗电,Tencent 社交毒瘤一键省电模块(目前支持 QQ、TIM),通过干掉电源锁常驻减少电量消耗,理论支持最新版本。by 酷安 @星夜不荟" />
|
android:value="Tencent 社交毒瘤一键省电模块。\n目前支持 QQ、TIM、微信\n开发者:酷安 @星夜不荟" />
|
||||||
|
|
||||||
<!-- 最低xposed版本号 -->
|
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="xposedminversion"
|
android:name="xposedminversion"
|
||||||
android:value="82" />
|
android:value="93" />
|
||||||
|
<meta-data
|
||||||
|
android:name="xposedscope"
|
||||||
|
android:resource="@array/module_scope" />
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name="com.fankes.tsbattery.ui.MainActivity"
|
android:name="com.fankes.tsbattery.ui.activity.MainActivity"
|
||||||
android:exported="true"
|
android:exported="true"
|
||||||
android:label="@string/app_name">
|
android:screenOrientation="behind">
|
||||||
|
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
@@ -44,7 +52,8 @@
|
|||||||
android:enabled="true"
|
android:enabled="true"
|
||||||
android:exported="true"
|
android:exported="true"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:targetActivity="com.fankes.tsbattery.ui.MainActivity">
|
android:screenOrientation="behind"
|
||||||
|
android:targetActivity="com.fankes.tsbattery.ui.activity.MainActivity">
|
||||||
|
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
@@ -1 +1 @@
|
|||||||
com.fankes.tsbattery.hook.HookMain
|
com.fankes.tsbattery.hook.HookEntry_YukiHookXposedInit
|
1
app/src/main/assets/yukihookapi_init
Normal file
@@ -0,0 +1 @@
|
|||||||
|
com.fankes.tsbattery.hook.HookEntry
|
@@ -1,35 +1,34 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2021. Fankes Studio(qzmmcn@163.com)
|
* TSBattery - A new way to save your battery avoid cancer apps hacker it.
|
||||||
|
* Copyright (C) 2019-2022 Fankes Studio(qzmmcn@163.com)
|
||||||
|
* https://github.com/fankes/TSBattery
|
||||||
*
|
*
|
||||||
* This file is part of TSBattery.
|
* This software is non-free but opensource software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public License
|
||||||
|
* as published by the Free Software Foundation; either
|
||||||
|
* version 3 of the License, or any later version.
|
||||||
*
|
*
|
||||||
* TSBattery is free software: you can redistribute it and/or modify
|
* This software is distributed in the hope that it will be useful,
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* TSBattery is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* GNU General Public License for more details.
|
* Affero General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* and eula along with this software. If not, see
|
||||||
|
* <https://www.gnu.org/licenses/>
|
||||||
*
|
*
|
||||||
* This file is Created by fankes on 2021/11/9.
|
* This file is Created by fankes on 2021/11/9.
|
||||||
*/
|
*/
|
||||||
@file:Suppress("unused")
|
|
||||||
|
|
||||||
package com.fankes.tsbattery.application
|
package com.fankes.tsbattery.application
|
||||||
|
|
||||||
import android.app.Application
|
|
||||||
import androidx.appcompat.app.AppCompatDelegate
|
import androidx.appcompat.app.AppCompatDelegate
|
||||||
|
import com.highcapable.yukihookapi.hook.xposed.application.ModuleApplication
|
||||||
|
|
||||||
class TSApplication : Application() {
|
class TSApplication : ModuleApplication() {
|
||||||
|
|
||||||
override fun onCreate() {
|
override fun onCreate() {
|
||||||
super.onCreate()
|
super.onCreate()
|
||||||
/** 禁止系统夜间模式对自己造成干扰 - 模块要什么夜间模式?😅 (其实是我懒) */
|
/** 跟随系统夜间模式 */
|
||||||
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO)
|
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM)
|
||||||
}
|
}
|
||||||
}
|
}
|
37
app/src/main/java/com/fankes/tsbattery/data/DataConst.kt
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
/*
|
||||||
|
* TSBattery - A new way to save your battery avoid cancer apps hacker it.
|
||||||
|
* Copyright (C) 2019-2022 Fankes Studio(qzmmcn@163.com)
|
||||||
|
* https://github.com/fankes/TSBattery
|
||||||
|
*
|
||||||
|
* This software is non-free but opensource software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public License
|
||||||
|
* as published by the Free Software Foundation; either
|
||||||
|
* version 3 of the License, or any later version.
|
||||||
|
*
|
||||||
|
* This software is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* and eula along with this software. If not, see
|
||||||
|
* <https://www.gnu.org/licenses/>
|
||||||
|
*
|
||||||
|
* This file is Created by fankes on 2022/3/28.
|
||||||
|
*/
|
||||||
|
package com.fankes.tsbattery.data
|
||||||
|
|
||||||
|
import com.highcapable.yukihookapi.hook.xposed.prefs.data.PrefsData
|
||||||
|
|
||||||
|
object DataConst {
|
||||||
|
|
||||||
|
val ENABLE_HIDE_ICON = PrefsData("_hide_icon", false)
|
||||||
|
val ENABLE_RUN_INFO = PrefsData("_tip_run_info", false)
|
||||||
|
val ENABLE_NOTIFY_TIP = PrefsData("_tip_in_notify", true)
|
||||||
|
val ENABLE_SETTING_TIP = PrefsData("_tip_in_setting", true)
|
||||||
|
val ENABLE_QQTIM_WHITE_MODE = PrefsData("_qqtim_white_mode", false)
|
||||||
|
val ENABLE_QQTIM_CORESERVICE_BAN = PrefsData("_qqtim_core_service_ban", false)
|
||||||
|
val ENABLE_QQTIM_CORESERVICE_CHILD_BAN = PrefsData("_qqtim_core_service_child_ban", false)
|
||||||
|
val DISABLE_WECHAT_HOOK = PrefsData("_disable_wechat_hook", false)
|
||||||
|
val ENABLE_MODULE_VERSION = PrefsData("_module_version", "")
|
||||||
|
}
|
29
app/src/main/java/com/fankes/tsbattery/hook/HookConst.kt
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* TSBattery - A new way to save your battery avoid cancer apps hacker it.
|
||||||
|
* Copyright (C) 2019-2022 Fankes Studio(qzmmcn@163.com)
|
||||||
|
* https://github.com/fankes/TSBattery
|
||||||
|
*
|
||||||
|
* This software is non-free but opensource software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public License
|
||||||
|
* as published by the Free Software Foundation; either
|
||||||
|
* version 3 of the License, or any later version.
|
||||||
|
*
|
||||||
|
* This software is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* and eula along with this software. If not, see
|
||||||
|
* <https://www.gnu.org/licenses/>
|
||||||
|
*
|
||||||
|
* This file is Created by fankes on 2021/11/9.
|
||||||
|
*/
|
||||||
|
package com.fankes.tsbattery.hook
|
||||||
|
|
||||||
|
object HookConst {
|
||||||
|
|
||||||
|
const val QQ_PACKAGE_NAME = "com.tencent.mobileqq"
|
||||||
|
const val TIM_PACKAGE_NAME = "com.tencent.tim"
|
||||||
|
const val WECHAT_PACKAGE_NAME = "com.tencent.mm"
|
||||||
|
}
|
712
app/src/main/java/com/fankes/tsbattery/hook/HookEntry.kt
Normal file
@@ -0,0 +1,712 @@
|
|||||||
|
/*
|
||||||
|
* TSBattery - A new way to save your battery avoid cancer apps hacker it.
|
||||||
|
* Copyright (C) 2019-2022 Fankes Studio(qzmmcn@163.com)
|
||||||
|
* https://github.com/fankes/TSBattery
|
||||||
|
*
|
||||||
|
* This software is non-free but opensource software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public License
|
||||||
|
* as published by the Free Software Foundation; either
|
||||||
|
* version 3 of the License, or any later version.
|
||||||
|
*
|
||||||
|
* This software is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* and eula along with this software. If not, see
|
||||||
|
* <https://www.gnu.org/licenses/>
|
||||||
|
*
|
||||||
|
* This file is Created by fankes on 2022/2/15.
|
||||||
|
*/
|
||||||
|
@file:Suppress("IMPLICIT_CAST_TO_ANY")
|
||||||
|
|
||||||
|
package com.fankes.tsbattery.hook
|
||||||
|
|
||||||
|
import android.app.Activity
|
||||||
|
import android.app.Service
|
||||||
|
import android.content.ComponentName
|
||||||
|
import android.content.Intent
|
||||||
|
import android.os.Build
|
||||||
|
import android.view.View
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import android.view.ViewGroup.LayoutParams.MATCH_PARENT
|
||||||
|
import android.view.ViewGroup.LayoutParams.WRAP_CONTENT
|
||||||
|
import android.view.ViewGroup.MarginLayoutParams
|
||||||
|
import android.widget.Toast
|
||||||
|
import com.fankes.tsbattery.BuildConfig
|
||||||
|
import com.fankes.tsbattery.data.DataConst
|
||||||
|
import com.fankes.tsbattery.hook.HookConst.QQ_PACKAGE_NAME
|
||||||
|
import com.fankes.tsbattery.hook.HookConst.TIM_PACKAGE_NAME
|
||||||
|
import com.fankes.tsbattery.hook.HookConst.WECHAT_PACKAGE_NAME
|
||||||
|
import com.fankes.tsbattery.ui.activity.MainActivity
|
||||||
|
import com.fankes.tsbattery.utils.factory.dp
|
||||||
|
import com.fankes.tsbattery.utils.factory.showDialog
|
||||||
|
import com.fankes.tsbattery.utils.factory.versionCode
|
||||||
|
import com.fankes.tsbattery.utils.factory.versionName
|
||||||
|
import com.highcapable.yukihookapi.annotation.xposed.InjectYukiHookWithXposed
|
||||||
|
import com.highcapable.yukihookapi.hook.bean.VariousClass
|
||||||
|
import com.highcapable.yukihookapi.hook.factory.*
|
||||||
|
import com.highcapable.yukihookapi.hook.log.loggerD
|
||||||
|
import com.highcapable.yukihookapi.hook.log.loggerE
|
||||||
|
import com.highcapable.yukihookapi.hook.param.PackageParam
|
||||||
|
import com.highcapable.yukihookapi.hook.type.android.*
|
||||||
|
import com.highcapable.yukihookapi.hook.type.java.*
|
||||||
|
import com.highcapable.yukihookapi.hook.xposed.proxy.IYukiHookXposedInit
|
||||||
|
|
||||||
|
@InjectYukiHookWithXposed(isUsingResourcesHook = false)
|
||||||
|
class HookEntry : IYukiHookXposedInit {
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
|
||||||
|
/** QQ、TIM 存在的类 */
|
||||||
|
private const val SplashActivityClass = "$QQ_PACKAGE_NAME.activity.SplashActivity"
|
||||||
|
|
||||||
|
/** QQ、TIM 存在的类 */
|
||||||
|
private const val CoreServiceClass = "$QQ_PACKAGE_NAME.app.CoreService"
|
||||||
|
|
||||||
|
/** QQ、TIM 存在的类 */
|
||||||
|
private const val CoreService_KernelServiceClass = "$QQ_PACKAGE_NAME.app.CoreService\$KernelService"
|
||||||
|
|
||||||
|
/** QQ、TIM 新版本存在的类 */
|
||||||
|
private const val FormSimpleItemClass = "$QQ_PACKAGE_NAME.widget.FormSimpleItem"
|
||||||
|
|
||||||
|
/** QQ、TIM 旧版本存在的类 */
|
||||||
|
private const val FormCommonSingleLineItemClass = "$QQ_PACKAGE_NAME.widget.FormCommonSingleLineItem"
|
||||||
|
|
||||||
|
/** 微信存在的类 */
|
||||||
|
private const val LauncherUIClass = "$WECHAT_PACKAGE_NAME.ui.LauncherUI"
|
||||||
|
|
||||||
|
/** 根据多个版本存的不同的类 */
|
||||||
|
private val BaseChatPieClass = VariousClass(
|
||||||
|
"$QQ_PACKAGE_NAME.activity.aio.core.BaseChatPie",
|
||||||
|
"$QQ_PACKAGE_NAME.activity.BaseChatPie"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 是否完全支持当前版本 */
|
||||||
|
private var isHookClientSupport = true
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 这个类 QQ 的 BaseChatPie 是控制聊天界面的
|
||||||
|
*
|
||||||
|
* 里面有两个随机混淆的方法 ⬇
|
||||||
|
*
|
||||||
|
* remainScreenOn、cancelRemainScreenOn
|
||||||
|
*
|
||||||
|
* 这两个方法一个是挂起电源锁常驻亮屏
|
||||||
|
*
|
||||||
|
* 一个是停止常驻亮屏
|
||||||
|
*
|
||||||
|
* 不由分说每个版本混淆的方法名都会变
|
||||||
|
*
|
||||||
|
* 所以说每个版本重新适配 - 也可以提交分支帮我适配
|
||||||
|
*
|
||||||
|
* - ❗Hook 错了方法会造成闪退!
|
||||||
|
* @param version QQ 版本
|
||||||
|
*/
|
||||||
|
private fun PackageParam.hookQQBaseChatPie(version: String) {
|
||||||
|
when (version) {
|
||||||
|
"8.0.0" -> {
|
||||||
|
interceptBaseChatPie(methodName = "bq")
|
||||||
|
interceptBaseChatPie(methodName = "aL")
|
||||||
|
}
|
||||||
|
"8.0.5", "8.0.7" -> {
|
||||||
|
interceptBaseChatPie(methodName = "bw")
|
||||||
|
interceptBaseChatPie(methodName = "aQ")
|
||||||
|
}
|
||||||
|
"8.1.0", "8.1.3" -> {
|
||||||
|
interceptBaseChatPie(methodName = "bE")
|
||||||
|
interceptBaseChatPie(methodName = "aT")
|
||||||
|
}
|
||||||
|
"8.1.5" -> {
|
||||||
|
interceptBaseChatPie(methodName = "bF")
|
||||||
|
interceptBaseChatPie(methodName = "aT")
|
||||||
|
}
|
||||||
|
"8.1.8", "8.2.0", "8.2.6" -> {
|
||||||
|
interceptBaseChatPie(methodName = "bC")
|
||||||
|
interceptBaseChatPie(methodName = "aT")
|
||||||
|
}
|
||||||
|
"8.2.7", "8.2.8", "8.2.11", "8.3.0" -> {
|
||||||
|
interceptBaseChatPie(methodName = "bE")
|
||||||
|
interceptBaseChatPie(methodName = "aV")
|
||||||
|
}
|
||||||
|
"8.3.5" -> {
|
||||||
|
interceptBaseChatPie(methodName = "bR")
|
||||||
|
interceptBaseChatPie(methodName = "aX")
|
||||||
|
}
|
||||||
|
"8.3.6" -> {
|
||||||
|
interceptBaseChatPie(methodName = "cp")
|
||||||
|
interceptBaseChatPie(methodName = "aX")
|
||||||
|
}
|
||||||
|
"8.3.9" -> {
|
||||||
|
interceptBaseChatPie(methodName = "cj")
|
||||||
|
interceptBaseChatPie(methodName = "aT")
|
||||||
|
}
|
||||||
|
"8.4.1", "8.4.5" -> {
|
||||||
|
interceptBaseChatPie(methodName = "ck")
|
||||||
|
interceptBaseChatPie(methodName = "aT")
|
||||||
|
}
|
||||||
|
"8.4.8", "8.4.10", "8.4.17", "8.4.18", "8.5.0" -> {
|
||||||
|
interceptBaseChatPie(methodName = "remainScreenOn")
|
||||||
|
interceptBaseChatPie(methodName = "cancelRemainScreenOn")
|
||||||
|
}
|
||||||
|
"8.5.5" -> {
|
||||||
|
interceptBaseChatPie(methodName = "bT")
|
||||||
|
interceptBaseChatPie(methodName = "aN")
|
||||||
|
}
|
||||||
|
"8.6.0", "8.6.5", "8.7.0", "8.7.5", "8.7.8", "8.8.0", "8.8.3", "8.8.5" -> {
|
||||||
|
interceptBaseChatPie(methodName = "ag")
|
||||||
|
interceptBaseChatPie(methodName = "ah")
|
||||||
|
}
|
||||||
|
"8.8.11", "8.8.12" -> {
|
||||||
|
interceptBaseChatPie(methodName = "bc")
|
||||||
|
interceptBaseChatPie(methodName = "bd")
|
||||||
|
}
|
||||||
|
"8.8.17", "8.8.20" -> {
|
||||||
|
interceptBaseChatPie(methodName = "bd")
|
||||||
|
interceptBaseChatPie(methodName = "be")
|
||||||
|
}
|
||||||
|
"8.8.23", "8.8.28" -> {
|
||||||
|
interceptBaseChatPie(methodName = "bf")
|
||||||
|
interceptBaseChatPie(methodName = "bg")
|
||||||
|
}
|
||||||
|
"8.8.33" -> {
|
||||||
|
interceptBaseChatPie(methodName = "bg")
|
||||||
|
interceptBaseChatPie(methodName = "bh")
|
||||||
|
}
|
||||||
|
"8.8.35", "8.8.38" -> {
|
||||||
|
interceptBaseChatPie(methodName = "bi")
|
||||||
|
interceptBaseChatPie(methodName = "bj")
|
||||||
|
}
|
||||||
|
"8.8.50" -> {
|
||||||
|
interceptBaseChatPie(methodName = "bj")
|
||||||
|
interceptBaseChatPie(methodName = "bk")
|
||||||
|
}
|
||||||
|
"8.8.55", "8.8.68", "8.8.80" -> {
|
||||||
|
interceptBaseChatPie(methodName = "bk")
|
||||||
|
interceptBaseChatPie(methodName = "bl")
|
||||||
|
}
|
||||||
|
"8.8.83", "8.8.85", "8.8.88", "8.8.90" -> {
|
||||||
|
interceptBaseChatPie(methodName = "bl")
|
||||||
|
interceptBaseChatPie(methodName = "bm")
|
||||||
|
}
|
||||||
|
"8.8.93", "8.8.95" -> {
|
||||||
|
interceptBaseChatPie(methodName = "J3")
|
||||||
|
interceptBaseChatPie(methodName = "S")
|
||||||
|
}
|
||||||
|
"8.8.98" -> {
|
||||||
|
interceptBaseChatPie(methodName = "M3")
|
||||||
|
interceptBaseChatPie(methodName = "S")
|
||||||
|
}
|
||||||
|
"8.9.0", "8.9.1", "8.9.2" -> {
|
||||||
|
interceptBaseChatPie(methodName = "N3")
|
||||||
|
interceptBaseChatPie(methodName = "S")
|
||||||
|
}
|
||||||
|
else -> {
|
||||||
|
isHookClientSupport = false
|
||||||
|
loggerD(msg = "$version not supported!")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拦截 [BaseChatPieClass] 的目标方法体封装
|
||||||
|
* @param methodName 方法名
|
||||||
|
*/
|
||||||
|
private fun PackageParam.interceptBaseChatPie(methodName: String) =
|
||||||
|
BaseChatPieClass.hook {
|
||||||
|
injectMember {
|
||||||
|
method {
|
||||||
|
name = methodName
|
||||||
|
emptyParam()
|
||||||
|
returnType = UnitType
|
||||||
|
}
|
||||||
|
intercept()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Hook 系统电源锁 */
|
||||||
|
private fun PackageParam.hookSystemWakeLock() =
|
||||||
|
PowerManager_WakeLockClass.hook {
|
||||||
|
injectMember {
|
||||||
|
method {
|
||||||
|
name = "acquireLocked"
|
||||||
|
emptyParam()
|
||||||
|
}
|
||||||
|
intercept()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 增加通知栏文本显示守护状态 */
|
||||||
|
private fun PackageParam.hookNotification() =
|
||||||
|
Notification_BuilderClass.hook {
|
||||||
|
injectMember {
|
||||||
|
method {
|
||||||
|
name = "setContentText"
|
||||||
|
param(CharSequenceType)
|
||||||
|
}
|
||||||
|
beforeHook {
|
||||||
|
if (prefs.get(DataConst.ENABLE_NOTIFY_TIP))
|
||||||
|
when (args().first().cast<CharSequence>()) {
|
||||||
|
"QQ正在后台运行" ->
|
||||||
|
args().first().set("QQ正在后台运行 - TSBattery 守护中")
|
||||||
|
"TIM正在后台运行" ->
|
||||||
|
args().first().set("TIM正在后台运行 - TSBattery 守护中")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提示模块运行信息 QQ、TIM、微信
|
||||||
|
* @param isQQ 是否为 QQ
|
||||||
|
* @param isTIM 是否为 TIM
|
||||||
|
*/
|
||||||
|
private fun PackageParam.hookModuleRunningInfo(isQQ: Boolean = false, isTIM: Boolean = false) =
|
||||||
|
when {
|
||||||
|
isQQ || isTIM -> SplashActivityClass.hook {
|
||||||
|
/**
|
||||||
|
* Hook 启动界面的第一个 [Activity]
|
||||||
|
* QQ 和 TIM 都是一样的类
|
||||||
|
* 在里面加入提示运行信息的对话框测试模块是否激活
|
||||||
|
*/
|
||||||
|
injectMember {
|
||||||
|
method {
|
||||||
|
name = "doOnCreate"
|
||||||
|
param(BundleClass)
|
||||||
|
}
|
||||||
|
afterHook {
|
||||||
|
if (prefs.get(DataConst.ENABLE_RUN_INFO))
|
||||||
|
instance<Activity>().apply {
|
||||||
|
showDialog {
|
||||||
|
title = "TSBattery 已激活"
|
||||||
|
msg = "[提示模块运行信息功能已打开]\n\n" +
|
||||||
|
(if (isQQ && isHookClientSupport.not())
|
||||||
|
"❎ 当前版本 $versionName($versionCode) 不在兼容列表,请自行测试是否生效~\n\n"
|
||||||
|
else "✅ 模块工作看起来一切正常,请自行测试是否能达到省电效果。\n\n") +
|
||||||
|
"已生效模块版本:${prefs.get(DataConst.ENABLE_MODULE_VERSION)}\n" +
|
||||||
|
"当前模式:${if (prefs.get(DataConst.ENABLE_QQTIM_WHITE_MODE)) "保守模式" else "完全模式"}" +
|
||||||
|
"\n\n包名:${packageName}\n版本:$versionName($versionCode)" +
|
||||||
|
"\n\n模块只对挂后台锁屏情况下有省电效果," +
|
||||||
|
"请不要将过多的群提醒,消息通知打开,这样子在使用过程时照样会极其耗电。\n\n" +
|
||||||
|
"如果你不想看到此提示。请在模块设置中关闭“提示模块运行信息”,此设置默认关闭。\n\n" +
|
||||||
|
"持续常驻使用 QQ、TIM 依然会耗电,任何软件都是如此," +
|
||||||
|
"模块是无法帮你做到前台不耗电的。\n\n" +
|
||||||
|
"开发者 酷安 @星夜不荟\n未经允许禁止转载、修改或复制我的劳动成果。"
|
||||||
|
confirmButton(text = "我知道了")
|
||||||
|
noCancelable()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else -> LauncherUIClass.hook {
|
||||||
|
/**
|
||||||
|
* Hook 启动界面的第一个 [Activity]
|
||||||
|
* 在里面加入提示运行信息的对话框测试模块是否激活
|
||||||
|
*/
|
||||||
|
injectMember {
|
||||||
|
method {
|
||||||
|
name = "onCreate"
|
||||||
|
param(BundleClass)
|
||||||
|
}
|
||||||
|
afterHook {
|
||||||
|
if (prefs.get(DataConst.ENABLE_RUN_INFO))
|
||||||
|
instance<Activity>().apply {
|
||||||
|
showDialog(isUseBlackTheme = true) {
|
||||||
|
title = "TSBattery 已激活"
|
||||||
|
msg = "[提示模块运行信息功能已打开]\n\n" +
|
||||||
|
"模块工作看起来一切正常,请自行测试是否能达到省电效果。\n\n" +
|
||||||
|
"已生效模块版本:${prefs.get(DataConst.ENABLE_MODULE_VERSION)}\n" +
|
||||||
|
"当前模式:基础省电" +
|
||||||
|
"\n\n包名:${packageName}\n版本:$versionName($versionCode)" +
|
||||||
|
"\n\n当前只支持微信的基础省电,即系统电源锁,后续会继续适配微信相关的省电功能(在新建文件夹了)。\n\n" +
|
||||||
|
"如果你不想看到此提示。请在模块设置中关闭“提示模块运行信息”,此设置默认关闭。\n\n" +
|
||||||
|
"持续常驻使用微信依然会耗电,任何软件都是如此," +
|
||||||
|
"模块是无法帮你做到前台不耗电的。\n\n" +
|
||||||
|
"开发者 酷安 @星夜不荟\n未经允许禁止转载、修改或复制我的劳动成果。"
|
||||||
|
confirmButton(text = "我知道了")
|
||||||
|
noCancelable()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hook CoreService QQ、TIM
|
||||||
|
* @param isQQ 是否为 QQ - 单独处理
|
||||||
|
*/
|
||||||
|
private fun PackageParam.hookCoreService(isQQ: Boolean) {
|
||||||
|
CoreServiceClass.hook {
|
||||||
|
if (isQQ) {
|
||||||
|
injectMember {
|
||||||
|
method { name = "startTempService" }
|
||||||
|
intercept()
|
||||||
|
}.ignoredNoSuchMemberFailure()
|
||||||
|
injectMember {
|
||||||
|
method {
|
||||||
|
name = "startCoreService"
|
||||||
|
param(BooleanType)
|
||||||
|
}
|
||||||
|
intercept()
|
||||||
|
}.ignoredNoSuchMemberFailure()
|
||||||
|
injectMember {
|
||||||
|
method {
|
||||||
|
name = "onStartCommand"
|
||||||
|
param(IntentClass, IntType, IntType)
|
||||||
|
}
|
||||||
|
replaceTo(any = 2)
|
||||||
|
}.ignoredNoSuchMemberFailure()
|
||||||
|
}
|
||||||
|
injectMember {
|
||||||
|
method { name = "onCreate" }
|
||||||
|
afterHook {
|
||||||
|
if (prefs.get(DataConst.ENABLE_QQTIM_CORESERVICE_BAN))
|
||||||
|
instance<Service>().apply {
|
||||||
|
stopForeground(true)
|
||||||
|
stopSelf()
|
||||||
|
loggerD(msg = "Shutdown CoreService OK!")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CoreService_KernelServiceClass.hook {
|
||||||
|
injectMember {
|
||||||
|
method { name = "onCreate" }
|
||||||
|
afterHook {
|
||||||
|
if (prefs.get(DataConst.ENABLE_QQTIM_CORESERVICE_CHILD_BAN))
|
||||||
|
instance<Service>().apply {
|
||||||
|
stopForeground(true)
|
||||||
|
stopSelf()
|
||||||
|
loggerD(msg = "Shutdown CoreService\$KernelService OK!")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
injectMember {
|
||||||
|
method {
|
||||||
|
name = "onStartCommand"
|
||||||
|
param(IntentClass, IntType, IntType)
|
||||||
|
}
|
||||||
|
replaceTo(any = 2)
|
||||||
|
}.ignoredNoSuchMemberFailure()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将激活状态插入到设置页面
|
||||||
|
* @param isQQ 是否为 QQ - 单独处理
|
||||||
|
*/
|
||||||
|
private fun PackageParam.hookQQSettingsSettingActivity(isQQ: Boolean) =
|
||||||
|
findClass(name = "$QQ_PACKAGE_NAME.activity.QQSettingSettingActivity").hook {
|
||||||
|
injectMember {
|
||||||
|
method {
|
||||||
|
name = "doOnCreate"
|
||||||
|
param(BundleClass)
|
||||||
|
afterHook {
|
||||||
|
/** 是否启用 Hook */
|
||||||
|
if (prefs.get(DataConst.ENABLE_SETTING_TIP).not()) return@afterHook
|
||||||
|
/** 当前的顶级 Item 实例 */
|
||||||
|
val formItemRefRoot = field {
|
||||||
|
type(FormSimpleItemClass).index(num = 1)
|
||||||
|
}.ignoredError().get(instance).cast() ?: field {
|
||||||
|
type(FormCommonSingleLineItemClass).index(num = 1)
|
||||||
|
}.ignoredError().get(instance).cast<View?>()
|
||||||
|
/** 创建一个新的 Item */
|
||||||
|
FormSimpleItemClass.clazz.buildOf<View>(instance) { param(ContextClass) }?.current {
|
||||||
|
method {
|
||||||
|
name = "setLeftText"
|
||||||
|
param(CharSequenceType)
|
||||||
|
}.call("TSBattery")
|
||||||
|
method {
|
||||||
|
name = "setRightText"
|
||||||
|
param(CharSequenceType)
|
||||||
|
}.call("${if (isQQ && isHookClientSupport.not()) "❎" else "✅"} ${prefs.get(DataConst.ENABLE_MODULE_VERSION)}")
|
||||||
|
method {
|
||||||
|
name = "setBgType"
|
||||||
|
param(IntType)
|
||||||
|
}.call(if (isQQ) 0 else 2)
|
||||||
|
}?.apply {
|
||||||
|
setOnClickListener {
|
||||||
|
instance<Activity>().apply {
|
||||||
|
showDialog {
|
||||||
|
title = "TSBattery 守护中"
|
||||||
|
msg = (if (isQQ && isHookClientSupport.not())
|
||||||
|
"❎ 当前版本 $versionName($versionCode) 不在兼容列表,请自行测试是否生效~\n\n" else "") +
|
||||||
|
"已生效模块版本:${prefs.get(DataConst.ENABLE_MODULE_VERSION)}\n" +
|
||||||
|
"当前模式:${if (prefs.get(DataConst.ENABLE_QQTIM_WHITE_MODE)) "保守模式" else "完全模式"}" +
|
||||||
|
"\n\n包名:${packageName}\n版本:$versionName($versionCode)" +
|
||||||
|
"\n\n模块只对挂后台锁屏情况下有省电效果," +
|
||||||
|
"请不要将过多的群提醒,消息通知打开,这样子在使用过程时照样会极其耗电。\n\n" +
|
||||||
|
"持续常驻使用 QQ、TIM 依然会耗电,任何软件都是如此," +
|
||||||
|
"模块是无法帮你做到前台不耗电的。\n\n" +
|
||||||
|
"开发者 酷安 @星夜不荟\n未经允许禁止转载、修改或复制我的劳动成果。"
|
||||||
|
confirmButton(text = "打开模块设置") {
|
||||||
|
runCatching {
|
||||||
|
startActivity(Intent().apply {
|
||||||
|
flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
||||||
|
component = ComponentName(
|
||||||
|
BuildConfig.APPLICATION_ID,
|
||||||
|
MainActivity::class.java.name
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}.onFailure { Toast.makeText(context, "启动失败", Toast.LENGTH_SHORT).show() }
|
||||||
|
}
|
||||||
|
cancelButton(text = "关闭")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}?.also { item ->
|
||||||
|
var listGroup = formItemRefRoot?.parent as? ViewGroup?
|
||||||
|
val lparam = (if (listGroup?.childCount == 1) {
|
||||||
|
listGroup = listGroup.parent as? ViewGroup
|
||||||
|
(formItemRefRoot?.parent as? View?)?.layoutParams
|
||||||
|
} else formItemRefRoot?.layoutParams) ?: ViewGroup.LayoutParams(MATCH_PARENT, WRAP_CONTENT)
|
||||||
|
/** 设置圆角和间距 */
|
||||||
|
if (isQQ) (lparam as? MarginLayoutParams?)?.setMargins(0, 15.dp(item.context), 0, 0)
|
||||||
|
/** 将 Item 添加到设置界面 */
|
||||||
|
listGroup?.also { if (isQQ) it.addView(item, lparam) else it.addView(item, 0, lparam) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onInit() = configs {
|
||||||
|
debugTag = "TSBattery"
|
||||||
|
isDebug = false
|
||||||
|
isEnableModulePrefsCache = false
|
||||||
|
isEnableDataChannel = false
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onHook() = encase {
|
||||||
|
loadApp(QQ_PACKAGE_NAME) {
|
||||||
|
hookSystemWakeLock()
|
||||||
|
hookNotification()
|
||||||
|
hookCoreService(isQQ = true)
|
||||||
|
hookModuleRunningInfo(isQQ = true)
|
||||||
|
hookQQSettingsSettingActivity(isQQ = true)
|
||||||
|
if (prefs.get(DataConst.ENABLE_QQTIM_WHITE_MODE)) return@loadApp
|
||||||
|
/** 通过在生命周期里取到应用的版本号 */
|
||||||
|
onAppLifecycle { onCreate { hookQQBaseChatPie(versionName) } }
|
||||||
|
/**
|
||||||
|
* 干掉消息收发功能的电源锁
|
||||||
|
* 每个版本的差异暂未做排查
|
||||||
|
* 旧版本理论上没有这个类
|
||||||
|
*/
|
||||||
|
findClass(name = "$QQ_PACKAGE_NAME.msf.service.y").hook {
|
||||||
|
injectMember {
|
||||||
|
method {
|
||||||
|
name = "a"
|
||||||
|
param(StringType, LongType)
|
||||||
|
returnType = UnitType
|
||||||
|
}
|
||||||
|
intercept()
|
||||||
|
}.onAllFailure { loggerE(msg = "Hook MsfService Failed $it") }
|
||||||
|
}.ignoredHookClassNotFoundFailure()
|
||||||
|
/**
|
||||||
|
* 干掉自动上传服务的电源锁
|
||||||
|
* 每个版本的差异暂未做排查
|
||||||
|
*/
|
||||||
|
findClass(name = "com.tencent.upload.impl.UploadServiceImpl").hook {
|
||||||
|
injectMember {
|
||||||
|
method { name = "acquireWakeLockIfNot" }
|
||||||
|
intercept()
|
||||||
|
}.onAllFailure { loggerE(msg = "Hook UploadServiceImpl Failed $it") }
|
||||||
|
}.ignoredHookClassNotFoundFailure()
|
||||||
|
/**
|
||||||
|
* Hook 掉一个一像素保活 [Activity] 真的我怎么都想不到讯哥的程序员做出这种事情
|
||||||
|
* 这个东西经过测试会在锁屏的时候吊起来,解锁的时候自动 finish(),无限耍流氓耗电
|
||||||
|
* 2022/1/25 后期查证:锁屏界面消息快速回复窗口的解锁后拉起保活界面,也是毒瘤
|
||||||
|
*/
|
||||||
|
findClass(name = "$QQ_PACKAGE_NAME.activity.QQLSUnlockActivity").hook {
|
||||||
|
injectMember {
|
||||||
|
method {
|
||||||
|
name = "onCreate"
|
||||||
|
param(BundleClass)
|
||||||
|
}
|
||||||
|
var origDevice = ""
|
||||||
|
beforeHook {
|
||||||
|
/** 由于在 onCreate 里有一行判断只要型号是 xiaomi 的设备就开电源锁,所以说这里临时替换成菊花厂 */
|
||||||
|
origDevice = Build.MANUFACTURER
|
||||||
|
if (Build.MANUFACTURER.lowercase() == "xiaomi")
|
||||||
|
BuildClass.field { name = "MANUFACTURER" }.get().set("HUAWEI")
|
||||||
|
}
|
||||||
|
afterHook {
|
||||||
|
instance<Activity>().finish()
|
||||||
|
/** 这里再把型号替换回去 - 不影响应用变量等 Xposed 模块修改的型号 */
|
||||||
|
BuildClass.field { name = "MANUFACTURER" }.get().set(origDevice)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 这个东西同上
|
||||||
|
* 反正也是一个一像素保活的 [Activity]
|
||||||
|
* 讯哥的程序员真的有你的
|
||||||
|
* 2022/1/25 后期查证:锁屏界面消息快速回复窗口
|
||||||
|
*/
|
||||||
|
findClass("$QQ_PACKAGE_NAME.activity.QQLSActivity\$14", "ktq").hook {
|
||||||
|
injectMember {
|
||||||
|
method { name = "run" }
|
||||||
|
intercept()
|
||||||
|
}.ignoredAllFailure()
|
||||||
|
}.ignoredHookClassNotFoundFailure()
|
||||||
|
/**
|
||||||
|
* 这个是毒瘤核心类
|
||||||
|
* WakeLockMonitor
|
||||||
|
* 这个名字真的起的特别诗情画意
|
||||||
|
* 带给用户的却是 shit 一样的体验
|
||||||
|
* 里面有各种使用 Handler 和 Timer 的各种耗时常驻后台耗电办法持续接收消息
|
||||||
|
* 直接循环全部方法全部干掉
|
||||||
|
* 👮🏻 经过排查 Play 版本没这个类...... Emmmm 不想说啥了
|
||||||
|
*/
|
||||||
|
findClass(name = "com.tencent.qapmsdk.qqbattery.monitor.WakeLockMonitor").hook {
|
||||||
|
injectMember {
|
||||||
|
method {
|
||||||
|
name = "onHook"
|
||||||
|
param(StringType, AnyType, AnyArrayClass, AnyType)
|
||||||
|
}
|
||||||
|
intercept()
|
||||||
|
}
|
||||||
|
injectMember {
|
||||||
|
method {
|
||||||
|
name = "doReport"
|
||||||
|
param("com.tencent.qapmsdk.qqbattery.monitor.WakeLockMonitor\$WakeLockEntity", IntType)
|
||||||
|
}
|
||||||
|
intercept()
|
||||||
|
}
|
||||||
|
injectMember {
|
||||||
|
method {
|
||||||
|
name = "afterHookedMethod"
|
||||||
|
param("com.tencent.qapmsdk.qqbattery.monitor.MethodHookParam")
|
||||||
|
}
|
||||||
|
intercept()
|
||||||
|
}
|
||||||
|
injectMember {
|
||||||
|
method {
|
||||||
|
name = "beforeHookedMethod"
|
||||||
|
param("com.tencent.qapmsdk.qqbattery.monitor.MethodHookParam")
|
||||||
|
}
|
||||||
|
intercept()
|
||||||
|
}
|
||||||
|
injectMember {
|
||||||
|
method { name = "onAppBackground" }
|
||||||
|
intercept()
|
||||||
|
}
|
||||||
|
injectMember {
|
||||||
|
method {
|
||||||
|
name = "onOtherProcReport"
|
||||||
|
param(BundleClass)
|
||||||
|
}
|
||||||
|
intercept()
|
||||||
|
}
|
||||||
|
injectMember {
|
||||||
|
method { name = "onProcessRun30Min" }
|
||||||
|
intercept()
|
||||||
|
}
|
||||||
|
injectMember {
|
||||||
|
method { name = "onProcessBG5Min" }
|
||||||
|
intercept()
|
||||||
|
}
|
||||||
|
injectMember {
|
||||||
|
method {
|
||||||
|
name = "writeReport"
|
||||||
|
param(BooleanType)
|
||||||
|
}
|
||||||
|
intercept()
|
||||||
|
}
|
||||||
|
}.ignoredHookClassNotFoundFailure()
|
||||||
|
/**
|
||||||
|
* 这个是毒瘤核心操作类
|
||||||
|
* 功能同上、全部拦截
|
||||||
|
* 👮🏻 经过排查 Play 版本也没这个类...... Emmmm 不想说啥了
|
||||||
|
*/
|
||||||
|
findClass(name = "com.tencent.qapmsdk.qqbattery.QQBatteryMonitor").hook {
|
||||||
|
injectMember {
|
||||||
|
method { name = "start" }
|
||||||
|
intercept()
|
||||||
|
}
|
||||||
|
injectMember {
|
||||||
|
method { name = "stop" }
|
||||||
|
intercept()
|
||||||
|
}
|
||||||
|
injectMember {
|
||||||
|
method {
|
||||||
|
name = "handleMessage"
|
||||||
|
param(MessageClass)
|
||||||
|
}
|
||||||
|
replaceToTrue()
|
||||||
|
}
|
||||||
|
injectMember {
|
||||||
|
method { name = "startMonitorInner" }
|
||||||
|
intercept()
|
||||||
|
}
|
||||||
|
injectMember {
|
||||||
|
method { name = "onAppBackground" }
|
||||||
|
intercept()
|
||||||
|
}
|
||||||
|
injectMember {
|
||||||
|
method { name = "onAppForeground" }
|
||||||
|
intercept()
|
||||||
|
}
|
||||||
|
injectMember {
|
||||||
|
method {
|
||||||
|
name = "setLogWhite"
|
||||||
|
paramCount = 2
|
||||||
|
}
|
||||||
|
intercept()
|
||||||
|
}
|
||||||
|
injectMember {
|
||||||
|
method {
|
||||||
|
name = "setCmdWhite"
|
||||||
|
paramCount = 2
|
||||||
|
}
|
||||||
|
intercept()
|
||||||
|
}
|
||||||
|
injectMember {
|
||||||
|
method {
|
||||||
|
name = "onWriteLog"
|
||||||
|
param(StringType, StringType)
|
||||||
|
}
|
||||||
|
intercept()
|
||||||
|
}
|
||||||
|
injectMember {
|
||||||
|
method {
|
||||||
|
name = "onCmdRequest"
|
||||||
|
param(StringType)
|
||||||
|
}
|
||||||
|
intercept()
|
||||||
|
}
|
||||||
|
injectMember {
|
||||||
|
method {
|
||||||
|
name = "addData"
|
||||||
|
paramCount = 4
|
||||||
|
}
|
||||||
|
intercept()
|
||||||
|
}
|
||||||
|
injectMember {
|
||||||
|
method {
|
||||||
|
name = "onGpsScan"
|
||||||
|
paramCount = 2
|
||||||
|
}
|
||||||
|
intercept()
|
||||||
|
}
|
||||||
|
}.ignoredHookClassNotFoundFailure()
|
||||||
|
}
|
||||||
|
loadApp(TIM_PACKAGE_NAME) {
|
||||||
|
hookSystemWakeLock()
|
||||||
|
hookNotification()
|
||||||
|
hookCoreService(isQQ = false)
|
||||||
|
hookModuleRunningInfo(isTIM = true)
|
||||||
|
hookQQSettingsSettingActivity(isQQ = false)
|
||||||
|
}
|
||||||
|
loadApp(WECHAT_PACKAGE_NAME) {
|
||||||
|
if (prefs.get(DataConst.DISABLE_WECHAT_HOOK)) return@loadApp
|
||||||
|
hookSystemWakeLock()
|
||||||
|
hookModuleRunningInfo()
|
||||||
|
loggerD(msg = "ウイチャット:それが機能するかどうかはわかりませんでした")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -1,399 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (C) 2021. Fankes Studio(qzmmcn@163.com)
|
|
||||||
*
|
|
||||||
* This file is part of TSBattery.
|
|
||||||
*
|
|
||||||
* TSBattery is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* TSBattery is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
* This file is Created by fankes on 2021/9/4.
|
|
||||||
*/
|
|
||||||
@file:Suppress("DEPRECATION", "SameParameterValue")
|
|
||||||
|
|
||||||
package com.fankes.tsbattery.hook
|
|
||||||
|
|
||||||
import android.app.Activity
|
|
||||||
import android.app.AlertDialog
|
|
||||||
import android.os.Build
|
|
||||||
import android.os.Bundle
|
|
||||||
import android.util.Log
|
|
||||||
import androidx.annotation.Keep
|
|
||||||
import com.fankes.tsbattery.utils.XPrefUtils
|
|
||||||
import de.robv.android.xposed.*
|
|
||||||
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
|
||||||
import java.util.*
|
|
||||||
|
|
||||||
@Keep
|
|
||||||
class HookMain : IXposedHookLoadPackage {
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
|
|
||||||
private const val BASE_CHAT_PIE = "activity.aio.core.BaseChatPie"
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 仅作用于替换的 Hook 方法体 */
|
|
||||||
private val replaceToNull = object : XC_MethodReplacement() {
|
|
||||||
override fun replaceHookedMethod(param: MethodHookParam?): Any? {
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 仅作用于替换的 Hook 方法体 */
|
|
||||||
private val replaceToTrue = object : XC_MethodReplacement() {
|
|
||||||
override fun replaceHookedMethod(param: MethodHookParam?): Any {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 干掉目标方法体封装
|
|
||||||
* @param clazz 类名缩写
|
|
||||||
* @param name 方法名
|
|
||||||
*/
|
|
||||||
private fun XC_LoadPackage.LoadPackageParam.replaceToNull(clazz: String, name: String) {
|
|
||||||
XposedHelpers.findAndHookMethod(
|
|
||||||
"com.tencent.mobileqq.$clazz",
|
|
||||||
classLoader,
|
|
||||||
name,
|
|
||||||
replaceToNull
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 忽略异常运行
|
|
||||||
* @param it 正常回调
|
|
||||||
*/
|
|
||||||
private fun runWithoutError(error: String, it: () -> Unit) {
|
|
||||||
try {
|
|
||||||
it()
|
|
||||||
} catch (e: Error) {
|
|
||||||
logE("hookFailed: $error", e)
|
|
||||||
} catch (e: Exception) {
|
|
||||||
logE("hookFailed: $error", e)
|
|
||||||
} catch (e: Throwable) {
|
|
||||||
logE("hookFailed: $error", e)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 这个类 BaseChatPie 是控制聊天界面的
|
|
||||||
* 里面有两个随机混淆的方法 ⬇️
|
|
||||||
* remainScreenOn、cancelRemainScreenOn
|
|
||||||
* 这两个方法一个是挂起电源锁常驻亮屏
|
|
||||||
* 一个是停止常驻亮屏
|
|
||||||
* 不由分说每个版本混淆的方法名都会变
|
|
||||||
* 所以说每个版本重新适配 - 也可以提交分支帮我适配
|
|
||||||
* ⚠️ Hook 错了方法会造成闪退!
|
|
||||||
* @param version QQ 版本
|
|
||||||
*/
|
|
||||||
private fun XC_LoadPackage.LoadPackageParam.hookBaseChatPie(version: String) {
|
|
||||||
when (version) {
|
|
||||||
"8.8.17" -> {
|
|
||||||
replaceToNull(BASE_CHAT_PIE, "bd")
|
|
||||||
replaceToNull(BASE_CHAT_PIE, "be")
|
|
||||||
}
|
|
||||||
"8.8.23" -> {
|
|
||||||
replaceToNull(BASE_CHAT_PIE, "bf")
|
|
||||||
replaceToNull(BASE_CHAT_PIE, "bg")
|
|
||||||
}
|
|
||||||
"8.8.38" -> {
|
|
||||||
replaceToNull(BASE_CHAT_PIE, "bi")
|
|
||||||
replaceToNull(BASE_CHAT_PIE, "bj")
|
|
||||||
}
|
|
||||||
/** 贡献者:JiZhi-Error */
|
|
||||||
"8.8.50" -> {
|
|
||||||
replaceToNull(BASE_CHAT_PIE, "bj")
|
|
||||||
replaceToNull(BASE_CHAT_PIE, "bk")
|
|
||||||
}
|
|
||||||
else -> logD("$version not supported!")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Print the log
|
|
||||||
* @param content
|
|
||||||
*/
|
|
||||||
private fun logD(content: String) {
|
|
||||||
XposedBridge.log(content)
|
|
||||||
Log.d("TSBattery", content)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Print the log
|
|
||||||
* @param content
|
|
||||||
*/
|
|
||||||
private fun logE(content: String, e: Throwable? = null) {
|
|
||||||
XposedBridge.log(content)
|
|
||||||
Log.e("TSBattery", content, e)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam?) {
|
|
||||||
if (lpparam == null) return
|
|
||||||
when (lpparam.packageName) {
|
|
||||||
/** Hook 自身 */
|
|
||||||
"com.fankes.tsbattery" ->
|
|
||||||
XposedHelpers.findAndHookMethod(
|
|
||||||
"com.fankes.tsbattery.hook.HookMedium",
|
|
||||||
lpparam.classLoader,
|
|
||||||
"isHooked",
|
|
||||||
replaceToTrue
|
|
||||||
)
|
|
||||||
/** 经过测试 QQ 与 TIM 这两个是一个模子里面的东西,所以他们的类名也基本上是一样的 */
|
|
||||||
"com.tencent.mobileqq", "com.tencent.tim" -> {
|
|
||||||
runWithoutError("wakeLock acquire()") {
|
|
||||||
XposedHelpers.findAndHookMethod(
|
|
||||||
"android.os.PowerManager\$WakeLock",
|
|
||||||
lpparam.classLoader,
|
|
||||||
"acquire",
|
|
||||||
replaceToNull
|
|
||||||
)
|
|
||||||
}
|
|
||||||
runWithoutError("hook wakeLock acquire(time)") {
|
|
||||||
XposedHelpers.findAndHookMethod(
|
|
||||||
"android.os.PowerManager\$WakeLock",
|
|
||||||
lpparam.classLoader,
|
|
||||||
"acquire",
|
|
||||||
Long::class.java,
|
|
||||||
replaceToNull
|
|
||||||
)
|
|
||||||
}
|
|
||||||
/** 增加通知栏文本显示守护状态 */
|
|
||||||
runWithoutError("Notification") {
|
|
||||||
XposedHelpers.findAndHookMethod(
|
|
||||||
"android.app.Notification\$Builder",
|
|
||||||
lpparam.classLoader,
|
|
||||||
"setContentText",
|
|
||||||
CharSequence::class.java,
|
|
||||||
object : XC_MethodHook() {
|
|
||||||
override fun beforeHookedMethod(param: MethodHookParam?) {
|
|
||||||
when (param?.args?.get(0) as? CharSequence?) {
|
|
||||||
"QQ正在后台运行" ->
|
|
||||||
param.args?.set(0, "QQ正在后台运行 - TSBattery 守护中")
|
|
||||||
"TIM正在后台运行" ->
|
|
||||||
param.args?.set(0, "TIM正在后台运行 - TSBattery 守护中")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
/** 判断是否开启提示模块运行信息 */
|
|
||||||
if (XPrefUtils.getBoolean(HookMedium.ENABLE_RUN_INFO))
|
|
||||||
runWithoutError("SplashActivity") {
|
|
||||||
/**
|
|
||||||
* Hook 启动界面的第一个 [Activity]
|
|
||||||
* QQ 和 TIM 都是一样的类
|
|
||||||
* 在里面加入提示运行信息的对话框测试模块是否激活
|
|
||||||
*/
|
|
||||||
XposedHelpers.findAndHookMethod(
|
|
||||||
"com.tencent.mobileqq.activity.SplashActivity",
|
|
||||||
lpparam.classLoader,
|
|
||||||
"doOnCreate",
|
|
||||||
Bundle::class.java,
|
|
||||||
object : XC_MethodHook() {
|
|
||||||
|
|
||||||
override fun afterHookedMethod(param: MethodHookParam?) {
|
|
||||||
val self = param?.thisObject as? Activity ?: return
|
|
||||||
runWithoutError("模块已激活,但显示信息弹窗失败了") {
|
|
||||||
AlertDialog.Builder(
|
|
||||||
self,
|
|
||||||
android.R.style.Theme_Material_Light_Dialog
|
|
||||||
).setCancelable(false)
|
|
||||||
.setTitle("TSBattery 已激活")
|
|
||||||
.setMessage(
|
|
||||||
"[提示模块运行信息功能已打开]\n" +
|
|
||||||
"模块工作看起来一切正常,请自行测试是否能达到省电效果。\n\n" +
|
|
||||||
"已生效模块版本:${XPrefUtils.getString(HookMedium.ENABLE_MODULE_VERSION)}\n" +
|
|
||||||
"当前模式:${if (XPrefUtils.getBoolean(HookMedium.ENABLE_WHITE_MODE)) "保守模式" else "完全模式"}" +
|
|
||||||
"\n\n包名:${self.packageName}\n版本:${
|
|
||||||
self.packageManager.getPackageInfo(
|
|
||||||
self.packageName,
|
|
||||||
0
|
|
||||||
).versionName
|
|
||||||
}(${
|
|
||||||
self.packageManager.getPackageInfo(
|
|
||||||
self.packageName,
|
|
||||||
0
|
|
||||||
).versionCode
|
|
||||||
})" + "\n\nPS:模块只对挂后台锁屏情况下有省电效果,请不要将过多的群提醒,消息通知打开,这样子在使用过程时照样会极其耗电。\n" +
|
|
||||||
"如果你不想看到此提示。请在模块设置中关闭“提示模块运行信息”,此设置默认关闭。\n" +
|
|
||||||
"开发者 酷安 @星夜不荟\n未经允许禁止转载、修改或复制我的劳动成果。"
|
|
||||||
)
|
|
||||||
.setPositiveButton("我知道了", null)
|
|
||||||
.show()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
/** 关闭保守模式后不再仅仅作用于系统电源锁 */
|
|
||||||
if (!XPrefUtils.getBoolean(HookMedium.ENABLE_WHITE_MODE)) {
|
|
||||||
runWithoutError("BaseChatPie(first time)") {
|
|
||||||
/** 通过在 SplashActivity 里取到应用的版本号 */
|
|
||||||
XposedHelpers.findAndHookMethod(
|
|
||||||
"com.tencent.mobileqq.activity.SplashActivity",
|
|
||||||
lpparam.classLoader,
|
|
||||||
"doOnCreate",
|
|
||||||
Bundle::class.java,
|
|
||||||
object : XC_MethodHook() {
|
|
||||||
|
|
||||||
override fun beforeHookedMethod(param: MethodHookParam?) {
|
|
||||||
val self = param?.thisObject as? Activity ?: return
|
|
||||||
val name = self.packageName
|
|
||||||
val version =
|
|
||||||
self.packageManager.getPackageInfo(name, 0).versionName
|
|
||||||
/** 这个地方我们只处理 QQ */
|
|
||||||
runWithoutError("BaseChatPie") {
|
|
||||||
if (name == "com.tencent.mobileqq")
|
|
||||||
lpparam.hookBaseChatPie(version)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
runWithoutError("WakerLock") {
|
|
||||||
/**
|
|
||||||
* 一个不知道是什么作用的电源锁
|
|
||||||
* 同样直接干掉
|
|
||||||
*/
|
|
||||||
XposedHelpers.findAndHookMethod(
|
|
||||||
"com.tencent.mars.ilink.comm.WakerLock",
|
|
||||||
lpparam.classLoader,
|
|
||||||
"lock", Long::class.java,
|
|
||||||
replaceToNull
|
|
||||||
)
|
|
||||||
}
|
|
||||||
runWithoutError("QQLSActivity") {
|
|
||||||
/**
|
|
||||||
* Hook 掉一个一像素保活 [Activity] 真的我怎么都想不到讯哥的程序员做出这种事情
|
|
||||||
* 这个东西经过测试会在锁屏的时候吊起来,解锁的时候自动 finish(),无限耍流氓耗电
|
|
||||||
*/
|
|
||||||
XposedHelpers.findAndHookMethod(
|
|
||||||
"com.tencent.mobileqq.activity.QQLSUnlockActivity",
|
|
||||||
lpparam.classLoader,
|
|
||||||
"onCreate", Bundle::class.java,
|
|
||||||
object : XC_MethodHook() {
|
|
||||||
|
|
||||||
private var origDevice = ""
|
|
||||||
|
|
||||||
override fun beforeHookedMethod(param: MethodHookParam?) {
|
|
||||||
/** 由于在 onCreate 里有一行判断只要型号是 xiaomi 的设备就开电源锁,所以说这里临时替换成菊花厂 */
|
|
||||||
origDevice = Build.MANUFACTURER
|
|
||||||
if (Build.MANUFACTURER.toLowerCase(Locale.ROOT) == "xiaomi")
|
|
||||||
XposedHelpers.setStaticObjectField(
|
|
||||||
Build::class.java,
|
|
||||||
"MANUFACTURER",
|
|
||||||
"HUAWEI"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun afterHookedMethod(param: MethodHookParam?) {
|
|
||||||
(param?.thisObject as? Activity)?.finish()
|
|
||||||
/** 这里再把型号替换回去 - 不影响应用变量等 Xposed 模块修改的型号 */
|
|
||||||
XposedHelpers.setStaticObjectField(
|
|
||||||
Build::class.java,
|
|
||||||
"MANUFACTURER",
|
|
||||||
origDevice
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
/**
|
|
||||||
* 这个东西同上,不知道是啥时候调用
|
|
||||||
* 反正也是一个一像素保活的 [Activity]
|
|
||||||
* 讯哥的程序员真的有你的
|
|
||||||
*/
|
|
||||||
XposedHelpers.findAndHookMethod(
|
|
||||||
"com.tencent.mobileqq.activity.QQLSActivity\$14",
|
|
||||||
lpparam.classLoader,
|
|
||||||
"run",
|
|
||||||
replaceToNull
|
|
||||||
)
|
|
||||||
}
|
|
||||||
runWithoutError("WakerLockMonitor") {
|
|
||||||
/**
|
|
||||||
* 这个是毒瘤核心类
|
|
||||||
* WakeLockMonitor
|
|
||||||
* 这个名字真的起的特别诗情画意
|
|
||||||
* 带给用户的却是 shit 一样的体验
|
|
||||||
* 里面有各种使用 Handler 和 Timer 的各种耗时常驻后台耗电办法持续接收消息
|
|
||||||
* 直接循环全部方法全部干掉
|
|
||||||
*/
|
|
||||||
lpparam.classLoader.loadClass("com.tencent.qapmsdk.qqbattery.monitor.WakeLockMonitor")
|
|
||||||
.apply {
|
|
||||||
val lockClazz =
|
|
||||||
lpparam.classLoader.loadClass("com.tencent.qapmsdk.qqbattery.monitor.WakeLockMonitor\$WakeLockEntity")
|
|
||||||
val hookClazz =
|
|
||||||
lpparam.classLoader.loadClass("com.tencent.qapmsdk.qqbattery.monitor.MethodHookParam")
|
|
||||||
val onHook = getDeclaredMethod(
|
|
||||||
"onHook",
|
|
||||||
String::class.java,
|
|
||||||
Any::class.java,
|
|
||||||
java.lang.reflect.Array.newInstance(
|
|
||||||
Any::class.java,
|
|
||||||
0
|
|
||||||
).javaClass,
|
|
||||||
Any::class.java
|
|
||||||
).apply { isAccessible = true }
|
|
||||||
val doReport =
|
|
||||||
getDeclaredMethod(
|
|
||||||
"doReport",
|
|
||||||
lockClazz,
|
|
||||||
Int::class.java
|
|
||||||
).apply {
|
|
||||||
isAccessible = true
|
|
||||||
}
|
|
||||||
val afterHookedMethod =
|
|
||||||
getDeclaredMethod(
|
|
||||||
"afterHookedMethod",
|
|
||||||
hookClazz
|
|
||||||
).apply { isAccessible = true }
|
|
||||||
val beforeHookedMethod =
|
|
||||||
getDeclaredMethod("beforeHookedMethod", hookClazz).apply {
|
|
||||||
isAccessible = true
|
|
||||||
}
|
|
||||||
val onAppBackground =
|
|
||||||
getDeclaredMethod("onAppBackground").apply {
|
|
||||||
isAccessible = true
|
|
||||||
}
|
|
||||||
val onOtherProcReport =
|
|
||||||
getDeclaredMethod(
|
|
||||||
"onOtherProcReport",
|
|
||||||
Bundle::class.java
|
|
||||||
).apply { isAccessible = true }
|
|
||||||
val onProcessRun30Min =
|
|
||||||
getDeclaredMethod("onProcessRun30Min").apply {
|
|
||||||
isAccessible = true
|
|
||||||
}
|
|
||||||
val onProcessBG5Min =
|
|
||||||
getDeclaredMethod("onProcessBG5Min").apply {
|
|
||||||
isAccessible = true
|
|
||||||
}
|
|
||||||
val writeReport =
|
|
||||||
getDeclaredMethod(
|
|
||||||
"writeReport",
|
|
||||||
Boolean::class.java
|
|
||||||
).apply { isAccessible = true }
|
|
||||||
XposedBridge.hookMethod(onHook, replaceToNull)
|
|
||||||
XposedBridge.hookMethod(doReport, replaceToNull)
|
|
||||||
XposedBridge.hookMethod(afterHookedMethod, replaceToNull)
|
|
||||||
XposedBridge.hookMethod(beforeHookedMethod, replaceToNull)
|
|
||||||
XposedBridge.hookMethod(onAppBackground, replaceToNull)
|
|
||||||
XposedBridge.hookMethod(onOtherProcReport, replaceToNull)
|
|
||||||
XposedBridge.hookMethod(onProcessRun30Min, replaceToNull)
|
|
||||||
XposedBridge.hookMethod(onProcessBG5Min, replaceToNull)
|
|
||||||
XposedBridge.hookMethod(writeReport, replaceToNull)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
logD("hook Completed!")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,79 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2021. Fankes Studio(qzmmcn@163.com)
|
|
||||||
*
|
|
||||||
* This file is part of TSBattery.
|
|
||||||
*
|
|
||||||
* TSBattery is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* TSBattery is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
* This file is Created by fankes on 2021/11/9.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.fankes.tsbattery.hook
|
|
||||||
|
|
||||||
import android.content.Intent
|
|
||||||
import android.net.Uri
|
|
||||||
import android.os.Bundle
|
|
||||||
import android.util.Log
|
|
||||||
import androidx.annotation.Keep
|
|
||||||
import com.fankes.tsbattery.ui.MainActivity
|
|
||||||
|
|
||||||
@Keep
|
|
||||||
object HookMedium {
|
|
||||||
|
|
||||||
const val ENABLE_HIDE_ICON = "_hide_icon"
|
|
||||||
const val ENABLE_RUN_INFO = "_tip_run_info"
|
|
||||||
const val ENABLE_WHITE_MODE = "_white_mode"
|
|
||||||
const val ENABLE_MODULE_VERSION = "_module_version"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 判断模块是否激活
|
|
||||||
* 在 [HookMain] 中 Hook 掉此方法
|
|
||||||
* @return 激活状态
|
|
||||||
*/
|
|
||||||
fun isHooked(): Boolean {
|
|
||||||
Log.d("TSBattery", "isHooked: true")
|
|
||||||
return isExpModuleActive()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增太极判断方式
|
|
||||||
* @return 是否激活
|
|
||||||
*/
|
|
||||||
private fun isExpModuleActive(): Boolean {
|
|
||||||
var isExp = false
|
|
||||||
MainActivity.instance?.also {
|
|
||||||
try {
|
|
||||||
val uri = Uri.parse("content://me.weishu.exposed.CP/")
|
|
||||||
var result: Bundle? = null
|
|
||||||
try {
|
|
||||||
result = it.contentResolver.call(uri, "active", null, null)
|
|
||||||
} catch (e: RuntimeException) {
|
|
||||||
// TaiChi is killed, try invoke
|
|
||||||
try {
|
|
||||||
val intent = Intent("me.weishu.exp.ACTION_ACTIVE")
|
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
|
||||||
it.startActivity(intent)
|
|
||||||
} catch (e1: Throwable) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (result == null) result = it.contentResolver.call(uri, "active", null, null)
|
|
||||||
if (result == null) return false
|
|
||||||
isExp = result.getBoolean("active", false)
|
|
||||||
} catch (ignored: Throwable) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return isExp
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,228 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (C) 2021. Fankes Studio(qzmmcn@163.com)
|
|
||||||
*
|
|
||||||
* This file is part of TSBattery.
|
|
||||||
*
|
|
||||||
* TSBattery is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* TSBattery is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
* This file is Created by fankes on 2021/9/4.
|
|
||||||
*/
|
|
||||||
@file:Suppress(
|
|
||||||
"DEPRECATION", "SetTextI18n", "SetWorldReadable", "WorldReadableFiles",
|
|
||||||
"LocalVariableName", "SameParameterValue"
|
|
||||||
)
|
|
||||||
|
|
||||||
package com.fankes.tsbattery.ui
|
|
||||||
|
|
||||||
import android.content.ComponentName
|
|
||||||
import android.content.Context
|
|
||||||
import android.content.Intent
|
|
||||||
import android.content.pm.PackageManager
|
|
||||||
import android.net.Uri
|
|
||||||
import android.os.Bundle
|
|
||||||
import android.os.Handler
|
|
||||||
import android.view.View
|
|
||||||
import android.widget.LinearLayout
|
|
||||||
import android.widget.TextView
|
|
||||||
import android.widget.Toast
|
|
||||||
import androidx.appcompat.app.AlertDialog
|
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
|
||||||
import androidx.appcompat.widget.SwitchCompat
|
|
||||||
import androidx.constraintlayout.utils.widget.ImageFilterView
|
|
||||||
import com.fankes.tsbattery.BuildConfig
|
|
||||||
import com.fankes.tsbattery.R
|
|
||||||
import com.fankes.tsbattery.hook.HookMedium
|
|
||||||
import com.fankes.tsbattery.utils.FileUtils
|
|
||||||
import com.gyf.immersionbar.ImmersionBar
|
|
||||||
import java.io.File
|
|
||||||
|
|
||||||
class MainActivity : AppCompatActivity() {
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
|
|
||||||
private const val moduleVersion = BuildConfig.VERSION_NAME
|
|
||||||
private const val moduleSupport = "QQ 8.5.5~8.8.50、TIM 2+"
|
|
||||||
|
|
||||||
/** 声明当前实例 */
|
|
||||||
var instance: MainActivity? = null
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
|
||||||
super.onCreate(savedInstanceState)
|
|
||||||
/** 设置自身实例 */
|
|
||||||
instance = this
|
|
||||||
setContentView(R.layout.activity_main)
|
|
||||||
/** 隐藏系统的标题栏 */
|
|
||||||
supportActionBar?.hide()
|
|
||||||
/** 初始化沉浸状态栏 */
|
|
||||||
ImmersionBar.with(this)
|
|
||||||
.statusBarColor(R.color.white)
|
|
||||||
.autoDarkModeEnable(false)
|
|
||||||
.statusBarDarkFont(true)
|
|
||||||
.navigationBarColor(R.color.white)
|
|
||||||
.navigationBarDarkIcon(true)
|
|
||||||
.fitsSystemWindows(true)
|
|
||||||
.init()
|
|
||||||
/** 判断 Hook 状态 */
|
|
||||||
if (isHooked()) {
|
|
||||||
findViewById<LinearLayout>(R.id.main_lin_status).setBackgroundResource(R.drawable.green_round)
|
|
||||||
findViewById<ImageFilterView>(R.id.main_img_status).setImageResource(R.mipmap.succcess)
|
|
||||||
findViewById<TextView>(R.id.main_text_status).text = "模块已激活"
|
|
||||||
/** 写入激活的模块版本 */
|
|
||||||
putString(HookMedium.ENABLE_MODULE_VERSION, moduleVersion)
|
|
||||||
} else
|
|
||||||
AlertDialog.Builder(this)
|
|
||||||
.setTitle("模块没有激活")
|
|
||||||
.setMessage(
|
|
||||||
"检测到模块没有激活,模块需要 Xposed 环境依赖,同时需要系统拥有 Root 权限(太极阴可以免 Root),请自行查看本页面使用帮助与说明第三条。\n" +
|
|
||||||
"太极、应用转生、梦境(Pine)和第三方 Xposed 激活后可能不会提示激活,若想验证是否激活请打开“提示模块运行信息”自行检查,如果生效就代表模块运行正常,这里的激活状态只是一个显示意义上的存在。\n" +
|
|
||||||
"太极(无极)在 MIUI 设备上会提示打开授权,请进行允许,然后再次打开本应用查看激活状态。"
|
|
||||||
)
|
|
||||||
.setPositiveButton("我知道了", null)
|
|
||||||
.setCancelable(false)
|
|
||||||
.show()
|
|
||||||
/** 设置文本 */
|
|
||||||
findViewById<TextView>(R.id.main_text_version).text = "当前版本:$moduleVersion"
|
|
||||||
findViewById<TextView>(R.id.main_text_support).text = "支持 $moduleSupport"
|
|
||||||
/** 初始化 View */
|
|
||||||
val protectModeSwitch = findViewById<SwitchCompat>(R.id.protect_mode_switch)
|
|
||||||
val hideIconInLauncherSwitch = findViewById<SwitchCompat>(R.id.hide_icon_in_launcher_switch)
|
|
||||||
val notifyModuleInfoSwitch = findViewById<SwitchCompat>(R.id.notify_module_info_switch)
|
|
||||||
/** 获取 Sp 存储的信息 */
|
|
||||||
protectModeSwitch.isChecked = getBoolean("_white_mode")
|
|
||||||
hideIconInLauncherSwitch.isChecked = getBoolean("_hide_icon")
|
|
||||||
notifyModuleInfoSwitch.isChecked = getBoolean("_tip_run_info")
|
|
||||||
protectModeSwitch.setOnCheckedChangeListener { btn, b ->
|
|
||||||
if (!btn.isPressed) return@setOnCheckedChangeListener
|
|
||||||
putBoolean(HookMedium.ENABLE_WHITE_MODE, b)
|
|
||||||
}
|
|
||||||
hideIconInLauncherSwitch.setOnCheckedChangeListener { btn, b ->
|
|
||||||
if (!btn.isPressed) return@setOnCheckedChangeListener
|
|
||||||
putBoolean(HookMedium.ENABLE_HIDE_ICON, b)
|
|
||||||
packageManager.setComponentEnabledSetting(
|
|
||||||
ComponentName(this@MainActivity, "com.fankes.tsbattery.Home"),
|
|
||||||
if (b) PackageManager.COMPONENT_ENABLED_STATE_DISABLED else PackageManager.COMPONENT_ENABLED_STATE_ENABLED,
|
|
||||||
PackageManager.DONT_KILL_APP
|
|
||||||
)
|
|
||||||
}
|
|
||||||
notifyModuleInfoSwitch.setOnCheckedChangeListener { btn, b ->
|
|
||||||
if (!btn.isPressed) return@setOnCheckedChangeListener
|
|
||||||
putBoolean(HookMedium.ENABLE_RUN_INFO, b)
|
|
||||||
}
|
|
||||||
/** 项目地址点击事件 */
|
|
||||||
findViewById<View>(R.id.link_with_project_address).setOnClickListener {
|
|
||||||
try {
|
|
||||||
startActivity(Intent().apply {
|
|
||||||
action = "android.intent.action.VIEW"
|
|
||||||
data = Uri.parse("https://github.com/fankes/TSBattery")
|
|
||||||
})
|
|
||||||
} catch (e: Exception) {
|
|
||||||
Toast.makeText(this, "无法启动系统默认浏览器", Toast.LENGTH_SHORT).show()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 判断模块是否激活
|
|
||||||
* @return 激活状态
|
|
||||||
*/
|
|
||||||
private fun isHooked() = HookMedium.isHooked()
|
|
||||||
|
|
||||||
override fun onResume() {
|
|
||||||
super.onResume()
|
|
||||||
setWorldReadable()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onRestart() {
|
|
||||||
super.onRestart()
|
|
||||||
setWorldReadable()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onPause() {
|
|
||||||
super.onPause()
|
|
||||||
setWorldReadable()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取保存的值
|
|
||||||
* @param key 名称
|
|
||||||
* @return 保存的值
|
|
||||||
*/
|
|
||||||
private fun getBoolean(key: String) =
|
|
||||||
getSharedPreferences(
|
|
||||||
packageName + "_preferences",
|
|
||||||
Context.MODE_PRIVATE
|
|
||||||
).getBoolean(key, false)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 保存值
|
|
||||||
* @param key 名称
|
|
||||||
* @param bool 值
|
|
||||||
*/
|
|
||||||
private fun putBoolean(key: String, bool: Boolean) {
|
|
||||||
getSharedPreferences(
|
|
||||||
packageName + "_preferences",
|
|
||||||
Context.MODE_PRIVATE
|
|
||||||
).edit().putBoolean(key, bool).apply()
|
|
||||||
setWorldReadable()
|
|
||||||
/** 延迟继续设置强制允许 SP 可读可写 */
|
|
||||||
Handler().postDelayed({ setWorldReadable() }, 500)
|
|
||||||
Handler().postDelayed({ setWorldReadable() }, 1000)
|
|
||||||
Handler().postDelayed({ setWorldReadable() }, 1500)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 保存值
|
|
||||||
* @param key 名称
|
|
||||||
* @param value 值
|
|
||||||
*/
|
|
||||||
private fun putString(key: String, value: String) {
|
|
||||||
getSharedPreferences(
|
|
||||||
packageName + "_preferences",
|
|
||||||
Context.MODE_PRIVATE
|
|
||||||
).edit().putString(key, value).apply()
|
|
||||||
setWorldReadable()
|
|
||||||
/** 延迟继续设置强制允许 SP 可读可写 */
|
|
||||||
Handler().postDelayed({ setWorldReadable() }, 500)
|
|
||||||
Handler().postDelayed({ setWorldReadable() }, 1000)
|
|
||||||
Handler().postDelayed({ setWorldReadable() }, 1500)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 强制设置 Sp 存储为全局可读可写
|
|
||||||
* 以供模块使用
|
|
||||||
*/
|
|
||||||
private fun setWorldReadable() {
|
|
||||||
try {
|
|
||||||
if (FileUtils.getDefaultPrefFile(this).exists()) {
|
|
||||||
for (file in arrayOf<File>(
|
|
||||||
FileUtils.getDataDir(this),
|
|
||||||
FileUtils.getPrefDir(this),
|
|
||||||
FileUtils.getDefaultPrefFile(this)
|
|
||||||
)) {
|
|
||||||
file.setReadable(true, false)
|
|
||||||
file.setExecutable(true, false)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (e: Exception) {
|
|
||||||
Toast.makeText(this, "无法写入模块设置,请检查权限\n如果此提示一直显示,请不要双开模块", Toast.LENGTH_SHORT).show()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onDestroy() {
|
|
||||||
super.onDestroy()
|
|
||||||
/** 销毁实例防止内存泄漏 */
|
|
||||||
instance = null
|
|
||||||
}
|
|
||||||
}
|
|
@@ -0,0 +1,227 @@
|
|||||||
|
/*
|
||||||
|
* TSBattery - A new way to save your battery avoid cancer apps hacker it.
|
||||||
|
* Copyright (C) 2019-2022 Fankes Studio(qzmmcn@163.com)
|
||||||
|
* https://github.com/fankes/TSBattery
|
||||||
|
*
|
||||||
|
* This software is non-free but opensource software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public License
|
||||||
|
* as published by the Free Software Foundation; either
|
||||||
|
* version 3 of the License, or any later version.
|
||||||
|
*
|
||||||
|
* This software is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* and eula along with this software. If not, see
|
||||||
|
* <https://www.gnu.org/licenses/>
|
||||||
|
*
|
||||||
|
* This file is Created by fankes on 2021/9/4.
|
||||||
|
*/
|
||||||
|
@file:Suppress("SetTextI18n", "LocalVariableName", "SameParameterValue")
|
||||||
|
|
||||||
|
package com.fankes.tsbattery.ui.activity
|
||||||
|
|
||||||
|
import android.content.ComponentName
|
||||||
|
import android.content.pm.PackageManager
|
||||||
|
import android.view.HapticFeedbackConstants
|
||||||
|
import androidx.core.view.isVisible
|
||||||
|
import com.fankes.tsbattery.BuildConfig
|
||||||
|
import com.fankes.tsbattery.R
|
||||||
|
import com.fankes.tsbattery.data.DataConst
|
||||||
|
import com.fankes.tsbattery.databinding.ActivityMainBinding
|
||||||
|
import com.fankes.tsbattery.hook.HookConst.QQ_PACKAGE_NAME
|
||||||
|
import com.fankes.tsbattery.hook.HookConst.TIM_PACKAGE_NAME
|
||||||
|
import com.fankes.tsbattery.hook.HookConst.WECHAT_PACKAGE_NAME
|
||||||
|
import com.fankes.tsbattery.ui.activity.base.BaseActivity
|
||||||
|
import com.fankes.tsbattery.utils.factory.*
|
||||||
|
import com.fankes.tsbattery.utils.tool.GithubReleaseTool
|
||||||
|
import com.fankes.tsbattery.utils.tool.YukiPromoteTool
|
||||||
|
import com.highcapable.yukihookapi.YukiHookAPI
|
||||||
|
import com.highcapable.yukihookapi.hook.factory.modulePrefs
|
||||||
|
|
||||||
|
class MainActivity : BaseActivity<ActivityMainBinding>() {
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
|
||||||
|
private const val moduleVersion = BuildConfig.VERSION_NAME
|
||||||
|
private val qqSupportVersions = arrayOf(
|
||||||
|
"8.0.0", "8.0.5", "8.0.7", "8.1.0", "8.1.3", "8.1.5", "8.1.8",
|
||||||
|
"8.2.0", "8.2.6", "8.2.7", "8.2.8", "8.2.11", "8.3.0", "8.3.5",
|
||||||
|
"8.3.6", "8.3.9", "8.4.1", "8.4.5", "8.4.8", "8.4.10", "8.4.17",
|
||||||
|
"8.4.18", "8.5.0", "8.5.5", "8.6.0", "8.6.5", "8.7.0", "8.7.5",
|
||||||
|
"8.7.8", "8.8.0", "8.8.3", "8.8.5", "8.8.11", "8.8.12", "8.8.17",
|
||||||
|
"8.8.20", "8.8.23", "8.8.28", "8.8.33", "8.8.35", "8.8.38", "8.8.50",
|
||||||
|
"8.8.55", "8.8.68", "8.8.80", "8.8.83", "8.8.85", "8.8.88", "8.8.90",
|
||||||
|
"8.8.93", "8.8.95", "8.8.98", "8.9.0", "8.9.1", "8.9.2"
|
||||||
|
)
|
||||||
|
private val qqSupportVersion by lazy {
|
||||||
|
if (qqSupportVersions.isNotEmpty()) {
|
||||||
|
var value = ""
|
||||||
|
qqSupportVersions.forEach { value += "$it、" }
|
||||||
|
"${value.trim().let { it.substring(0, it.lastIndex) }}\n\n其余版本请自行测试是否有效。"
|
||||||
|
} else "empty"
|
||||||
|
}
|
||||||
|
private const val timSupportVersion = "2+、3+ (并未完全测试每个版本)"
|
||||||
|
private const val wechatSupportVersion = "全版本仅支持基础省电,更多功能依然画饼"
|
||||||
|
|
||||||
|
/** 预发布的版本标识 */
|
||||||
|
private const val pendingFlag = ""
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onCreate() {
|
||||||
|
/** 检查更新 */
|
||||||
|
GithubReleaseTool.checkingForUpdate(context = this, moduleVersion) { version, function ->
|
||||||
|
binding.mainTextReleaseVersion.apply {
|
||||||
|
text = "点击更新 $version"
|
||||||
|
isVisible = true
|
||||||
|
setOnClickListener { function() }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/** 判断 Hook 状态 */
|
||||||
|
if (YukiHookAPI.Status.isModuleActive) {
|
||||||
|
binding.mainLinStatus.setBackgroundResource(R.drawable.bg_green_round)
|
||||||
|
binding.mainImgStatus.setImageResource(R.mipmap.ic_success)
|
||||||
|
binding.mainTextStatus.text = "模块已激活"
|
||||||
|
binding.mainTextApiWay.isVisible = true
|
||||||
|
refreshActivateExecutor()
|
||||||
|
/** 写入激活的模块版本 */
|
||||||
|
modulePrefs.put(DataConst.ENABLE_MODULE_VERSION, moduleVersion)
|
||||||
|
/** 推广、恰饭 */
|
||||||
|
YukiPromoteTool.promote(context = this)
|
||||||
|
} else
|
||||||
|
showDialog {
|
||||||
|
title = "模块没有激活"
|
||||||
|
msg = "检测到模块没有激活,模块需要 Xposed 环境依赖," +
|
||||||
|
"同时需要系统拥有 Root 权限(太极阴可以免 Root)," +
|
||||||
|
"请自行查看本页面使用帮助与说明第三条。\n" +
|
||||||
|
"太极和第三方 Xposed 激活后" +
|
||||||
|
"可能不会提示激活,若想验证是否激活请打开“提示模块运行信息”自行检查," +
|
||||||
|
"或观察 QQ、TIM 的常驻通知是否有“TSBattery 守护中”字样”。\n\n" +
|
||||||
|
"如果生效就代表模块运行正常,若你在未 Root 情况下激活模块,这里的激活状态只是一个显示意义上的存在。\n" +
|
||||||
|
"太极(无极)在 MIUI 设备上会提示打开授权,请进行允许,然后再次打开本模块查看激活状态。"
|
||||||
|
confirmButton(text = "我知道了")
|
||||||
|
noCancelable()
|
||||||
|
}
|
||||||
|
/** 推荐使用 LSPosed */
|
||||||
|
if (YukiHookAPI.Status.isTaiChiModuleActive)
|
||||||
|
showDialog {
|
||||||
|
title = "兼容性提示"
|
||||||
|
msg = "若你的设备已 Root,推荐使用 LSPosed 激活模块,太极可能会出现模块设置无法保存的问题。"
|
||||||
|
confirmButton(text = "我知道了")
|
||||||
|
}
|
||||||
|
/** 检测应用转生 - 如果模块已激活就不再检测 */
|
||||||
|
if (("com.bug.xposed").isInstall && YukiHookAPI.Status.isModuleActive.not())
|
||||||
|
showDialog {
|
||||||
|
title = "环境异常"
|
||||||
|
msg = "检测到“应用转生”已被安装,为了保证模块的安全和稳定,请卸载更换其他 Hook 框架后才能继续使用。"
|
||||||
|
confirmButton(text = "退出") { finish() }
|
||||||
|
noCancelable()
|
||||||
|
}
|
||||||
|
/** 设置安装状态 */
|
||||||
|
binding.mainTextQqVer.text = if (QQ_PACKAGE_NAME.isInstall) version(QQ_PACKAGE_NAME) else "未安装"
|
||||||
|
binding.mainTextTimVer.text = if (TIM_PACKAGE_NAME.isInstall) version(TIM_PACKAGE_NAME) else "未安装"
|
||||||
|
binding.mainTextWechatVer.text = if (WECHAT_PACKAGE_NAME.isInstall) version(WECHAT_PACKAGE_NAME) else "未安装"
|
||||||
|
/** 设置文本 */
|
||||||
|
binding.mainTextVersion.text = "模块版本:$moduleVersion $pendingFlag"
|
||||||
|
binding.mainQqItem.setOnClickListener {
|
||||||
|
showDialog {
|
||||||
|
title = "兼容的 QQ 版本"
|
||||||
|
msg = qqSupportVersion
|
||||||
|
confirmButton(text = "我知道了")
|
||||||
|
}
|
||||||
|
/** 振动提醒 */
|
||||||
|
it.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP)
|
||||||
|
}
|
||||||
|
binding.mainTimItem.setOnClickListener {
|
||||||
|
showDialog {
|
||||||
|
title = "兼容的 TIM 版本"
|
||||||
|
msg = timSupportVersion
|
||||||
|
confirmButton(text = "我知道了")
|
||||||
|
}
|
||||||
|
/** 振动提醒 */
|
||||||
|
it.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP)
|
||||||
|
}
|
||||||
|
binding.mainWechatItem.setOnClickListener {
|
||||||
|
showDialog {
|
||||||
|
title = "兼容的微信版本"
|
||||||
|
msg = wechatSupportVersion
|
||||||
|
confirmButton(text = "我知道了")
|
||||||
|
}
|
||||||
|
/** 振动提醒 */
|
||||||
|
it.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP)
|
||||||
|
}
|
||||||
|
/** 获取 Sp 存储的信息 */
|
||||||
|
binding.qqtimProtectModeSwitch.isChecked = modulePrefs.get(DataConst.ENABLE_QQTIM_WHITE_MODE)
|
||||||
|
binding.qqTimCoreServiceSwitch.isChecked = modulePrefs.get(DataConst.ENABLE_QQTIM_CORESERVICE_BAN)
|
||||||
|
binding.qqTimCoreServiceKnSwitch.isChecked = modulePrefs.get(DataConst.ENABLE_QQTIM_CORESERVICE_CHILD_BAN)
|
||||||
|
binding.wechatDisableHookSwitch.isChecked = modulePrefs.get(DataConst.DISABLE_WECHAT_HOOK)
|
||||||
|
binding.hideIconInLauncherSwitch.isChecked = modulePrefs.get(DataConst.ENABLE_HIDE_ICON)
|
||||||
|
binding.notifyModuleInfoSwitch.isChecked = modulePrefs.get(DataConst.ENABLE_RUN_INFO)
|
||||||
|
binding.notifyNotifyTipSwitch.isChecked = modulePrefs.get(DataConst.ENABLE_NOTIFY_TIP)
|
||||||
|
binding.settingModuleTipSwitch.isChecked = modulePrefs.get(DataConst.ENABLE_SETTING_TIP)
|
||||||
|
binding.qqtimProtectModeSwitch.setOnCheckedChangeListener { btn, b ->
|
||||||
|
if (btn.isPressed.not()) return@setOnCheckedChangeListener
|
||||||
|
modulePrefs.put(DataConst.ENABLE_QQTIM_WHITE_MODE, b)
|
||||||
|
snake(msg = "修改需要重启 QQ 以生效")
|
||||||
|
}
|
||||||
|
binding.qqTimCoreServiceSwitch.setOnCheckedChangeListener { btn, b ->
|
||||||
|
if (btn.isPressed.not()) return@setOnCheckedChangeListener
|
||||||
|
modulePrefs.put(DataConst.ENABLE_QQTIM_CORESERVICE_BAN, b)
|
||||||
|
}
|
||||||
|
binding.qqTimCoreServiceKnSwitch.setOnCheckedChangeListener { btn, b ->
|
||||||
|
if (btn.isPressed.not()) return@setOnCheckedChangeListener
|
||||||
|
modulePrefs.put(DataConst.ENABLE_QQTIM_CORESERVICE_CHILD_BAN, b)
|
||||||
|
}
|
||||||
|
binding.wechatDisableHookSwitch.setOnCheckedChangeListener { btn, b ->
|
||||||
|
if (btn.isPressed.not()) return@setOnCheckedChangeListener
|
||||||
|
modulePrefs.put(DataConst.DISABLE_WECHAT_HOOK, b)
|
||||||
|
snake(msg = "修改需要重启微信以生效")
|
||||||
|
}
|
||||||
|
binding.hideIconInLauncherSwitch.setOnCheckedChangeListener { btn, b ->
|
||||||
|
if (btn.isPressed.not()) return@setOnCheckedChangeListener
|
||||||
|
modulePrefs.put(DataConst.ENABLE_HIDE_ICON, b)
|
||||||
|
packageManager.setComponentEnabledSetting(
|
||||||
|
ComponentName(this@MainActivity, "com.fankes.tsbattery.Home"),
|
||||||
|
if (b) PackageManager.COMPONENT_ENABLED_STATE_DISABLED else PackageManager.COMPONENT_ENABLED_STATE_ENABLED,
|
||||||
|
PackageManager.DONT_KILL_APP
|
||||||
|
)
|
||||||
|
}
|
||||||
|
binding.notifyModuleInfoSwitch.setOnCheckedChangeListener { btn, b ->
|
||||||
|
if (btn.isPressed.not()) return@setOnCheckedChangeListener
|
||||||
|
modulePrefs.put(DataConst.ENABLE_RUN_INFO, b)
|
||||||
|
}
|
||||||
|
binding.notifyNotifyTipSwitch.setOnCheckedChangeListener { btn, b ->
|
||||||
|
if (btn.isPressed.not()) return@setOnCheckedChangeListener
|
||||||
|
modulePrefs.put(DataConst.ENABLE_NOTIFY_TIP, b)
|
||||||
|
}
|
||||||
|
binding.settingModuleTipSwitch.setOnCheckedChangeListener { btn, b ->
|
||||||
|
if (btn.isPressed.not()) return@setOnCheckedChangeListener
|
||||||
|
modulePrefs.put(DataConst.ENABLE_SETTING_TIP, b)
|
||||||
|
}
|
||||||
|
/** 快捷操作 QQ */
|
||||||
|
binding.quickQqButton.setOnClickListener { openSelfSetting(QQ_PACKAGE_NAME) }
|
||||||
|
/** 快捷操作 TIM */
|
||||||
|
binding.quickTimButton.setOnClickListener { openSelfSetting(TIM_PACKAGE_NAME) }
|
||||||
|
/** 快捷操作微信 */
|
||||||
|
binding.quickWechatButton.setOnClickListener { openSelfSetting(WECHAT_PACKAGE_NAME) }
|
||||||
|
/** 项目地址按钮点击事件 */
|
||||||
|
binding.titleGithubIcon.setOnClickListener { openBrowser(url = "https://github.com/fankes/TSBattery") }
|
||||||
|
/** 恰饭! */
|
||||||
|
binding.linkWithFollowMe.setOnClickListener {
|
||||||
|
openBrowser(url = "https://www.coolapk.com/u/876977", packageName = "com.coolapk.market")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 刷新模块激活使用的方式 */
|
||||||
|
private fun refreshActivateExecutor() {
|
||||||
|
when {
|
||||||
|
YukiHookAPI.Status.executorVersion > 0 ->
|
||||||
|
binding.mainTextApiWay.text =
|
||||||
|
"Activated by ${YukiHookAPI.Status.executorName} API ${YukiHookAPI.Status.executorVersion}"
|
||||||
|
YukiHookAPI.Status.isTaiChiModuleActive -> binding.mainTextApiWay.text = "Activated by TaiChi"
|
||||||
|
else -> binding.mainTextApiWay.text = "Activated by anonymous"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,72 @@
|
|||||||
|
/*
|
||||||
|
* TSBattery - A new way to save your battery avoid cancer apps hacker it.
|
||||||
|
* Copyright (C) 2019-2022 Fankes Studio(qzmmcn@163.com)
|
||||||
|
* https://github.com/fankes/TSBattery
|
||||||
|
*
|
||||||
|
* This software is non-free but opensource software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public License
|
||||||
|
* as published by the Free Software Foundation; either
|
||||||
|
* version 3 of the License, or any later version.
|
||||||
|
*
|
||||||
|
* This software is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* and eula along with this software. If not, see
|
||||||
|
* <https://www.gnu.org/licenses/>
|
||||||
|
*
|
||||||
|
* This file is Created by fankes on 2022/1/30.
|
||||||
|
*/
|
||||||
|
@file:Suppress("UNCHECKED_CAST")
|
||||||
|
|
||||||
|
package com.fankes.tsbattery.ui.activity.base
|
||||||
|
|
||||||
|
import android.os.Build
|
||||||
|
import android.os.Bundle
|
||||||
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
|
import androidx.core.content.res.ResourcesCompat
|
||||||
|
import androidx.core.view.WindowCompat
|
||||||
|
import androidx.viewbinding.ViewBinding
|
||||||
|
import com.fankes.tsbattery.R
|
||||||
|
import com.fankes.tsbattery.utils.factory.isNotSystemInDarkMode
|
||||||
|
import com.highcapable.yukihookapi.hook.factory.method
|
||||||
|
import com.highcapable.yukihookapi.hook.type.android.LayoutInflaterClass
|
||||||
|
import java.lang.reflect.ParameterizedType
|
||||||
|
|
||||||
|
abstract class BaseActivity<VB : ViewBinding> : AppCompatActivity() {
|
||||||
|
|
||||||
|
/** 获取绑定布局对象 */
|
||||||
|
lateinit var binding: VB
|
||||||
|
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
javaClass.genericSuperclass.also { type ->
|
||||||
|
if (type is ParameterizedType) {
|
||||||
|
binding = (type.actualTypeArguments[0] as Class<VB>).method {
|
||||||
|
name = "inflate"
|
||||||
|
param(LayoutInflaterClass)
|
||||||
|
}.get().invoke<VB>(layoutInflater) ?: error("binding failed")
|
||||||
|
setContentView(binding.root)
|
||||||
|
} else error("binding but got wrong type")
|
||||||
|
}
|
||||||
|
/** 隐藏系统的标题栏 */
|
||||||
|
supportActionBar?.hide()
|
||||||
|
/** 初始化沉浸状态栏 */
|
||||||
|
WindowCompat.getInsetsController(window, window.decorView).apply {
|
||||||
|
isAppearanceLightStatusBars = isNotSystemInDarkMode
|
||||||
|
isAppearanceLightNavigationBars = isNotSystemInDarkMode
|
||||||
|
}
|
||||||
|
ResourcesCompat.getColor(resources, R.color.colorThemeBackground, null).also {
|
||||||
|
window?.statusBarColor = it
|
||||||
|
window?.navigationBarColor = it
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) window?.navigationBarDividerColor = it
|
||||||
|
}
|
||||||
|
/** 装载子类 */
|
||||||
|
onCreate()
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 回调 [onCreate] 方法 */
|
||||||
|
abstract fun onCreate()
|
||||||
|
}
|
@@ -0,0 +1,74 @@
|
|||||||
|
/*
|
||||||
|
* TSBattery - A new way to save your battery avoid cancer apps hacker it.
|
||||||
|
* Copyright (C) 2019-2022 Fankes Studio(qzmmcn@163.com)
|
||||||
|
* https://github.com/fankes/TSBattery
|
||||||
|
*
|
||||||
|
* This software is non-free but opensource software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public License
|
||||||
|
* as published by the Free Software Foundation; either
|
||||||
|
* version 3 of the License, or any later version.
|
||||||
|
*
|
||||||
|
* This software is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* and eula along with this software. If not, see
|
||||||
|
* <https://www.gnu.org/licenses/>
|
||||||
|
*
|
||||||
|
* This file is Created by fankes on 2022/1/8.
|
||||||
|
*/
|
||||||
|
@file:Suppress("SameParameterValue")
|
||||||
|
|
||||||
|
package com.fankes.tsbattery.ui.view
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.res.ColorStateList
|
||||||
|
import android.graphics.Color
|
||||||
|
import android.text.TextUtils
|
||||||
|
import android.util.AttributeSet
|
||||||
|
import androidx.appcompat.widget.SwitchCompat
|
||||||
|
import com.fankes.tsbattery.utils.factory.dp
|
||||||
|
import com.fankes.tsbattery.utils.factory.isSystemInDarkMode
|
||||||
|
import top.defaults.drawabletoolbox.DrawableBuilder
|
||||||
|
|
||||||
|
class MaterialSwitch(context: Context, attrs: AttributeSet?) : SwitchCompat(context, attrs) {
|
||||||
|
|
||||||
|
private fun toColors(selected: Int, pressed: Int, normal: Int): ColorStateList {
|
||||||
|
val colors = intArrayOf(selected, pressed, normal)
|
||||||
|
val states = arrayOfNulls<IntArray>(3)
|
||||||
|
states[0] = intArrayOf(android.R.attr.state_checked)
|
||||||
|
states[1] = intArrayOf(android.R.attr.state_pressed)
|
||||||
|
states[2] = intArrayOf()
|
||||||
|
return ColorStateList(states, colors)
|
||||||
|
}
|
||||||
|
|
||||||
|
private val thumbColor get() = if (context.isSystemInDarkMode) 0xFF7C7C7C else 0xFFCCCCCC
|
||||||
|
|
||||||
|
init {
|
||||||
|
trackDrawable = DrawableBuilder()
|
||||||
|
.rectangle()
|
||||||
|
.rounded()
|
||||||
|
.solidColor(0xFF656565.toInt())
|
||||||
|
.height(20.dp(context))
|
||||||
|
.cornerRadius(15.dp(context))
|
||||||
|
.build()
|
||||||
|
thumbDrawable = DrawableBuilder()
|
||||||
|
.rectangle()
|
||||||
|
.rounded()
|
||||||
|
.solidColor(Color.WHITE)
|
||||||
|
.size(20.dp(context), 20.dp(context))
|
||||||
|
.cornerRadius(20.dp(context))
|
||||||
|
.strokeWidth(8.dp(context))
|
||||||
|
.strokeColor(Color.TRANSPARENT)
|
||||||
|
.build()
|
||||||
|
trackTintList = toColors(
|
||||||
|
0xFF656565.toInt(),
|
||||||
|
thumbColor.toInt(),
|
||||||
|
thumbColor.toInt()
|
||||||
|
)
|
||||||
|
isSingleLine = true
|
||||||
|
ellipsize = TextUtils.TruncateAt.END
|
||||||
|
}
|
||||||
|
}
|
@@ -1,94 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2021. Fankes Studio(qzmmcn@163.com)
|
|
||||||
*
|
|
||||||
* This file is part of TSBattery.
|
|
||||||
*
|
|
||||||
* TSBattery is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* TSBattery is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
* This file is Created by zpp0196 on 2019/2/9.
|
|
||||||
*/
|
|
||||||
package com.fankes.tsbattery.utils;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.os.Environment;
|
|
||||||
|
|
||||||
import com.fankes.tsbattery.BuildConfig;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
@SuppressWarnings("ALL")
|
|
||||||
public class FileUtils {
|
|
||||||
|
|
||||||
private static final String FILE_PREF_NAME = BuildConfig.APPLICATION_ID + "_preferences.xml";
|
|
||||||
|
|
||||||
public static boolean copyFile(File srcFile, File targetFile) {
|
|
||||||
FileInputStream ins = null;
|
|
||||||
FileOutputStream out = null;
|
|
||||||
try {
|
|
||||||
if (targetFile.exists()) {
|
|
||||||
targetFile.delete();
|
|
||||||
}
|
|
||||||
File targetParent = targetFile.getParentFile();
|
|
||||||
if (!targetParent.exists()) {
|
|
||||||
targetParent.mkdirs();
|
|
||||||
}
|
|
||||||
targetFile.createNewFile();
|
|
||||||
ins = new FileInputStream(srcFile);
|
|
||||||
out = new FileOutputStream(targetFile);
|
|
||||||
byte[] b = new byte[1024];
|
|
||||||
int n;
|
|
||||||
while ((n = ins.read(b)) != -1) {
|
|
||||||
out.write(b, 0, n);
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return false;
|
|
||||||
} finally {
|
|
||||||
try {
|
|
||||||
if (ins != null) {
|
|
||||||
ins.close();
|
|
||||||
}
|
|
||||||
if (out != null) {
|
|
||||||
out.close();
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static File getDataDir(Context context) {
|
|
||||||
return new File(context.getApplicationInfo().dataDir);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static File getPrefDir(Context context) {
|
|
||||||
return new File(getDataDir(context), "shared_prefs");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static File getDefaultPrefFile(Context context) {
|
|
||||||
return new File(getPrefDir(context), FILE_PREF_NAME);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static File getBackupPrefsFile() {
|
|
||||||
return new File(getBackupDir(), FILE_PREF_NAME);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static File getBackupDir() {
|
|
||||||
return new File(Environment.getExternalStorageDirectory(), "QQPurify");
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,38 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2021. Fankes Studio(qzmmcn@163.com)
|
|
||||||
*
|
|
||||||
* This file is part of TSBattery.
|
|
||||||
*
|
|
||||||
* TSBattery is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* TSBattery is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
* This file is Created by zpp0196 on 2018/4/11.
|
|
||||||
*/
|
|
||||||
package com.fankes.tsbattery.utils
|
|
||||||
|
|
||||||
import de.robv.android.xposed.XSharedPreferences
|
|
||||||
|
|
||||||
object XPrefUtils {
|
|
||||||
|
|
||||||
fun getBoolean(key: String) = pref.getBoolean(key, false)
|
|
||||||
|
|
||||||
fun getString(key: String) = pref.getString(key, "unknown")
|
|
||||||
|
|
||||||
private val pref: XSharedPreferences
|
|
||||||
get() {
|
|
||||||
val preferences = XSharedPreferences("com.fankes.tsbattery")
|
|
||||||
preferences.makeWorldReadable()
|
|
||||||
preferences.reload()
|
|
||||||
return preferences
|
|
||||||
}
|
|
||||||
}
|
|
@@ -0,0 +1,180 @@
|
|||||||
|
/*
|
||||||
|
* TSBattery - A new way to save your battery avoid cancer apps hacker it.
|
||||||
|
* Copyright (C) 2019-2022 Fankes Studio(qzmmcn@163.com)
|
||||||
|
* https://github.com/fankes/TSBattery
|
||||||
|
*
|
||||||
|
* This software is non-free but opensource software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public License
|
||||||
|
* as published by the Free Software Foundation; either
|
||||||
|
* version 3 of the License, or any later version.
|
||||||
|
*
|
||||||
|
* This software is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* and eula along with this software. If not, see
|
||||||
|
* <https://www.gnu.org/licenses/>
|
||||||
|
*
|
||||||
|
* This file is Created by fankes on 2022/1/7.
|
||||||
|
*/
|
||||||
|
@file:Suppress("unused", "OPT_IN_USAGE", "EXPERIMENTAL_API_USAGE")
|
||||||
|
|
||||||
|
package com.fankes.tsbattery.utils.factory
|
||||||
|
|
||||||
|
import android.app.Dialog
|
||||||
|
import android.content.Context
|
||||||
|
import android.graphics.Color
|
||||||
|
import android.graphics.drawable.GradientDrawable
|
||||||
|
import android.view.Gravity
|
||||||
|
import android.view.View
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import android.widget.LinearLayout
|
||||||
|
import android.widget.ProgressBar
|
||||||
|
import android.widget.TextView
|
||||||
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构造对话框
|
||||||
|
* @param isUseBlackTheme 是否使用深色主题
|
||||||
|
* @param initiate 对话框方法体
|
||||||
|
*/
|
||||||
|
fun Context.showDialog(isUseBlackTheme: Boolean = false, initiate: DialogBuilder.() -> Unit) =
|
||||||
|
DialogBuilder(context = this, isUseBlackTheme).apply(initiate).show()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 对话框构造器
|
||||||
|
* @param context 实例
|
||||||
|
* @param isUseBlackTheme 是否使用深色主题 - 对 AndroidX 风格无效
|
||||||
|
*/
|
||||||
|
class DialogBuilder(val context: Context, private val isUseBlackTheme: Boolean) {
|
||||||
|
|
||||||
|
private var instanceAndroidX: androidx.appcompat.app.AlertDialog.Builder? = null // 实例对象
|
||||||
|
private var instanceAndroid: android.app.AlertDialog.Builder? = null // 实例对象
|
||||||
|
|
||||||
|
private var dialogInstance: Dialog? = null // 对话框实例
|
||||||
|
private var customLayoutView: View? = null // 自定义布局
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否需要使用 AndroidX 风格对话框
|
||||||
|
* @return [Boolean]
|
||||||
|
*/
|
||||||
|
private val isUsingAndroidX get() = runCatching { context is AppCompatActivity }.getOrNull() ?: false
|
||||||
|
|
||||||
|
init {
|
||||||
|
if (isUsingAndroidX)
|
||||||
|
runInSafe { instanceAndroidX = MaterialAlertDialogBuilder(context) }
|
||||||
|
else runInSafe {
|
||||||
|
instanceAndroid = android.app.AlertDialog.Builder(
|
||||||
|
context,
|
||||||
|
if (isUseBlackTheme) android.R.style.Theme_Material_Dialog else android.R.style.Theme_Material_Light_Dialog
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 设置对话框不可关闭 */
|
||||||
|
fun noCancelable() {
|
||||||
|
if (isUsingAndroidX)
|
||||||
|
runInSafe { instanceAndroidX?.setCancelable(false) }
|
||||||
|
else runInSafe { instanceAndroid?.setCancelable(false) }
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 设置对话框标题 */
|
||||||
|
var title
|
||||||
|
get() = ""
|
||||||
|
set(value) {
|
||||||
|
if (isUsingAndroidX)
|
||||||
|
runInSafe { instanceAndroidX?.setTitle(value) }
|
||||||
|
else runInSafe { instanceAndroid?.setTitle(value) }
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 设置对话框消息内容 */
|
||||||
|
var msg
|
||||||
|
get() = ""
|
||||||
|
set(value) {
|
||||||
|
if (isUsingAndroidX)
|
||||||
|
runInSafe { instanceAndroidX?.setMessage(value) }
|
||||||
|
else runInSafe { instanceAndroid?.setMessage(value) }
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 设置进度条对话框消息内容 */
|
||||||
|
var progressContent
|
||||||
|
get() = ""
|
||||||
|
set(value) {
|
||||||
|
if (customLayoutView == null)
|
||||||
|
customLayoutView = LinearLayout(context).apply {
|
||||||
|
orientation = LinearLayout.HORIZONTAL
|
||||||
|
gravity = Gravity.CENTER or Gravity.START
|
||||||
|
addView(ProgressBar(context))
|
||||||
|
addView(View(context).apply { layoutParams = ViewGroup.LayoutParams(20.dp(context), 5) })
|
||||||
|
addView(TextView(context).apply {
|
||||||
|
tag = "progressContent"
|
||||||
|
text = value
|
||||||
|
})
|
||||||
|
setPadding(20.dp(context), 20.dp(context), 20.dp(context), 20.dp(context))
|
||||||
|
}
|
||||||
|
else customLayoutView?.findViewWithTag<TextView>("progressContent")?.text = value
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置对话框确定按钮
|
||||||
|
* @param text 按钮文本内容
|
||||||
|
* @param callback 点击事件
|
||||||
|
*/
|
||||||
|
fun confirmButton(text: String = "确定", callback: () -> Unit = {}) {
|
||||||
|
if (isUsingAndroidX)
|
||||||
|
runInSafe { instanceAndroidX?.setPositiveButton(text) { _, _ -> callback() } }
|
||||||
|
else runInSafe { instanceAndroid?.setPositiveButton(text) { _, _ -> callback() } }
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置对话框取消按钮
|
||||||
|
* @param text 按钮文本内容
|
||||||
|
* @param callback 点击事件
|
||||||
|
*/
|
||||||
|
fun cancelButton(text: String = "取消", callback: () -> Unit = {}) {
|
||||||
|
if (isUsingAndroidX)
|
||||||
|
runInSafe { instanceAndroidX?.setNegativeButton(text) { _, _ -> callback() } }
|
||||||
|
else runInSafe { instanceAndroid?.setNegativeButton(text) { _, _ -> callback() } }
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置对话框第三个按钮
|
||||||
|
* @param text 按钮文本内容
|
||||||
|
* @param callback 点击事件
|
||||||
|
*/
|
||||||
|
fun neutralButton(text: String = "更多", callback: () -> Unit = {}) {
|
||||||
|
if (isUsingAndroidX)
|
||||||
|
runInSafe { instanceAndroidX?.setNeutralButton(text) { _, _ -> callback() } }
|
||||||
|
else runInSafe { instanceAndroid?.setNeutralButton(text) { _, _ -> callback() } }
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 取消对话框 */
|
||||||
|
fun cancel() = dialogInstance?.cancel()
|
||||||
|
|
||||||
|
/** 显示对话框 */
|
||||||
|
internal fun show() =
|
||||||
|
if (isUsingAndroidX) runInSafe {
|
||||||
|
instanceAndroidX?.create()?.apply {
|
||||||
|
customLayoutView?.let { setView(it) }
|
||||||
|
dialogInstance = this
|
||||||
|
}?.show()
|
||||||
|
} else runInSafe {
|
||||||
|
instanceAndroid?.create()?.apply {
|
||||||
|
customLayoutView?.let { setView(it) }
|
||||||
|
window?.setBackgroundDrawable(
|
||||||
|
GradientDrawable(
|
||||||
|
GradientDrawable.Orientation.TOP_BOTTOM,
|
||||||
|
if (isUseBlackTheme) intArrayOf(0xFF2D2D2D.toInt(), 0xFF2D2D2D.toInt())
|
||||||
|
else intArrayOf(Color.WHITE, Color.WHITE)
|
||||||
|
).apply {
|
||||||
|
shape = GradientDrawable.RECTANGLE
|
||||||
|
gradientType = GradientDrawable.LINEAR_GRADIENT
|
||||||
|
cornerRadius = 15.dpFloat(this@DialogBuilder.context)
|
||||||
|
})
|
||||||
|
dialogInstance = this
|
||||||
|
}?.show()
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,82 @@
|
|||||||
|
/*
|
||||||
|
* TSBattery - A new way to save your battery avoid cancer apps hacker it.
|
||||||
|
* Copyright (C) 2019-2022 Fankes Studio(qzmmcn@163.com)
|
||||||
|
* https://github.com/fankes/TSBattery
|
||||||
|
*
|
||||||
|
* This software is non-free but opensource software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public License
|
||||||
|
* as published by the Free Software Foundation; either
|
||||||
|
* version 3 of the License, or any later version.
|
||||||
|
*
|
||||||
|
* This software is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* and eula along with this software. If not, see
|
||||||
|
* <https://www.gnu.org/licenses/>
|
||||||
|
*
|
||||||
|
* This file is Created by fankes on 2022/3/13.
|
||||||
|
*/
|
||||||
|
@file:Suppress("unused")
|
||||||
|
|
||||||
|
package com.fankes.tsbattery.utils.factory
|
||||||
|
|
||||||
|
import com.highcapable.yukihookapi.hook.log.loggerE
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 忽略异常返回值
|
||||||
|
* @param result 回调 - 如果异常为空
|
||||||
|
* @return [T] 发生异常时返回设定值否则返回正常值
|
||||||
|
*/
|
||||||
|
inline fun <T> safeOfNull(result: () -> T): T? = safeOf(default = null, result)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 忽略异常返回值
|
||||||
|
* @param result 回调 - 如果异常为 false
|
||||||
|
* @return [Boolean] 发生异常时返回设定值否则返回正常值
|
||||||
|
*/
|
||||||
|
inline fun safeOfFalse(result: () -> Boolean) = safeOf(default = false, result)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 忽略异常返回值
|
||||||
|
* @param result 回调 - 如果异常为 true
|
||||||
|
* @return [Boolean] 发生异常时返回设定值否则返回正常值
|
||||||
|
*/
|
||||||
|
inline fun safeOfTrue(result: () -> Boolean) = safeOf(default = true, result)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 忽略异常返回值
|
||||||
|
* @param result 回调 - 如果异常为 false
|
||||||
|
* @return [String] 发生异常时返回设定值否则返回正常值
|
||||||
|
*/
|
||||||
|
inline fun safeOfNothing(result: () -> String) = safeOf(default = "", result)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 忽略异常返回值
|
||||||
|
* @param result 回调 - 如果异常为 false
|
||||||
|
* @return [Int] 发生异常时返回设定值否则返回正常值
|
||||||
|
*/
|
||||||
|
inline fun safeOfNan(result: () -> Int) = safeOf(default = 0, result)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 忽略异常返回值
|
||||||
|
* @param default 异常返回值
|
||||||
|
* @param result 正常回调值
|
||||||
|
* @return [T] 发生异常时返回设定值否则返回正常值
|
||||||
|
*/
|
||||||
|
inline fun <T> safeOf(default: T, result: () -> T) = try {
|
||||||
|
result()
|
||||||
|
} catch (_: Throwable) {
|
||||||
|
default
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 忽略异常运行
|
||||||
|
* @param msg 出错输出的消息 - 默认为空
|
||||||
|
* @param block 正常回调
|
||||||
|
*/
|
||||||
|
inline fun <T> T.runInSafe(msg: String = "", block: () -> Unit) {
|
||||||
|
runCatching(block).onFailure { if (msg.isNotBlank()) loggerE(msg = msg, e = it) }
|
||||||
|
}
|
@@ -0,0 +1,180 @@
|
|||||||
|
/*
|
||||||
|
* TSBattery - A new way to save your battery avoid cancer apps hacker it.
|
||||||
|
* Copyright (C) 2019-2022 Fankes Studio(qzmmcn@163.com)
|
||||||
|
* https://github.com/fankes/TSBattery
|
||||||
|
*
|
||||||
|
* This software is non-free but opensource software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public License
|
||||||
|
* as published by the Free Software Foundation; either
|
||||||
|
* version 3 of the License, or any later version.
|
||||||
|
*
|
||||||
|
* This software is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* and eula along with this software. If not, see
|
||||||
|
* <https://www.gnu.org/licenses/>
|
||||||
|
*
|
||||||
|
* This file is Created by fankes on 2022/1/7.
|
||||||
|
*/
|
||||||
|
@file:Suppress("DEPRECATION", "unused")
|
||||||
|
|
||||||
|
package com.fankes.tsbattery.utils.factory
|
||||||
|
|
||||||
|
import android.app.Activity
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.Intent
|
||||||
|
import android.content.pm.PackageInfo
|
||||||
|
import android.content.pm.PackageManager
|
||||||
|
import android.content.res.Configuration
|
||||||
|
import android.graphics.Color
|
||||||
|
import android.net.ConnectivityManager
|
||||||
|
import android.net.Uri
|
||||||
|
import android.provider.Settings
|
||||||
|
import android.widget.Toast
|
||||||
|
import androidx.core.content.getSystemService
|
||||||
|
import com.google.android.material.snackbar.Snackbar
|
||||||
|
import com.highcapable.yukihookapi.hook.xposed.application.ModuleApplication.Companion.appContext
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 系统深色模式是否开启
|
||||||
|
* @return [Boolean] 是否开启
|
||||||
|
*/
|
||||||
|
val isSystemInDarkMode get() = appContext.isSystemInDarkMode
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 系统深色模式是否没开启
|
||||||
|
* @return [Boolean] 是否开启
|
||||||
|
*/
|
||||||
|
inline val isNotSystemInDarkMode get() = !isSystemInDarkMode
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 系统深色模式是否开启
|
||||||
|
* @return [Boolean] 是否开启
|
||||||
|
*/
|
||||||
|
val Context.isSystemInDarkMode get() = (resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 系统深色模式是否没开启
|
||||||
|
* @return [Boolean] 是否开启
|
||||||
|
*/
|
||||||
|
inline val Context.isNotSystemInDarkMode get() = !isSystemInDarkMode
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 得到安装包信息
|
||||||
|
* @return [PackageInfo]
|
||||||
|
*/
|
||||||
|
val Context.packageInfo get() = packageManager?.getPackageInfo(packageName, 0) ?: PackageInfo()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断应用是否安装
|
||||||
|
* @return [Boolean]
|
||||||
|
*/
|
||||||
|
val String.isInstall
|
||||||
|
get() = try {
|
||||||
|
appContext.packageManager.getPackageInfo(
|
||||||
|
this,
|
||||||
|
PackageManager.GET_UNINSTALLED_PACKAGES
|
||||||
|
)
|
||||||
|
true
|
||||||
|
} catch (e: Exception) {
|
||||||
|
false
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 得到版本信息
|
||||||
|
* @return [String]
|
||||||
|
*/
|
||||||
|
val Context.versionName get() = packageInfo.versionName ?: ""
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 得到版本号
|
||||||
|
* @return [Int]
|
||||||
|
*/
|
||||||
|
val Context.versionCode get() = packageInfo.versionCode
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 得到版本信息与版本号
|
||||||
|
* @param packageName 包名
|
||||||
|
* @return [String]
|
||||||
|
*/
|
||||||
|
fun Context.version(packageName: String) = safeOfNothing {
|
||||||
|
packageManager?.getPackageInfo(packageName, 0)?.let {
|
||||||
|
"${it.versionName}(${it.versionCode})"
|
||||||
|
} ?: ""
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 网络连接是否正常
|
||||||
|
* @return [Boolean] 网络是否连接
|
||||||
|
*/
|
||||||
|
val isNetWorkSuccess
|
||||||
|
get() = safeOfFalse { appContext.getSystemService<ConnectivityManager>()?.activeNetworkInfo != null }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* dp 转换为 pxInt
|
||||||
|
* @param context 使用的实例
|
||||||
|
* @return [Int]
|
||||||
|
*/
|
||||||
|
fun Number.dp(context: Context) = dpFloat(context).toInt()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* dp 转换为 pxFloat
|
||||||
|
* @param context 使用的实例
|
||||||
|
* @return [Float]
|
||||||
|
*/
|
||||||
|
fun Number.dpFloat(context: Context) = toFloat() * context.resources.displayMetrics.density
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 弹出 [Toast]
|
||||||
|
* @param msg 提示内容
|
||||||
|
*/
|
||||||
|
fun toast(msg: String) = Toast.makeText(appContext, msg, Toast.LENGTH_SHORT).show()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 弹出 [Snackbar]
|
||||||
|
* @param msg 提示内容
|
||||||
|
* @param actionText 按钮文本 - 不写默认取消按钮
|
||||||
|
* @param callback 按钮事件回调
|
||||||
|
*/
|
||||||
|
fun Context.snake(msg: String, actionText: String = "", callback: () -> Unit = {}) =
|
||||||
|
Snackbar.make((this as Activity).findViewById(android.R.id.content), msg, Snackbar.LENGTH_LONG).apply {
|
||||||
|
if (actionText.isBlank()) return@apply
|
||||||
|
setActionTextColor(if (isSystemInDarkMode) Color.BLACK else Color.WHITE)
|
||||||
|
setAction(actionText) { callback() }
|
||||||
|
}.show()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 跳转 APP 自身设置界面
|
||||||
|
* @param packageName 包名
|
||||||
|
*/
|
||||||
|
fun Context.openSelfSetting(packageName: String = appContext.packageName) = runCatching {
|
||||||
|
if (packageName.isInstall)
|
||||||
|
startActivity(Intent().apply {
|
||||||
|
flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
||||||
|
action = Settings.ACTION_APPLICATION_DETAILS_SETTINGS
|
||||||
|
data = Uri.fromParts("package", packageName, null)
|
||||||
|
})
|
||||||
|
else snake(msg = "你没有安装此应用")
|
||||||
|
}.onFailure { toast(msg = "启动 $packageName 应用信息失败") }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 启动系统浏览器
|
||||||
|
* @param url 网址
|
||||||
|
* @param packageName 指定包名 - 可不填
|
||||||
|
*/
|
||||||
|
fun Context.openBrowser(url: String, packageName: String = "") = runCatching {
|
||||||
|
startActivity(Intent().apply {
|
||||||
|
if (packageName.isNotBlank()) setPackage(packageName)
|
||||||
|
action = Intent.ACTION_VIEW
|
||||||
|
data = Uri.parse(url)
|
||||||
|
/** 防止顶栈一样重叠在自己的 APP 中 */
|
||||||
|
flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
||||||
|
})
|
||||||
|
}.onFailure {
|
||||||
|
if (packageName.isNotBlank()) snake(msg = "启动 $packageName 失败")
|
||||||
|
else snake(msg = "启动系统浏览器失败")
|
||||||
|
}
|
||||||
|
|
@@ -0,0 +1,145 @@
|
|||||||
|
/*
|
||||||
|
* TSBattery - A new way to save your battery avoid cancer apps hacker it.
|
||||||
|
* Copyright (C) 2019-2022 Fankes Studio(qzmmcn@163.com)
|
||||||
|
* https://github.com/fankes/TSBattery
|
||||||
|
*
|
||||||
|
* This software is non-free but opensource software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public License
|
||||||
|
* as published by the Free Software Foundation; either
|
||||||
|
* version 3 of the License, or any later version.
|
||||||
|
*
|
||||||
|
* This software is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* and eula along with this software. If not, see
|
||||||
|
* <https://www.gnu.org/licenses/>
|
||||||
|
*
|
||||||
|
* This file is Created by fankes on 2022/3/20.
|
||||||
|
*/
|
||||||
|
@file:Suppress("NewApi")
|
||||||
|
|
||||||
|
package com.fankes.tsbattery.utils.tool
|
||||||
|
|
||||||
|
import android.app.Activity
|
||||||
|
import android.content.Context
|
||||||
|
import android.icu.text.SimpleDateFormat
|
||||||
|
import android.icu.util.Calendar
|
||||||
|
import android.icu.util.TimeZone
|
||||||
|
import com.fankes.tsbattery.utils.factory.*
|
||||||
|
import okhttp3.*
|
||||||
|
import org.json.JSONObject
|
||||||
|
import java.io.IOException
|
||||||
|
import java.io.Serializable
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取 Github Release 最新版本工具类
|
||||||
|
*/
|
||||||
|
object GithubReleaseTool {
|
||||||
|
|
||||||
|
/** 仓库作者 */
|
||||||
|
private const val REPO_AUTHOR = "fankes"
|
||||||
|
|
||||||
|
/** 仓库名称 */
|
||||||
|
private const val REPO_NAME = "TSBattery"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取最新版本信息
|
||||||
|
* @param context 实例
|
||||||
|
* @param version 当前版本
|
||||||
|
* @param result 成功后回调 - ([String] 最新版本,[Function] 更新对话框方法体)
|
||||||
|
*/
|
||||||
|
fun checkingForUpdate(context: Context, version: String, result: (String, () -> Unit) -> Unit) = checkingInternetConnect(context) {
|
||||||
|
OkHttpClient().newBuilder().build().newCall(
|
||||||
|
Request.Builder()
|
||||||
|
.url("https://api.github.com/repos/$REPO_AUTHOR/$REPO_NAME/releases/latest")
|
||||||
|
.get()
|
||||||
|
.build()
|
||||||
|
).enqueue(object : Callback {
|
||||||
|
override fun onFailure(call: Call, e: IOException) {}
|
||||||
|
|
||||||
|
override fun onResponse(call: Call, response: Response) = runInSafe {
|
||||||
|
JSONObject(response.body.string()).apply {
|
||||||
|
GithubReleaseBean(
|
||||||
|
name = getString("name"),
|
||||||
|
htmlUrl = getString("html_url"),
|
||||||
|
content = getString("body"),
|
||||||
|
date = getString("published_at").localTime()
|
||||||
|
).apply {
|
||||||
|
fun showUpdate() = context.showDialog {
|
||||||
|
title = "最新版本 $name"
|
||||||
|
msg = "发布于 $date\n\n" +
|
||||||
|
"更新日志\n\n" + content
|
||||||
|
confirmButton(text = "更新") { context.openBrowser(htmlUrl) }
|
||||||
|
cancelButton()
|
||||||
|
}
|
||||||
|
if (name != version) (context as? Activity?)?.runOnUiThread {
|
||||||
|
showUpdate()
|
||||||
|
result(name) { showUpdate() }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查网络连接情况
|
||||||
|
* @param context 实例
|
||||||
|
* @param callback 已连接回调
|
||||||
|
*/
|
||||||
|
private fun checkingInternetConnect(context: Context, callback: () -> Unit) = runInSafe {
|
||||||
|
if (isNetWorkSuccess)
|
||||||
|
OkHttpClient().newBuilder().build().newCall(
|
||||||
|
Request.Builder()
|
||||||
|
.url("https://www.baidu.com")
|
||||||
|
.get()
|
||||||
|
.build()
|
||||||
|
).enqueue(object : Callback {
|
||||||
|
override fun onFailure(call: Call, e: IOException) {
|
||||||
|
(context as? Activity?)?.runOnUiThread {
|
||||||
|
context.showDialog {
|
||||||
|
title = "网络不可用"
|
||||||
|
msg = "模块的联网权限可能已被禁用,请开启联网权限以定期检查更新。"
|
||||||
|
confirmButton(text = "去开启") { context.openSelfSetting() }
|
||||||
|
cancelButton()
|
||||||
|
noCancelable()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onResponse(call: Call, response: Response) = runInSafe {
|
||||||
|
(context as? Activity?)?.runOnUiThread { runInSafe { callback() } }
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 格式化时间为本地时区
|
||||||
|
* @return [String] 本地时区时间
|
||||||
|
*/
|
||||||
|
private fun String.localTime() = replace(oldValue = "T", newValue = " ").replace(oldValue = "Z", newValue = "").let {
|
||||||
|
runCatching {
|
||||||
|
val local = SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.ROOT).apply { timeZone = Calendar.getInstance().timeZone }
|
||||||
|
val current = SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.ROOT).apply { timeZone = TimeZone.getTimeZone("GMT") }
|
||||||
|
local.format(current.parse(it))
|
||||||
|
}.getOrNull() ?: it
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Github Release bean
|
||||||
|
* @param name 版本名称
|
||||||
|
* @param htmlUrl 网页地址
|
||||||
|
* @param content 更新日志
|
||||||
|
* @param date 发布时间
|
||||||
|
*/
|
||||||
|
private data class GithubReleaseBean(
|
||||||
|
var name: String,
|
||||||
|
var htmlUrl: String,
|
||||||
|
var content: String,
|
||||||
|
var date: String
|
||||||
|
) : Serializable
|
||||||
|
}
|
@@ -0,0 +1,59 @@
|
|||||||
|
/*
|
||||||
|
* TSBattery - A new way to save your battery avoid cancer apps hacker it.
|
||||||
|
* Copyright (C) 2019-2022 Fankes Studio(qzmmcn@163.com)
|
||||||
|
* https://github.com/fankes/TSBattery
|
||||||
|
*
|
||||||
|
* This software is non-free but opensource software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU Affero General Public License
|
||||||
|
* as published by the Free Software Foundation; either
|
||||||
|
* version 3 of the License, or any later version.
|
||||||
|
*
|
||||||
|
* This software is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* and eula along with this software. If not, see
|
||||||
|
* <https://www.gnu.org/licenses/>
|
||||||
|
*
|
||||||
|
* This file is Created by fankes on 2022/5/30.
|
||||||
|
*/
|
||||||
|
package com.fankes.tsbattery.utils.tool
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import com.fankes.tsbattery.BuildConfig
|
||||||
|
import com.fankes.tsbattery.utils.factory.openBrowser
|
||||||
|
import com.fankes.tsbattery.utils.factory.showDialog
|
||||||
|
import com.highcapable.yukihookapi.YukiHookAPI
|
||||||
|
import com.highcapable.yukihookapi.hook.factory.modulePrefs
|
||||||
|
import com.highcapable.yukihookapi.hook.xposed.prefs.data.PrefsData
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [YukiHookAPI] 的自动推广工具类
|
||||||
|
*/
|
||||||
|
object YukiPromoteTool {
|
||||||
|
|
||||||
|
/** 推广已读存储键值 */
|
||||||
|
private val YUKI_PROMOTE_READED = PrefsData("yuki_promote_readed_${BuildConfig.VERSION_NAME}", false)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 显示推广对话框
|
||||||
|
* @param context 实例
|
||||||
|
*/
|
||||||
|
fun promote(context: Context) {
|
||||||
|
fun saveReaded() = context.modulePrefs.put(YUKI_PROMOTE_READED, value = true)
|
||||||
|
if (context.modulePrefs.get(YUKI_PROMOTE_READED).not())
|
||||||
|
context.showDialog {
|
||||||
|
title = "面向开发者的推广"
|
||||||
|
msg = "你想快速拥有一个自己的 Xposed 模块吗,你只需要拥有基础的 Android 开发经验以及使用 Kotlin 编程语言即可。\n\n" +
|
||||||
|
"快来体验 YukiHookAPI,这是一个使用 Kotlin 重新构建的高效 Xposed Hook API,助你的开发变得更轻松。"
|
||||||
|
confirmButton(text = "去看看") {
|
||||||
|
context.openBrowser(url = "https://github.com/fankes/YukiHookAPI")
|
||||||
|
saveReaded()
|
||||||
|
}
|
||||||
|
cancelButton(text = "我不是开发者") { saveReaded() }
|
||||||
|
noCancelable()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
6
app/src/main/res/drawable-night/bg_dark_round.xml
Executable file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
<solid android:color="#66A6A6A6" />
|
||||||
|
<corners android:radius="15dp" />
|
||||||
|
</shape>
|
6
app/src/main/res/drawable-night/bg_permotion_round.xml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
<solid android:color="#666E6E6E" />
|
||||||
|
<corners android:radius="15dp" />
|
||||||
|
</shape>
|
10
app/src/main/res/drawable/bg_button_round.xml
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:color="#777777">
|
||||||
|
<item>
|
||||||
|
<shape android:shape="rectangle">
|
||||||
|
<solid android:color="#66DAD9D9" />
|
||||||
|
<corners android:radius="15dp" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
</ripple>
|
6
app/src/main/res/drawable/bg_dark_round.xml
Executable file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
<solid android:color="#661B1B1B" />
|
||||||
|
<corners android:radius="15dp" />
|
||||||
|
</shape>
|
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:shape="rectangle">
|
android:shape="rectangle">
|
||||||
<solid android:color="#6A6A6A" />
|
<solid android:color="#FF7043" />
|
||||||
<corners android:radius="15dp" />
|
<corners android:radius="15dp" />
|
||||||
</shape>
|
</shape>
|
6
app/src/main/res/drawable/bg_permotion_round.xml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
<solid android:color="#66E4E4E4" />
|
||||||
|
<corners android:radius="15dp" />
|
||||||
|
</shape>
|
6
app/src/main/res/drawable/bg_red_round.xml
Executable file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
<solid android:color="#FF786F" />
|
||||||
|
<corners android:radius="30dp" />
|
||||||
|
</shape>
|
@@ -1,36 +1,55 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:background="@color/colorThemeBackground"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
tools:context=".ui.MainActivity"
|
tools:context=".ui.activity.MainActivity"
|
||||||
tools:ignore="HardcodedText">
|
tools:ignore="HardcodedText,UseCompoundDrawables,ContentDescription,TooManyViews">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="@color/white"
|
android:elevation="0dp"
|
||||||
android:elevation="5dp"
|
android:gravity="center|start"
|
||||||
android:padding="15dp">
|
android:paddingLeft="15dp"
|
||||||
|
android:paddingTop="13dp"
|
||||||
|
android:paddingRight="15dp"
|
||||||
|
android:paddingBottom="5dp">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:text="TSBattery"
|
android:text="TSBattery"
|
||||||
android:textColor="#FF323B42"
|
android:textColor="@color/colorTextGray"
|
||||||
android:textSize="18sp"
|
android:textSize="25sp"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<androidx.constraintlayout.utils.widget.ImageFilterView
|
||||||
|
android:id="@+id/title_github_icon"
|
||||||
|
style="?android:attr/selectableItemBackgroundBorderless"
|
||||||
|
android:layout_width="27dp"
|
||||||
|
android:layout_height="27dp"
|
||||||
|
android:layout_marginEnd="5dp"
|
||||||
|
android:alpha="0.85"
|
||||||
|
android:src="@mipmap/ic_github"
|
||||||
|
android:tint="@color/colorTextGray" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/main_lin_status"
|
android:id="@+id/main_lin_status"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="15dp"
|
android:layout_marginLeft="15dp"
|
||||||
android:background="@drawable/dark_round"
|
android:layout_marginTop="10dp"
|
||||||
android:elevation="3dp"
|
android:layout_marginRight="15dp"
|
||||||
|
android:layout_marginBottom="5dp"
|
||||||
|
android:background="@drawable/bg_dark_round"
|
||||||
|
android:elevation="0dp"
|
||||||
android:gravity="center">
|
android:gravity="center">
|
||||||
|
|
||||||
<androidx.constraintlayout.utils.widget.ImageFilterView
|
<androidx.constraintlayout.utils.widget.ImageFilterView
|
||||||
@@ -39,14 +58,17 @@
|
|||||||
android:layout_height="25dp"
|
android:layout_height="25dp"
|
||||||
android:layout_marginStart="25dp"
|
android:layout_marginStart="25dp"
|
||||||
android:layout_marginEnd="5dp"
|
android:layout_marginEnd="5dp"
|
||||||
android:src="@mipmap/warn"
|
android:src="@mipmap/ic_warn"
|
||||||
android:tint="@color/white" />
|
android:tint="@color/white" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:padding="20dp">
|
android:paddingLeft="20dp"
|
||||||
|
android:paddingTop="10dp"
|
||||||
|
android:paddingRight="20dp"
|
||||||
|
android:paddingBottom="10dp">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/main_text_status"
|
android:id="@+id/main_text_status"
|
||||||
@@ -57,34 +79,143 @@
|
|||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
android:textSize="18sp" />
|
android:textSize="18sp" />
|
||||||
|
|
||||||
<TextView
|
<LinearLayout
|
||||||
android:id="@+id/main_text_version"
|
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginBottom="3dp"
|
android:layout_marginBottom="10dp"
|
||||||
android:alpha="0.8"
|
android:gravity="center|start"
|
||||||
android:text="当前版本:%1"
|
android:orientation="horizontal">
|
||||||
android:textColor="@color/white"
|
|
||||||
android:textSize="13sp" />
|
<TextView
|
||||||
|
android:id="@+id/main_text_version"
|
||||||
<TextView
|
android:layout_width="wrap_content"
|
||||||
android:id="@+id/main_text_support"
|
android:layout_height="wrap_content"
|
||||||
android:layout_width="wrap_content"
|
android:alpha="0.8"
|
||||||
android:layout_height="wrap_content"
|
android:text="模块版本:%1"
|
||||||
android:layout_marginBottom="3dp"
|
android:textColor="@color/white"
|
||||||
android:alpha="0.8"
|
android:textSize="13sp" />
|
||||||
android:text="支持 %1"
|
|
||||||
android:textColor="@color/white"
|
<TextView
|
||||||
android:textSize="12sp" />
|
android:id="@+id/main_text_release_version"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="5dp"
|
||||||
|
android:background="@drawable/bg_orange_round"
|
||||||
|
android:paddingLeft="5dp"
|
||||||
|
android:paddingTop="2dp"
|
||||||
|
android:paddingRight="5dp"
|
||||||
|
android:paddingBottom="2dp"
|
||||||
|
android:text="点击更新 %1"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="11sp"
|
||||||
|
android:visibility="gone" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<HorizontalScrollView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:fadingEdgeLength="10dp"
|
||||||
|
android:fillViewport="true"
|
||||||
|
android:requiresFadingEdge="horizontal"
|
||||||
|
android:scrollbars="none">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center|start"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/main_qq_item"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="10dp"
|
||||||
|
android:gravity="center|start"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="14dp"
|
||||||
|
android:layout_height="14dp"
|
||||||
|
android:layout_marginEnd="5dp"
|
||||||
|
android:src="@mipmap/ic_qq_icon" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/main_text_qq_ver"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:alpha="0.8"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:text="%1"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="11sp" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/main_tim_item"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="10dp"
|
||||||
|
android:gravity="center|start"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="14dp"
|
||||||
|
android:layout_height="14dp"
|
||||||
|
android:layout_marginEnd="5dp"
|
||||||
|
android:src="@mipmap/ic_tim_icon" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/main_text_tim_ver"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:alpha="0.8"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:text="%1"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="11sp" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/main_wechat_item"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center|start"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="14dp"
|
||||||
|
android:layout_height="14dp"
|
||||||
|
android:layout_marginEnd="5dp"
|
||||||
|
android:src="@mipmap/ic_wechat_icon" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/main_text_wechat_ver"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:alpha="0.8"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:text="%1"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="11sp" />
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
</HorizontalScrollView>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
android:id="@+id/main_text_api_way"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
android:alpha="0.6"
|
android:alpha="0.6"
|
||||||
android:text="理论在小更新内还会生效,如果失效请看下方的联系方式"
|
android:ellipsize="end"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:text="%1"
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
android:textSize="10sp"
|
android:textSize="11sp"
|
||||||
tools:ignore="SmallSp" />
|
android:visibility="gone" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
@@ -94,7 +225,6 @@
|
|||||||
android:layout_marginBottom="10dp"
|
android:layout_marginBottom="10dp"
|
||||||
android:fadingEdgeLength="10dp"
|
android:fadingEdgeLength="10dp"
|
||||||
android:fillViewport="true"
|
android:fillViewport="true"
|
||||||
android:overScrollMode="never"
|
|
||||||
android:requiresFadingEdge="vertical">
|
android:requiresFadingEdge="vertical">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@@ -108,19 +238,157 @@
|
|||||||
android:layout_marginLeft="15dp"
|
android:layout_marginLeft="15dp"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="10dp"
|
||||||
android:layout_marginRight="15dp"
|
android:layout_marginRight="15dp"
|
||||||
android:background="@drawable/white_round"
|
android:background="@drawable/bg_permotion_round"
|
||||||
android:elevation="2dp"
|
android:elevation="0dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:padding="15dp">
|
||||||
|
|
||||||
|
<androidx.constraintlayout.utils.widget.ImageFilterView
|
||||||
|
android:layout_width="15dp"
|
||||||
|
android:layout_height="15dp"
|
||||||
|
android:layout_marginEnd="15dp"
|
||||||
|
android:alpha="0.85"
|
||||||
|
android:src="@mipmap/ic_about"
|
||||||
|
android:tint="@color/colorTextDark" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:alpha="0.6"
|
||||||
|
android:lineSpacingExtra="5dp"
|
||||||
|
android:text="你可以点击上述每个图标查看最佳兼容的 APP 版本。\n没有标注的版本在适配范围内的 APP 适用性都将有效,但可能不能达到最佳使用效果,建议保持使用适配内的版本。"
|
||||||
|
android:textColor="@color/colorTextGray"
|
||||||
|
android:textSize="10sp"
|
||||||
|
tools:ignore="SmallSp" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="15dp"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_marginRight="15dp"
|
||||||
|
android:background="@drawable/bg_permotion_round"
|
||||||
|
android:elevation="0dp"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:paddingLeft="15dp"
|
android:padding="15dp">
|
||||||
android:paddingRight="15dp">
|
|
||||||
|
|
||||||
<androidx.appcompat.widget.SwitchCompat
|
<LinearLayout
|
||||||
android:id="@+id/protect_mode_switch"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="启用保守模式"
|
android:layout_marginBottom="10dp"
|
||||||
android:textColor="#FF323B42"
|
android:gravity="center|start">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="15dp"
|
||||||
|
android:layout_height="15dp"
|
||||||
|
android:layout_marginEnd="10dp"
|
||||||
|
android:src="@mipmap/ic_shot_icon" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:alpha="0.85"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:text="快捷操作"
|
||||||
|
android:textColor="@color/colorTextGray"
|
||||||
|
android:textSize="12sp" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/quick_qq_button"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="5dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="@drawable/bg_button_round"
|
||||||
|
android:gravity="center"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:text="QQ"
|
||||||
|
android:textColor="@color/colorTextGray"
|
||||||
|
android:textSize="15sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/quick_tim_button"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="5dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="@drawable/bg_button_round"
|
||||||
|
android:gravity="center"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:text="TIM"
|
||||||
|
android:textColor="@color/colorTextGray"
|
||||||
|
android:textSize="15sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/quick_wechat_button"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="@drawable/bg_button_round"
|
||||||
|
android:gravity="center"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:text="微信"
|
||||||
|
android:textColor="@color/colorTextGray"
|
||||||
|
android:textSize="15sp" />
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="15dp"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_marginRight="15dp"
|
||||||
|
android:background="@drawable/bg_permotion_round"
|
||||||
|
android:elevation="0dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:padding="15dp">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center|start">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="15dp"
|
||||||
|
android:layout_height="15dp"
|
||||||
|
android:layout_marginEnd="5dp"
|
||||||
|
android:src="@mipmap/ic_qq_icon" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="15dp"
|
||||||
|
android:layout_height="15dp"
|
||||||
|
android:layout_marginEnd="10dp"
|
||||||
|
android:src="@mipmap/ic_tim_icon" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:alpha="0.85"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:text="QQ、TIM"
|
||||||
|
android:textColor="@color/colorTextGray"
|
||||||
|
android:textSize="12sp" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<com.fankes.tsbattery.ui.view.MaterialSwitch
|
||||||
|
android:id="@+id/qqtim_protect_mode_switch"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="启用保守模式 [QQ]"
|
||||||
|
android:textColor="@color/colorTextGray"
|
||||||
android:textSize="15sp" />
|
android:textSize="15sp" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@@ -129,8 +397,96 @@
|
|||||||
android:layout_marginBottom="10dp"
|
android:layout_marginBottom="10dp"
|
||||||
android:alpha="0.6"
|
android:alpha="0.6"
|
||||||
android:lineSpacingExtra="6dp"
|
android:lineSpacingExtra="6dp"
|
||||||
android:text="此选项默认关闭,默认情况下模块将会干掉 QQ 和 TIM 自身的电源锁控制类,开启后模块将只对系统电源锁生效,如果你的 QQ 或 TIM 视频通话等设置发生了故障,可以尝试开启这个功能,开启后请重启 QQ 或 TIM。"
|
android:text="此选项默认关闭,默认情况下模块将会干掉 QQ 自身的电源锁控制类,开启后模块将只对系统电源锁生效,如果你的 QQ 视频通话等设置发生了故障,可以尝试开启这个功能,开启后请重启 QQ。"
|
||||||
android:textColor="#777777"
|
android:textColor="@color/colorTextDark"
|
||||||
|
android:textSize="12sp" />
|
||||||
|
|
||||||
|
<com.fankes.tsbattery.ui.view.MaterialSwitch
|
||||||
|
android:id="@+id/qq_tim_core_service_switch"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="35dp"
|
||||||
|
android:layout_marginBottom="5dp"
|
||||||
|
android:text="关闭 CoreService"
|
||||||
|
android:textColor="@color/colorTextGray"
|
||||||
|
android:textSize="15sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="10dp"
|
||||||
|
android:alpha="0.6"
|
||||||
|
android:lineSpacingExtra="6dp"
|
||||||
|
android:text="关闭后可能会影响消息接收与视频通话,但是会达到省电效果,如果你的系统拥有推送服务(HMS)或(GMS)可以尝试关闭。"
|
||||||
|
android:textColor="@color/colorTextDark"
|
||||||
|
android:textSize="12sp" />
|
||||||
|
|
||||||
|
<com.fankes.tsbattery.ui.view.MaterialSwitch
|
||||||
|
android:id="@+id/qq_tim_core_service_kn_switch"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="35dp"
|
||||||
|
android:layout_marginBottom="5dp"
|
||||||
|
android:text="关闭 CoreService$KernelService"
|
||||||
|
android:textColor="@color/colorTextGray"
|
||||||
|
android:textSize="15sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:alpha="0.6"
|
||||||
|
android:lineSpacingExtra="6dp"
|
||||||
|
android:text="这是一个辅助子服务,理论主服务关闭后子服务同样不会被启动,建议在保证消息接收的前提下可以尝试关闭子服务。"
|
||||||
|
android:textColor="@color/colorTextDark"
|
||||||
|
android:textSize="12sp" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="15dp"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_marginRight="15dp"
|
||||||
|
android:background="@drawable/bg_permotion_round"
|
||||||
|
android:elevation="0dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:padding="15dp">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center|start">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="15dp"
|
||||||
|
android:layout_height="15dp"
|
||||||
|
android:layout_marginEnd="10dp"
|
||||||
|
android:src="@mipmap/ic_wechat_icon" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:alpha="0.85"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:text="微信"
|
||||||
|
android:textColor="@color/colorTextGray"
|
||||||
|
android:textSize="12sp" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<com.fankes.tsbattery.ui.view.MaterialSwitch
|
||||||
|
android:id="@+id/wechat_disable_hook_switch"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="停用省电策略"
|
||||||
|
android:textColor="@color/colorTextGray"
|
||||||
|
android:textSize="15sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:alpha="0.6"
|
||||||
|
android:lineSpacingExtra="6dp"
|
||||||
|
android:text="选择停用后模块将不再对微信生效,可解决通话耳边不会黑屏和闪退问题,微信省电功能依然在开(画)发(饼),敬请期待。"
|
||||||
|
android:textColor="@color/colorTextDark"
|
||||||
android:textSize="12sp" />
|
android:textSize="12sp" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
@@ -140,19 +496,79 @@
|
|||||||
android:layout_marginLeft="15dp"
|
android:layout_marginLeft="15dp"
|
||||||
android:layout_marginTop="15dp"
|
android:layout_marginTop="15dp"
|
||||||
android:layout_marginRight="15dp"
|
android:layout_marginRight="15dp"
|
||||||
android:background="@drawable/white_round"
|
android:background="@drawable/bg_permotion_round"
|
||||||
android:elevation="2dp"
|
android:elevation="0dp"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:paddingLeft="15dp"
|
android:paddingLeft="15dp"
|
||||||
|
android:paddingTop="15dp"
|
||||||
android:paddingRight="15dp">
|
android:paddingRight="15dp">
|
||||||
|
|
||||||
<androidx.appcompat.widget.SwitchCompat
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center|start">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="15dp"
|
||||||
|
android:layout_height="15dp"
|
||||||
|
android:layout_marginEnd="10dp"
|
||||||
|
android:src="@mipmap/ic_bug" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:alpha="0.85"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:text="调试功能"
|
||||||
|
android:textColor="@color/colorTextGray"
|
||||||
|
android:textSize="12sp" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<com.fankes.tsbattery.ui.view.MaterialSwitch
|
||||||
|
android:id="@+id/notify_notify_tip_switch"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="通知栏显示守护状态"
|
||||||
|
android:textColor="@color/colorTextGray"
|
||||||
|
android:textSize="15sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="10dp"
|
||||||
|
android:alpha="0.6"
|
||||||
|
android:lineSpacingExtra="6dp"
|
||||||
|
android:text="此功能仅支持 QQ、TIM,在开启“系统通知栏显示 QQ、TIM 图标”后系统通知后方将在最后显示“TSBattery 守护中”字样以判断模块已经生效,若不喜欢,你可以随时关闭这个功能。"
|
||||||
|
android:textColor="@color/colorTextDark"
|
||||||
|
android:textSize="12sp" />
|
||||||
|
|
||||||
|
<com.fankes.tsbattery.ui.view.MaterialSwitch
|
||||||
|
android:id="@+id/setting_module_tip_switch"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="35dp"
|
||||||
|
android:layout_marginBottom="5dp"
|
||||||
|
android:text="设置页面显示守护状态"
|
||||||
|
android:textColor="@color/colorTextGray"
|
||||||
|
android:textSize="15sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="10dp"
|
||||||
|
android:alpha="0.6"
|
||||||
|
android:lineSpacingExtra="6dp"
|
||||||
|
android:text="此功能仅支持 QQ、TIM,开启后将会在宿主设置页面显示一个条目来展示激活状态,与大部分 QQ、TIM 模块显示方式一致,建议保持开启以快速确定模块是否正常生效。"
|
||||||
|
android:textColor="@color/colorTextDark"
|
||||||
|
android:textSize="12sp" />
|
||||||
|
|
||||||
|
<com.fankes.tsbattery.ui.view.MaterialSwitch
|
||||||
android:id="@+id/notify_module_info_switch"
|
android:id="@+id/notify_module_info_switch"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="35dp"
|
||||||
|
android:layout_marginBottom="5dp"
|
||||||
android:text="提示模块运行信息"
|
android:text="提示模块运行信息"
|
||||||
android:textColor="#FF323B42"
|
android:textColor="@color/colorTextGray"
|
||||||
android:textSize="15sp" />
|
android:textSize="15sp" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@@ -161,8 +577,8 @@
|
|||||||
android:layout_marginBottom="10dp"
|
android:layout_marginBottom="10dp"
|
||||||
android:alpha="0.6"
|
android:alpha="0.6"
|
||||||
android:lineSpacingExtra="6dp"
|
android:lineSpacingExtra="6dp"
|
||||||
android:text="模块工作正常情况下不要开启,如果你想测试模块是否正常激活,可以打开此提示,开启后将会在启动 QQ 或 TIM 的时候提示运行信息。"
|
android:text="模块工作正常情况下无需开启,如果你想测试模块是否正常激活,可以打开此提示,开启后将会在启动 QQ、TIM 或微信的时候提示运行信息。"
|
||||||
android:textColor="#777777"
|
android:textColor="@color/colorTextDark"
|
||||||
android:textSize="12sp" />
|
android:textSize="12sp" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
@@ -172,19 +588,41 @@
|
|||||||
android:layout_marginLeft="15dp"
|
android:layout_marginLeft="15dp"
|
||||||
android:layout_marginTop="15dp"
|
android:layout_marginTop="15dp"
|
||||||
android:layout_marginRight="15dp"
|
android:layout_marginRight="15dp"
|
||||||
android:background="@drawable/white_round"
|
android:background="@drawable/bg_permotion_round"
|
||||||
android:elevation="2dp"
|
android:elevation="0dp"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:paddingLeft="15dp"
|
android:paddingLeft="15dp"
|
||||||
|
android:paddingTop="15dp"
|
||||||
android:paddingRight="15dp">
|
android:paddingRight="15dp">
|
||||||
|
|
||||||
<androidx.appcompat.widget.SwitchCompat
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center|start">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="15dp"
|
||||||
|
android:layout_height="15dp"
|
||||||
|
android:layout_marginEnd="10dp"
|
||||||
|
android:src="@mipmap/ic_home" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:alpha="0.85"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:text="显示设置"
|
||||||
|
android:textColor="@color/colorTextGray"
|
||||||
|
android:textSize="12sp" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<com.fankes.tsbattery.ui.view.MaterialSwitch
|
||||||
android:id="@+id/hide_icon_in_launcher_switch"
|
android:id="@+id/hide_icon_in_launcher_switch"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="在桌面隐藏模块图标"
|
android:text="在桌面隐藏模块图标"
|
||||||
android:textColor="#FF323B42"
|
android:textColor="@color/colorTextGray"
|
||||||
android:textSize="15sp" />
|
android:textSize="15sp" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@@ -193,8 +631,18 @@
|
|||||||
android:layout_marginBottom="10dp"
|
android:layout_marginBottom="10dp"
|
||||||
android:alpha="0.6"
|
android:alpha="0.6"
|
||||||
android:lineSpacingExtra="6dp"
|
android:lineSpacingExtra="6dp"
|
||||||
android:text="隐藏模块图标后,模块不会再在桌面显示,你可以在 EdXposed、太极、LsPosed 中找到模块设置并打开。"
|
android:text="隐藏模块图标后界面可能会被关闭,将不会再在桌面显示,你可以在 EdXposed、LSPosed 中找到模块设置并打开。"
|
||||||
android:textColor="#777777"
|
android:textColor="@color/colorTextDark"
|
||||||
|
android:textSize="12sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="10dp"
|
||||||
|
android:alpha="0.6"
|
||||||
|
android:lineSpacingExtra="6dp"
|
||||||
|
android:text="注意:请务必在 LSPosed 中关闭“强制显示桌面图标”功能"
|
||||||
|
android:textColor="#FF5722"
|
||||||
android:textSize="12sp" />
|
android:textSize="12sp" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
@@ -204,35 +652,32 @@
|
|||||||
android:layout_marginLeft="15dp"
|
android:layout_marginLeft="15dp"
|
||||||
android:layout_marginTop="15dp"
|
android:layout_marginTop="15dp"
|
||||||
android:layout_marginRight="15dp"
|
android:layout_marginRight="15dp"
|
||||||
android:background="@drawable/white_round"
|
android:background="@drawable/bg_permotion_round"
|
||||||
android:elevation="2dp"
|
android:elevation="0dp"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:paddingLeft="15dp"
|
android:padding="15dp"
|
||||||
android:paddingRight="15dp">
|
android:paddingTop="15dp">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginBottom="15dp"
|
||||||
android:layout_marginBottom="10dp"
|
|
||||||
android:gravity="center|start">
|
android:gravity="center|start">
|
||||||
|
|
||||||
<androidx.constraintlayout.utils.widget.ImageFilterView
|
<ImageView
|
||||||
android:layout_width="15dp"
|
android:layout_width="15dp"
|
||||||
android:layout_height="15dp"
|
android:layout_height="15dp"
|
||||||
android:layout_marginEnd="5dp"
|
android:layout_marginEnd="10dp"
|
||||||
android:alpha="0.85"
|
android:src="@mipmap/ic_help" />
|
||||||
android:src="@mipmap/about"
|
|
||||||
android:tint="#FF323B42" />
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:alpha="0.85"
|
android:alpha="0.85"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:text="使用帮助与说明"
|
android:text="使用帮助&说明"
|
||||||
android:textColor="#FF323B42"
|
android:textColor="@color/colorTextGray"
|
||||||
android:textSize="12sp" />
|
android:textSize="12sp" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
@@ -241,9 +686,9 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginBottom="10dp"
|
android:layout_marginBottom="10dp"
|
||||||
android:alpha="0.8"
|
android:alpha="0.8"
|
||||||
android:lineSpacingExtra="6dp"
|
android:lineSpacingExtra="10dp"
|
||||||
android:text="Q.这个模块是做什么的?\nA.此模块的诞生来源于国内厂商毒瘤 APP 强行霸占后台耗电,QQ 在 8.6.0 版本以后也只是接入了 HMS 推送,但是可笑的是开发组却并没有删除之前疯狂耗电的接收消息方法,于是这个模块就诞生了。"
|
android:text="Q.这个模块是做什么的?\nA.此模块的诞生来源于国内厂商毒瘤 APP 强行霸占后台耗电,QQ 在 8.6.0 版本以后也只是接入了 HMS 推送,但是可笑的是开发组却并没有删除之前疯狂耗电的接收消息方法,于是这个模块就因此而诞生了。"
|
||||||
android:textColor="#777777"
|
android:textColor="@color/colorTextDark"
|
||||||
android:textSize="12sp" />
|
android:textSize="12sp" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@@ -251,9 +696,9 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginBottom="10dp"
|
android:layout_marginBottom="10dp"
|
||||||
android:alpha="0.8"
|
android:alpha="0.8"
|
||||||
android:lineSpacingExtra="6dp"
|
android:lineSpacingExtra="10dp"
|
||||||
android:text="Q.原理是什么?\nA.模块有两套工作方式,一种是针对 QQ、TIM Hook 掉系统自身的电源锁“WakeLock”使其不能影响系统休眠,这样子在锁屏的时候 QQ、TIM 就可以进入睡眠状态。第二种就是针对 QQ、TIM 删除其自身的无用耗电疯狂循环检测后台强行保活服务。"
|
android:text="Q.原理是什么?\nA.模块有两套工作方式,一种是针对 QQ、TIM Hook 掉系统自身的电源锁“WakeLock”使其不能影响系统休眠,这样子在锁屏的时候 QQ、TIM 就可以进入睡眠状态。第二种就是针对 QQ、TIM 删除其自身的无用耗电疯狂循环检测后台强行保活服务。"
|
||||||
android:textColor="#777777"
|
android:textColor="@color/colorTextDark"
|
||||||
android:textSize="12sp" />
|
android:textSize="12sp" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@@ -261,9 +706,9 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginBottom="10dp"
|
android:layout_marginBottom="10dp"
|
||||||
android:alpha="0.8"
|
android:alpha="0.8"
|
||||||
android:lineSpacingExtra="6dp"
|
android:lineSpacingExtra="10dp"
|
||||||
android:text="Q.如何使用?\nA.目前模块支持 EdXposed、LsPosed 以及太极(无极)框架,在太极和 LsPosed 的作用域中,只需勾选 QQ 和 TIM 即可,模块可以做到即插即用,激活后无需重启手机,重启 QQ 或 TIM 就可以了。"
|
android:text="Q.如何使用?\nA.目前模块支持 LSPosed、EdXposed 以及太极(无极)框架,在太极和 LSPosed 的作用域中,只需勾选 QQ、TIM、微信即可,模块可以做到即插即用,激活后无需重启手机,重启 QQ、TIM 或微信就可以了。"
|
||||||
android:textColor="#777777"
|
android:textColor="@color/colorTextDark"
|
||||||
android:textSize="12sp" />
|
android:textSize="12sp" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@@ -271,9 +716,9 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginBottom="10dp"
|
android:layout_marginBottom="10dp"
|
||||||
android:alpha="0.8"
|
android:alpha="0.8"
|
||||||
android:lineSpacingExtra="6dp"
|
android:lineSpacingExtra="10dp"
|
||||||
android:text="Q.激活后一定可以非常省电吗?\nA.并不,模块只能减少 QQ、TIM 的耗电,但是请务必记住这一点,省电只是一个理论上的东西,实际水平由你使用的系统和硬件决定,如果你在前台疯狂使用 QQ、TIM,那么照样会耗电,模块只能保证后台运行和锁屏时毒瘤不会消耗过多的无用的电量,仅此而已。"
|
android:text="Q.激活后一定可以非常省电吗?\nA.并不,模块只能减少 QQ、TIM、微信的耗电,但是请务必记住这一点,省电只是一个理论上的东西,实际水平由你使用的系统和硬件决定,如果你在前台疯狂使用 QQ、TIM,那么照样会耗电,模块只能保证后台运行和锁屏时毒瘤不会消耗过多的无用的电量,仅此而已。"
|
||||||
android:textColor="#777777"
|
android:textColor="@color/colorTextDark"
|
||||||
android:textSize="12sp" />
|
android:textSize="12sp" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@@ -281,59 +726,38 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginBottom="10dp"
|
android:layout_marginBottom="10dp"
|
||||||
android:alpha="0.8"
|
android:alpha="0.8"
|
||||||
android:lineSpacingExtra="6dp"
|
android:lineSpacingExtra="10dp"
|
||||||
|
android:text="Q.模块是否需要挂后台?\nA.模块完全不需要挂后台,模块只是一个控制和显示的工具,真正的任务交由 Hook 处理,若出现失效的情况请发送模块运行日志给我们而不是将模块挂后台。"
|
||||||
|
android:textColor="@color/colorTextDark"
|
||||||
|
android:textSize="12sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="10dp"
|
||||||
|
android:alpha="0.8"
|
||||||
|
android:lineSpacingExtra="10dp"
|
||||||
|
android:text="Q.关于目前微信的适配情况?\nA.微信适配尚在实验阶段,敬请期待。"
|
||||||
|
android:textColor="@color/colorTextDark"
|
||||||
|
android:textSize="12sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="10dp"
|
||||||
|
android:alpha="0.8"
|
||||||
|
android:lineSpacingExtra="10dp"
|
||||||
|
android:text="Q.如何对单独的 APP 生效模块?\nA.请在 LSPosed 中勾选对应定义域即可,我们不建议使用 EdXposed。"
|
||||||
|
android:textColor="@color/colorTextDark"
|
||||||
|
android:textSize="12sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:alpha="0.8"
|
||||||
|
android:lineSpacingExtra="10dp"
|
||||||
android:text="Q.如何反馈问题?\nA.酷安关注 @星夜不荟"
|
android:text="Q.如何反馈问题?\nA.酷安关注 @星夜不荟"
|
||||||
android:textColor="#777777"
|
android:textColor="@color/colorTextDark"
|
||||||
android:textSize="12sp" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/link_with_project_address"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginLeft="15dp"
|
|
||||||
android:layout_marginTop="15dp"
|
|
||||||
android:layout_marginRight="15dp"
|
|
||||||
android:background="@drawable/white_round"
|
|
||||||
android:elevation="2dp"
|
|
||||||
android:gravity="center"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:paddingLeft="15dp"
|
|
||||||
android:paddingRight="15dp">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
android:layout_marginBottom="10dp"
|
|
||||||
android:gravity="center|start">
|
|
||||||
|
|
||||||
<androidx.constraintlayout.utils.widget.ImageFilterView
|
|
||||||
android:layout_width="15dp"
|
|
||||||
android:layout_height="15dp"
|
|
||||||
android:layout_marginEnd="5dp"
|
|
||||||
android:alpha="0.85"
|
|
||||||
android:src="@mipmap/about"
|
|
||||||
android:tint="#FF323B42" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:alpha="0.85"
|
|
||||||
android:singleLine="true"
|
|
||||||
android:text="项目地址"
|
|
||||||
android:textColor="#FF323B42"
|
|
||||||
android:textSize="12sp" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginBottom="10dp"
|
|
||||||
android:alpha="0.8"
|
|
||||||
android:lineSpacingExtra="6dp"
|
|
||||||
android:text="本软件是免费开源项目,遵循 GPL 协议,你可以点击这里前往 Github 查看源码以及获取模块更新。\n严禁以任何形式贩卖、商用本软件,否则开发者有权追究其法律责任。"
|
|
||||||
android:textColor="#777777"
|
|
||||||
android:textSize="12sp" />
|
android:textSize="12sp" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
@@ -344,30 +768,37 @@
|
|||||||
android:layout_marginTop="15dp"
|
android:layout_marginTop="15dp"
|
||||||
android:layout_marginRight="15dp"
|
android:layout_marginRight="15dp"
|
||||||
android:layout_marginBottom="10dp"
|
android:layout_marginBottom="10dp"
|
||||||
android:background="@drawable/white_round"
|
android:background="@drawable/bg_permotion_round"
|
||||||
android:elevation="2dp"
|
android:elevation="0dp"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:paddingLeft="15dp"
|
android:paddingLeft="15dp"
|
||||||
android:paddingRight="15dp">
|
android:paddingRight="15dp">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
android:id="@+id/link_with_follow_me"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="10dp"
|
||||||
android:layout_marginBottom="10dp"
|
android:layout_marginBottom="10dp"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:lineSpacingExtra="6dp"
|
android:lineSpacingExtra="6dp"
|
||||||
android:text="恰饭时间\n酷安关注我,获取我的更多应用"
|
android:text="恰饭时间\n点击前往酷安关注我,获取我的更多应用"
|
||||||
android:textColor="#FF323B42"
|
android:textColor="@color/colorTextGray"
|
||||||
android:textSize="16sp" />
|
android:textSize="16sp" />
|
||||||
|
|
||||||
<ImageView
|
<androidx.cardview.widget.CardView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginBottom="10dp"
|
android:layout_marginBottom="10dp"
|
||||||
android:src="@mipmap/qr_pay"
|
app:cardCornerRadius="15dp"
|
||||||
tools:ignore="ContentDescription" />
|
app:cardElevation="0dp">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:src="@mipmap/bg_qr_pay" />
|
||||||
|
</androidx.cardview.widget.CardView>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@@ -376,9 +807,38 @@
|
|||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:lineSpacingExtra="6dp"
|
android:lineSpacingExtra="6dp"
|
||||||
android:text="开发者 酷安 @星夜不荟\n未经允许不得转载、修改复制我的劳动成果"
|
android:text="开发者 酷安 @星夜不荟\n未经允许不得转载、修改复制我的劳动成果"
|
||||||
android:textColor="#FF323B42"
|
android:textColor="@color/colorTextGray"
|
||||||
android:textSize="16sp" />
|
android:textSize="16sp" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="15dp"
|
||||||
|
android:layout_marginRight="15dp"
|
||||||
|
android:layout_marginBottom="10dp"
|
||||||
|
android:background="@drawable/bg_permotion_round"
|
||||||
|
android:gravity="center|start"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:padding="10dp">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="35dp"
|
||||||
|
android:layout_height="35dp"
|
||||||
|
android:layout_marginEnd="10dp"
|
||||||
|
android:src="@mipmap/ic_yukihookapi" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:autoLink="web"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:lineSpacingExtra="6dp"
|
||||||
|
android:maxLines="2"
|
||||||
|
android:text="此模块使用 YukiHookAPI 构建。\n了解更多 https://github.com/fankes/YukiHookAPI"
|
||||||
|
android:textColor="@color/colorTextGray"
|
||||||
|
android:textSize="11sp" />
|
||||||
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</androidx.core.widget.NestedScrollView>
|
</androidx.core.widget.NestedScrollView>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
Before Width: | Height: | Size: 201 KiB After Width: | Height: | Size: 201 KiB |
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 4.3 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_bug.png
Normal file
After Width: | Height: | Size: 5.3 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_github.png
Normal file
After Width: | Height: | Size: 5.8 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_help.png
Normal file
After Width: | Height: | Size: 5.6 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_home.png
Normal file
After Width: | Height: | Size: 4.7 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_qq_icon.png
Normal file
After Width: | Height: | Size: 7.8 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_shot_icon.png
Normal file
After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_tim_icon.png
Normal file
After Width: | Height: | Size: 5.2 KiB |
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 4.0 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_wechat_icon.png
Normal file
After Width: | Height: | Size: 6.2 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_yukihookapi.png
Normal file
After Width: | Height: | Size: 8.3 KiB |
6
app/src/main/res/values-night/color.xml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<color name="colorThemeBackground">#FF2D2D2D</color>
|
||||||
|
<color name="colorTextDark">#FFCFCFCF</color>
|
||||||
|
<color name="colorTextGray">#FFD3D3D3</color>
|
||||||
|
</resources>
|
@@ -1,16 +1,16 @@
|
|||||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
<resources>
|
||||||
<!-- Base application theme. -->
|
<!-- Base application theme. -->
|
||||||
<style name="Theme.TSBattery" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
|
<style name="Theme.TSBattery" parent="Theme.Material3.DayNight">
|
||||||
<!-- Primary brand color. -->
|
<!-- Primary brand color. -->
|
||||||
<item name="colorPrimary">@color/purple_200</item>
|
<item name="colorPrimary">@color/colorPrimaryAccent</item>
|
||||||
<item name="colorPrimaryVariant">@color/purple_700</item>
|
<item name="colorPrimaryVariant">@color/colorPrimaryAccent</item>
|
||||||
<item name="colorOnPrimary">@color/black</item>
|
<item name="colorOnPrimary">@color/black</item>
|
||||||
<!-- Secondary brand color. -->
|
<!-- Secondary brand color. -->
|
||||||
<item name="colorSecondary">@color/teal_200</item>
|
<item name="colorSecondary">@color/colorPrimaryAccent</item>
|
||||||
<item name="colorSecondaryVariant">@color/teal_200</item>
|
<item name="colorSecondaryVariant">@color/colorPrimaryAccent</item>
|
||||||
<item name="colorOnSecondary">@color/black</item>
|
<item name="colorOnSecondary">@color/colorPrimaryAccent</item>
|
||||||
<!-- Status bar color. -->
|
<!-- Status bar color. -->
|
||||||
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
|
<item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
|
||||||
<!-- Customize your theme here. -->
|
<!-- Customize your theme here. -->
|
||||||
</style>
|
</style>
|
||||||
</resources>
|
</resources>
|
8
app/src/main/res/values/array.xml
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string-array name="module_scope">
|
||||||
|
<item>com.tencent.mobileqq</item>
|
||||||
|
<item>com.tencent.tim</item>
|
||||||
|
<item>com.tencent.mm</item>
|
||||||
|
</string-array>
|
||||||
|
</resources>
|
6
app/src/main/res/values/color.xml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<color name="colorThemeBackground">#FFFFFFFF</color>
|
||||||
|
<color name="colorTextDark">#FF777777</color>
|
||||||
|
<color name="colorTextGray">#FF323B42</color>
|
||||||
|
</resources>
|
@@ -1,10 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<color name="purple_200">#656565</color>
|
<color name="colorPrimaryAccent">#656565</color>
|
||||||
<color name="purple_500">#656565</color>
|
|
||||||
<color name="purple_700">#656565</color>
|
|
||||||
<color name="teal_200">#656565</color>
|
|
||||||
<color name="teal_700">#656565</color>
|
|
||||||
<color name="black">#FF000000</color>
|
<color name="black">#FF000000</color>
|
||||||
<color name="white">#FFFFFFFF</color>
|
<color name="white">#FFFFFFFF</color>
|
||||||
</resources>
|
</resources>
|
@@ -1,16 +1,16 @@
|
|||||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
<resources>
|
||||||
<!-- Base application theme. -->
|
<!-- Base application theme. -->
|
||||||
<style name="Theme.TSBattery" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
|
<style name="Theme.TSBattery" parent="Theme.Material3.DayNight">
|
||||||
<!-- Primary brand color. -->
|
<!-- Primary brand color. -->
|
||||||
<item name="colorPrimary">@color/purple_500</item>
|
<item name="colorPrimary">@color/colorPrimaryAccent</item>
|
||||||
<item name="colorPrimaryVariant">@color/purple_700</item>
|
<item name="colorPrimaryVariant">@color/colorPrimaryAccent</item>
|
||||||
<item name="colorOnPrimary">@color/teal_700</item>
|
<item name="colorOnPrimary">@color/colorPrimaryAccent</item>
|
||||||
<!-- Secondary brand color. -->
|
<!-- Secondary brand color. -->
|
||||||
<item name="colorSecondary">@color/teal_200</item>
|
<item name="colorSecondary">@color/colorPrimaryAccent</item>
|
||||||
<item name="colorSecondaryVariant">@color/teal_700</item>
|
<item name="colorSecondaryVariant">@color/colorPrimaryAccent</item>
|
||||||
<item name="colorOnSecondary">@color/black</item>
|
<item name="colorOnSecondary">@color/colorPrimaryAccent</item>
|
||||||
<!-- Status bar color. -->
|
<!-- Status bar color. -->
|
||||||
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
|
<item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
|
||||||
<!-- Customize your theme here. -->
|
<!-- Customize your theme here. -->
|
||||||
</style>
|
</style>
|
||||||
</resources>
|
</resources>
|
BIN
banner.png
Normal file
After Width: | Height: | Size: 38 KiB |
33
build.gradle
@@ -1,30 +1,13 @@
|
|||||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
plugins {
|
||||||
buildscript {
|
id 'com.android.application' version '7.2.1' apply false
|
||||||
ext.kotlin_version = "1.6.0"
|
id 'com.android.library' version '7.2.1' apply false
|
||||||
repositories {
|
id 'org.jetbrains.kotlin.android' version '1.7.10' apply false
|
||||||
google()
|
|
||||||
maven { url 'https://maven.aliyun.com/nexus/content/groups/public/' }
|
|
||||||
maven { url 'https://maven.aliyun.com/nexus/content/repositories/jcenter' }
|
|
||||||
maven { url "https://www.jitpack.io" }
|
|
||||||
mavenCentral()
|
|
||||||
}
|
|
||||||
dependencies {
|
|
||||||
classpath "com.android.tools.build:gradle:7.0.3"
|
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
|
||||||
|
|
||||||
// NOTE: Do not place your application dependencies here; they belong
|
|
||||||
// in the individual module build.gradle files
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
allprojects {
|
ext {
|
||||||
repositories {
|
appVersionName = "3.99.6"
|
||||||
google()
|
appVersionCode = 24
|
||||||
maven { url 'https://maven.aliyun.com/nexus/content/groups/public/' }
|
enableR8 = true
|
||||||
maven { url 'https://maven.aliyun.com/nexus/content/repositories/jcenter' }
|
|
||||||
maven { url "https://www.jitpack.io" }
|
|
||||||
mavenCentral()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
task clean(type: Delete) {
|
task clean(type: Delete) {
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||||
# Specifies the JVM arguments used for the daemon process.
|
# Specifies the JVM arguments used for the daemon process.
|
||||||
# The setting is particularly useful for tweaking memory settings.
|
# The setting is particularly useful for tweaking memory settings.
|
||||||
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
|
org.gradle.jvmargs=-XX:+UseParallelGC
|
||||||
# When configured, Gradle will run in incubating parallel mode.
|
# When configured, Gradle will run in incubating parallel mode.
|
||||||
# This option should only be used with decoupled projects. More details, visit
|
# This option should only be used with decoupled projects. More details, visit
|
||||||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||||
@@ -18,4 +18,6 @@ android.useAndroidX=true
|
|||||||
# Automatically convert third-party libraries to use AndroidX
|
# Automatically convert third-party libraries to use AndroidX
|
||||||
android.enableJetifier=true
|
android.enableJetifier=true
|
||||||
# Kotlin code style for this project: "official" or "obsolete":
|
# Kotlin code style for this project: "official" or "obsolete":
|
||||||
kotlin.code.style=official
|
kotlin.code.style=official
|
||||||
|
# Incremental
|
||||||
|
kotlin.incremental.useClasspathSnapshot=true
|
4
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,6 +1,6 @@
|
|||||||
#Sat Sep 04 04:05:23 CST 2021
|
#Wed May 25 04:34:58 CST 2022
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
@@ -1,2 +1,19 @@
|
|||||||
|
pluginManagement {
|
||||||
|
repositories {
|
||||||
|
gradlePluginPortal()
|
||||||
|
google()
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dependencyResolutionManagement {
|
||||||
|
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
||||||
|
repositories {
|
||||||
|
google()
|
||||||
|
maven { url "https://api.xposed.info/" }
|
||||||
|
maven { url "https://www.jitpack.io" }
|
||||||
|
maven { url "https://s01.oss.sonatype.org/content/repositories/releases" }
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
}
|
||||||
rootProject.name = "TSBattery"
|
rootProject.name = "TSBattery"
|
||||||
include ':app'
|
include ':app'
|
||||||
|