mirror of
https://github.com/fankes/TSBattery.git
synced 2025-09-05 02:05:16 +08:00
Compare commits
19 Commits
Author | SHA1 | Date | |
---|---|---|---|
8043457a6e | |||
d4a1536d70 | |||
5c784f65f8 | |||
1c6c6e6480 | |||
4712d0063b | |||
583c72470b | |||
8cf945b670 | |||
6fba93e1fa | |||
288563ef68 | |||
d1e4c17817 | |||
c8ec50cb29 | |||
b6e042b9d0 | |||
3c4789d9a0 | |||
46ff5f4bcf | |||
09eeeeab5f | |||
f285e6f96d | |||
fb90d4051b | |||
911eb042a6 | |||
9d48732140 |
@@ -35,7 +35,7 @@ fun a(test: String) {
|
|||||||
val a = "" // 变量注释
|
val a = "" // 变量注释
|
||||||
```
|
```
|
||||||
|
|
||||||
- ⚠️注意:只允许两个 // 后方要有空格
|
- ⚠️ 注意:只允许两个 // 后方要有空格
|
||||||
|
|
||||||
## 项目要求
|
## 项目要求
|
||||||
|
|
||||||
|
25
README.md
25
README.md
@@ -2,40 +2,46 @@
|
|||||||
|
|
||||||
[](https://github.com/fankes/TSBattery)
|
[](https://github.com/fankes/TSBattery)
|
||||||
[](https://github.com/fankes/TSBattery/blob/master/LICENSE)
|
[](https://github.com/fankes/TSBattery/blob/master/LICENSE)
|
||||||
[](https://github.com/fankes/TSBattery/releases)
|
[](https://github.com/fankes/TSBattery/releases)
|
||||||
[](https://github.com/fankes/TSBattery/releases)
|
[](https://github.com/fankes/TSBattery/releases)
|
||||||
[](https://github.com/Xposed-Modules-Repo/com.fankes.tsbattery/releases)
|
[](https://github.com/Xposed-Modules-Repo/com.fankes.tsbattery/releases)
|
||||||
[](https://t.me/XiaofangInternet)
|
[](https://t.me/XiaofangInternet)
|
||||||
<br/><br/>
|
<br/><br/>
|
||||||
<br/>
|
<br/>
|
||||||
A new way to save your battery avoid cancer apps hacker it.<br/>
|
A new way to save your battery avoid cancer apps hacker it.
|
||||||
|
|
||||||
TSBattery 是一个旨在使 QQ、TIM、微信 变得更省电的开源 Xposed 模块。
|
TSBattery 是一个旨在使 QQ、TIM、微信 变得更省电的开源 Xposed 模块。
|
||||||
|
|
||||||
# Developer
|
## Developer
|
||||||
|
|
||||||
[酷安 @星夜不荟](http://www.coolapk.com/u/876977)
|
[酷安 @星夜不荟](http://www.coolapk.com/u/876977)
|
||||||
|
|
||||||
# 适配说明
|
## 适配说明
|
||||||
|
|
||||||
- 支持并建议使用 <b>LSPosed</b>(若作用域没有自动出现推荐请勾选 QQ、TIM、微信)
|
- 支持并建议使用 <b>LSPosed</b>(若作用域没有自动出现推荐请勾选 QQ、TIM、微信)
|
||||||
|
|
||||||
- 可以使用 <b>~~EdXposed~~</b>,但随时停止支持
|
- 可以使用 <b>~~EdXposed~~</b>,但随时停止支持
|
||||||
|
|
||||||
- <b>太极无极 · 阴</b> 支持性不是很好,建议使用 <b>太极无极 · 阳</b>
|
- <b>太极无极 · 阴</b> 支持性不是很好,建议使用 <b>太极无极 · 阳</b>
|
||||||
|
|
||||||
- 支持 <b>Pine</b>(梦境模块) 但是部分功能有限制
|
- 支持 <b>Pine</b>(梦境模块) 但是部分功能有限制
|
||||||
|
|
||||||
- 请不要使用 <b>~~应用转生~~</b>,发生封号情况后果自负
|
- 请不要使用 <b>~~应用转生~~</b>,发生封号情况后果自负
|
||||||
|
|
||||||
# 请勿用于非法用途
|
## 请勿用于非法用途
|
||||||
|
|
||||||
- 本模块完全开源免费,如果好用你可以打赏支持开发,但是请不要用于非法用途。
|
- 本模块完全开源免费,如果好用你可以打赏支持开发,但是请不要用于非法用途。
|
||||||
|
|
||||||
- 本模块发布地址仅有 [Xposed-Modules-Repo](https://github.com/Xposed-Modules-Repo/com.fankes.tsbattery/releases)、
|
- 本模块发布地址仅有 [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),从其他非正规渠道下载到的版本或对您造成任何影响均与我们无关。
|
[Release](https://github.com/fankes/TSBattery/releases) 及 [蓝奏云](https://fankes.lanzouy.com/b02zfz3sj),从其他非正规渠道下载到的版本或对您造成任何影响均与我们无关。
|
||||||
|
|
||||||
# 开始贡献
|
## 开始贡献
|
||||||
|
|
||||||
欢迎为此项目进行新版本的适配代码贡献!<br/>
|
欢迎为此项目进行新版本的适配代码贡献!<br/>
|
||||||
|
|
||||||
- [CONTRIBUTING](https://github.com/fankes/TSBattery/blob/master/CONTRIBUTING.md)
|
- [CONTRIBUTING](https://github.com/fankes/TSBattery/blob/master/CONTRIBUTING.md)
|
||||||
|
|
||||||
# 许可证
|
## 许可证
|
||||||
|
|
||||||
- [AGPL-3.0](https://www.gnu.org/licenses/agpl-3.0.html)
|
- [AGPL-3.0](https://www.gnu.org/licenses/agpl-3.0.html)
|
||||||
|
|
||||||
@@ -56,5 +62,6 @@ 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/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
```
|
```
|
||||||
|
|
||||||
Powered by [YukiHookAPI](https://github.com/fankes/YukiHookAPI)<br/><br/>
|
Powered by [YukiHookAPI](https://github.com/fankes/YukiHookAPI)
|
||||||
|
|
||||||
版权所有 © 2019-2022 Fankes Studio(qzmmcn@163.com)
|
版权所有 © 2019-2022 Fankes Studio(qzmmcn@163.com)
|
@@ -1,7 +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.6.10-1.0.4'
|
id 'com.google.devtools.ksp' version '1.6.20-1.0.5'
|
||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
@@ -25,20 +25,12 @@ android {
|
|||||||
versionCode rootProject.ext.appVersionCode
|
versionCode rootProject.ext.appVersionCode
|
||||||
versionName rootProject.ext.appVersionName
|
versionName rootProject.ext.appVersionName
|
||||||
|
|
||||||
kotlinOptions {
|
|
||||||
freeCompilerArgs = [
|
|
||||||
'-Xno-param-assertions',
|
|
||||||
'-Xno-call-assertions',
|
|
||||||
'-Xno-receiver-assertions'
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
release {
|
release {
|
||||||
minifyEnabled true
|
minifyEnabled 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'
|
||||||
}
|
}
|
||||||
@@ -49,6 +41,11 @@ android {
|
|||||||
}
|
}
|
||||||
kotlinOptions {
|
kotlinOptions {
|
||||||
jvmTarget = '11'
|
jvmTarget = '11'
|
||||||
|
freeCompilerArgs = [
|
||||||
|
'-Xno-param-assertions',
|
||||||
|
'-Xno-call-assertions',
|
||||||
|
'-Xno-receiver-assertions'
|
||||||
|
]
|
||||||
}
|
}
|
||||||
buildFeatures {
|
buildFeatures {
|
||||||
viewBinding true
|
viewBinding true
|
||||||
@@ -72,8 +69,8 @@ tasks.whenTaskAdded {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compileOnly 'de.robv.android.xposed:api:82'
|
compileOnly 'de.robv.android.xposed:api:82'
|
||||||
implementation 'com.highcapable.yukihookapi:api:1.0.69'
|
implementation 'com.highcapable.yukihookapi:api:1.0.80'
|
||||||
ksp 'com.highcapable.yukihookapi:ksp-xposed:1.0.69'
|
ksp 'com.highcapable.yukihookapi:ksp-xposed:1.0.80'
|
||||||
implementation 'com.squareup.okhttp3:okhttp:4.9.3'
|
implementation 'com.squareup.okhttp3:okhttp:4.9.3'
|
||||||
implementation 'com.geyifeng.immersionbar:immersionbar:3.2.0'
|
implementation 'com.geyifeng.immersionbar:immersionbar:3.2.0'
|
||||||
implementation 'com.geyifeng.immersionbar:immersionbar-ktx:3.2.0'
|
implementation 'com.geyifeng.immersionbar:immersionbar-ktx:3.2.0'
|
||||||
|
8
app/proguard-rules.pro
vendored
8
app/proguard-rules.pro
vendored
@@ -20,7 +20,6 @@
|
|||||||
# 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
|
||||||
@@ -35,13 +34,6 @@
|
|||||||
-renamesourcefileattribute P
|
-renamesourcefileattribute P
|
||||||
-keepattributes SourceFile,LineNumberTable
|
-keepattributes SourceFile,LineNumberTable
|
||||||
|
|
||||||
-keep public class * extends android.app.Activity
|
|
||||||
-keep public class * extends android.app.Application
|
|
||||||
-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
|
|
||||||
|
|
||||||
-assumenosideeffects class kotlin.jvm.internal.Intrinsics {
|
-assumenosideeffects class kotlin.jvm.internal.Intrinsics {
|
||||||
public static *** throwUninitializedProperty(...);
|
public static *** throwUninitializedProperty(...);
|
||||||
public static *** throwUninitializedPropertyAccessException(...);
|
public static *** throwUninitializedPropertyAccessException(...);
|
||||||
|
@@ -19,31 +19,15 @@
|
|||||||
*
|
*
|
||||||
* 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() {
|
||||||
|
|
||||||
companion object {
|
|
||||||
|
|
||||||
/** 全局静态实例 */
|
|
||||||
private var context: TSApplication? = null
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 调用全局静态实例
|
|
||||||
* @return [TSApplication]
|
|
||||||
*/
|
|
||||||
val appContext get() = context ?: error("App is death")
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onCreate() {
|
override fun onCreate() {
|
||||||
super.onCreate()
|
super.onCreate()
|
||||||
/** 设置静态实例 */
|
|
||||||
context = this
|
|
||||||
/** 跟随系统夜间模式 */
|
/** 跟随系统夜间模式 */
|
||||||
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM)
|
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM)
|
||||||
}
|
}
|
||||||
|
@@ -32,6 +32,7 @@ import android.view.View
|
|||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.view.ViewGroup.LayoutParams.MATCH_PARENT
|
import android.view.ViewGroup.LayoutParams.MATCH_PARENT
|
||||||
import android.view.ViewGroup.LayoutParams.WRAP_CONTENT
|
import android.view.ViewGroup.LayoutParams.WRAP_CONTENT
|
||||||
|
import android.view.ViewGroup.MarginLayoutParams
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import com.fankes.tsbattery.BuildConfig
|
import com.fankes.tsbattery.BuildConfig
|
||||||
import com.fankes.tsbattery.data.DataConst
|
import com.fankes.tsbattery.data.DataConst
|
||||||
@@ -39,6 +40,7 @@ import com.fankes.tsbattery.hook.HookConst.QQ_PACKAGE_NAME
|
|||||||
import com.fankes.tsbattery.hook.HookConst.TIM_PACKAGE_NAME
|
import com.fankes.tsbattery.hook.HookConst.TIM_PACKAGE_NAME
|
||||||
import com.fankes.tsbattery.hook.HookConst.WECHAT_PACKAGE_NAME
|
import com.fankes.tsbattery.hook.HookConst.WECHAT_PACKAGE_NAME
|
||||||
import com.fankes.tsbattery.ui.activity.MainActivity
|
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.showDialog
|
||||||
import com.fankes.tsbattery.utils.factory.versionCode
|
import com.fankes.tsbattery.utils.factory.versionCode
|
||||||
import com.fankes.tsbattery.utils.factory.versionName
|
import com.fankes.tsbattery.utils.factory.versionName
|
||||||
@@ -50,10 +52,10 @@ import com.highcapable.yukihookapi.hook.log.loggerE
|
|||||||
import com.highcapable.yukihookapi.hook.param.PackageParam
|
import com.highcapable.yukihookapi.hook.param.PackageParam
|
||||||
import com.highcapable.yukihookapi.hook.type.android.*
|
import com.highcapable.yukihookapi.hook.type.android.*
|
||||||
import com.highcapable.yukihookapi.hook.type.java.*
|
import com.highcapable.yukihookapi.hook.type.java.*
|
||||||
import com.highcapable.yukihookapi.hook.xposed.proxy.YukiHookXposedInitProxy
|
import com.highcapable.yukihookapi.hook.xposed.proxy.IYukiHookXposedInit
|
||||||
|
|
||||||
@InjectYukiHookWithXposed
|
@InjectYukiHookWithXposed
|
||||||
class HookEntry : YukiHookXposedInitProxy {
|
class HookEntry : IYukiHookXposedInit {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
@@ -128,7 +130,7 @@ class HookEntry : YukiHookXposedInitProxy {
|
|||||||
interceptBaseChatPie(methodName = "bk")
|
interceptBaseChatPie(methodName = "bk")
|
||||||
interceptBaseChatPie(methodName = "bl")
|
interceptBaseChatPie(methodName = "bl")
|
||||||
}
|
}
|
||||||
"8.8.83", "8.8.85" -> {
|
"8.8.83", "8.8.85", "8.8.88" -> {
|
||||||
interceptBaseChatPie(methodName = "bl")
|
interceptBaseChatPie(methodName = "bl")
|
||||||
interceptBaseChatPie(methodName = "bm")
|
interceptBaseChatPie(methodName = "bm")
|
||||||
}
|
}
|
||||||
@@ -173,11 +175,11 @@ class HookEntry : YukiHookXposedInitProxy {
|
|||||||
}
|
}
|
||||||
beforeHook {
|
beforeHook {
|
||||||
if (prefs.get(DataConst.ENABLE_NOTIFY_TIP))
|
if (prefs.get(DataConst.ENABLE_NOTIFY_TIP))
|
||||||
when (firstArgs<CharSequence>()) {
|
when (args().first().cast<CharSequence>()) {
|
||||||
"QQ正在后台运行" ->
|
"QQ正在后台运行" ->
|
||||||
args().set("QQ正在后台运行 - TSBattery 守护中")
|
args().first().set("QQ正在后台运行 - TSBattery 守护中")
|
||||||
"TIM正在后台运行" ->
|
"TIM正在后台运行" ->
|
||||||
args().set("TIM正在后台运行 - TSBattery 守护中")
|
args().first().set("TIM正在后台运行 - TSBattery 守护中")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -267,21 +269,21 @@ class HookEntry : YukiHookXposedInitProxy {
|
|||||||
injectMember {
|
injectMember {
|
||||||
method { name = "startTempService" }
|
method { name = "startTempService" }
|
||||||
intercept()
|
intercept()
|
||||||
}
|
}.ignoredNoSuchMemberFailure()
|
||||||
injectMember {
|
injectMember {
|
||||||
method {
|
method {
|
||||||
name = "startCoreService"
|
name = "startCoreService"
|
||||||
param(BooleanType)
|
param(BooleanType)
|
||||||
}
|
}
|
||||||
intercept()
|
intercept()
|
||||||
}
|
}.ignoredNoSuchMemberFailure()
|
||||||
injectMember {
|
injectMember {
|
||||||
method {
|
method {
|
||||||
name = "onStartCommand"
|
name = "onStartCommand"
|
||||||
param(IntentClass, IntType, IntType)
|
param(IntentClass, IntType, IntType)
|
||||||
}
|
}
|
||||||
replaceTo(any = 2)
|
replaceTo(any = 2)
|
||||||
}
|
}.ignoredNoSuchMemberFailure()
|
||||||
}
|
}
|
||||||
injectMember {
|
injectMember {
|
||||||
method { name = "onCreate" }
|
method { name = "onCreate" }
|
||||||
@@ -313,7 +315,7 @@ class HookEntry : YukiHookXposedInitProxy {
|
|||||||
param(IntentClass, IntType, IntType)
|
param(IntentClass, IntType, IntType)
|
||||||
}
|
}
|
||||||
replaceTo(any = 2)
|
replaceTo(any = 2)
|
||||||
}
|
}.ignoredNoSuchMemberFailure()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -330,48 +332,28 @@ class HookEntry : YukiHookXposedInitProxy {
|
|||||||
afterHook {
|
afterHook {
|
||||||
/** 是否启用 Hook */
|
/** 是否启用 Hook */
|
||||||
if (prefs.get(DataConst.ENABLE_SETTING_TIP).not()) return@afterHook
|
if (prefs.get(DataConst.ENABLE_SETTING_TIP).not()) return@afterHook
|
||||||
|
|
||||||
/** 当前的顶级 Item 实例 */
|
/** 当前的顶级 Item 实例 */
|
||||||
var formItemRefRoot: View? = null
|
val formItemRefRoot = field {
|
||||||
|
type(FormSimpleItemClass).index(num = 1)
|
||||||
/**
|
}.ignoredError().get(instance).cast() ?: field {
|
||||||
* 使用循环筛选
|
type(FormCommonSingleLineItemClass).index(num = 1)
|
||||||
* @param target 目标变量名称
|
}.ignoredError().get(instance).cast<View?>()
|
||||||
* @return [View] or null
|
|
||||||
*/
|
|
||||||
fun match(target: String) = runCatching {
|
|
||||||
field {
|
|
||||||
name = target
|
|
||||||
type = FormSimpleItemClass.clazz
|
|
||||||
}.ignoredError().get(instance).cast() ?: field {
|
|
||||||
name = target
|
|
||||||
type = FormCommonSingleLineItemClass.clazz
|
|
||||||
}.ignoredError().get(instance).cast<View?>()
|
|
||||||
}.getOrNull()
|
|
||||||
/** 循环出当前设置界面存在的顶级 Item */
|
|
||||||
arrayOf(
|
|
||||||
"a", "b", "c", "d", "e", "f", "g",
|
|
||||||
"h", "i", "j", "k", "l", "m", "n",
|
|
||||||
"o", "p", "q", "r", "s", "t", "u",
|
|
||||||
"v", "w", "x", "y", "z", "A", "B"
|
|
||||||
).forEach { match(it)?.also { e -> formItemRefRoot = e } }
|
|
||||||
/** 创建一个新的 Item */
|
/** 创建一个新的 Item */
|
||||||
FormSimpleItemClass.clazz.constructor { param(ContextClass) }.get().newInstance<View>(instance)?.also {
|
FormSimpleItemClass.clazz.buildOf<View>(instance) { param(ContextClass) }?.current {
|
||||||
it.javaClass.apply {
|
method {
|
||||||
method {
|
name = "setLeftText"
|
||||||
name = "setLeftText"
|
param(CharSequenceType)
|
||||||
param(CharSequenceType)
|
}.call("TSBattery")
|
||||||
}.get(it).call("TSBattery")
|
method {
|
||||||
method {
|
name = "setRightText"
|
||||||
name = "setRightText"
|
param(CharSequenceType)
|
||||||
param(CharSequenceType)
|
}.call(prefs.get(DataConst.ENABLE_MODULE_VERSION))
|
||||||
}.get(it).call(prefs.get(DataConst.ENABLE_MODULE_VERSION))
|
method {
|
||||||
method {
|
name = "setBgType"
|
||||||
name = "setBgType"
|
param(IntType)
|
||||||
param(IntType)
|
}.call(if (isQQ) 0 else 2)
|
||||||
}.get(it).call(2)
|
}?.apply {
|
||||||
}
|
setOnClickListener {
|
||||||
it.setOnClickListener {
|
|
||||||
instance<Activity>().apply {
|
instance<Activity>().apply {
|
||||||
showDialog {
|
showDialog {
|
||||||
title = "TSBattery 守护中"
|
title = "TSBattery 守护中"
|
||||||
@@ -398,14 +380,16 @@ class HookEntry : YukiHookXposedInitProxy {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.apply {
|
}?.also { item ->
|
||||||
var listGroup = formItemRefRoot?.parent as? ViewGroup?
|
var listGroup = formItemRefRoot?.parent as? ViewGroup?
|
||||||
val lparam = (if (listGroup?.childCount == 1) {
|
val lparam = (if (listGroup?.childCount == 1) {
|
||||||
listGroup = listGroup.parent as? ViewGroup
|
listGroup = listGroup.parent as? ViewGroup
|
||||||
(formItemRefRoot?.parent as? View?)?.layoutParams
|
(formItemRefRoot?.parent as? View?)?.layoutParams
|
||||||
} else formItemRefRoot?.layoutParams) ?: ViewGroup.LayoutParams(MATCH_PARENT, WRAP_CONTENT)
|
} else formItemRefRoot?.layoutParams) ?: ViewGroup.LayoutParams(MATCH_PARENT, WRAP_CONTENT)
|
||||||
|
/** 设置圆角和间距 */
|
||||||
|
if (isQQ) (lparam as? MarginLayoutParams?)?.setMargins(0, 15.dp(item.context), 0, 0)
|
||||||
/** 将 Item 添加到设置界面 */
|
/** 将 Item 添加到设置界面 */
|
||||||
listGroup?.also { if (isQQ) it.addView(this, lparam) else it.addView(this, 0, lparam) }
|
listGroup?.also { if (isQQ) it.addView(item, lparam) else it.addView(item, 0, lparam) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -518,21 +502,21 @@ class HookEntry : YukiHookXposedInitProxy {
|
|||||||
injectMember {
|
injectMember {
|
||||||
method {
|
method {
|
||||||
name = "doReport"
|
name = "doReport"
|
||||||
param(("com.tencent.qapmsdk.qqbattery.monitor.WakeLockMonitor\$WakeLockEntity").clazz, IntType)
|
param("com.tencent.qapmsdk.qqbattery.monitor.WakeLockMonitor\$WakeLockEntity", IntType)
|
||||||
}
|
}
|
||||||
intercept()
|
intercept()
|
||||||
}
|
}
|
||||||
injectMember {
|
injectMember {
|
||||||
method {
|
method {
|
||||||
name = "afterHookedMethod"
|
name = "afterHookedMethod"
|
||||||
param(("com.tencent.qapmsdk.qqbattery.monitor.MethodHookParam").clazz)
|
param("com.tencent.qapmsdk.qqbattery.monitor.MethodHookParam")
|
||||||
}
|
}
|
||||||
intercept()
|
intercept()
|
||||||
}
|
}
|
||||||
injectMember {
|
injectMember {
|
||||||
method {
|
method {
|
||||||
name = "beforeHookedMethod"
|
name = "beforeHookedMethod"
|
||||||
param(("com.tencent.qapmsdk.qqbattery.monitor.MethodHookParam").clazz)
|
param("com.tencent.qapmsdk.qqbattery.monitor.MethodHookParam")
|
||||||
}
|
}
|
||||||
intercept()
|
intercept()
|
||||||
}
|
}
|
||||||
@@ -566,6 +550,7 @@ class HookEntry : YukiHookXposedInitProxy {
|
|||||||
/**
|
/**
|
||||||
* 这个是毒瘤核心操作类
|
* 这个是毒瘤核心操作类
|
||||||
* 功能同上、全部拦截
|
* 功能同上、全部拦截
|
||||||
|
* 👮🏻 经过排查 Play 版本也没这个类...... Emmmm 不想说啥了
|
||||||
*/
|
*/
|
||||||
findClass(name = "com.tencent.qapmsdk.qqbattery.QQBatteryMonitor").hook {
|
findClass(name = "com.tencent.qapmsdk.qqbattery.QQBatteryMonitor").hook {
|
||||||
injectMember {
|
injectMember {
|
||||||
|
@@ -48,7 +48,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
|||||||
|
|
||||||
private const val moduleVersion = BuildConfig.VERSION_NAME
|
private const val moduleVersion = BuildConfig.VERSION_NAME
|
||||||
private const val qqSupportVersion =
|
private const val qqSupportVersion =
|
||||||
"8.2.11(Play)、8.8.17、8.8.23、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.2.11、8.5.5~8.8.85)"
|
"8.2.11(Play)、8.8.17、8.8.23、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.2.11、8.5.5~8.8.88)"
|
||||||
private const val timSupportVersion = "2+、3+ (并未完全测试每个版本)"
|
private const val timSupportVersion = "2+、3+ (并未完全测试每个版本)"
|
||||||
private const val wechatSupportVersion = "全版本仅支持基础省电,更多功能依然画饼"
|
private const val wechatSupportVersion = "全版本仅支持基础省电,更多功能依然画饼"
|
||||||
|
|
||||||
|
@@ -37,7 +37,7 @@ import android.widget.TextView
|
|||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.viewbinding.ViewBinding
|
import androidx.viewbinding.ViewBinding
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||||
import com.highcapable.yukihookapi.annotation.DoNotUseField
|
import com.highcapable.yukihookapi.annotation.CauseProblemsApi
|
||||||
import com.highcapable.yukihookapi.hook.factory.method
|
import com.highcapable.yukihookapi.hook.factory.method
|
||||||
import com.highcapable.yukihookapi.hook.type.android.LayoutInflaterClass
|
import com.highcapable.yukihookapi.hook.type.android.LayoutInflaterClass
|
||||||
|
|
||||||
@@ -61,7 +61,7 @@ class DialogBuilder(val context: Context, private val isUseBlackTheme: Boolean)
|
|||||||
|
|
||||||
private var dialogInstance: Dialog? = null // 对话框实例
|
private var dialogInstance: Dialog? = null // 对话框实例
|
||||||
|
|
||||||
@DoNotUseField
|
@CauseProblemsApi
|
||||||
var customLayoutView: View? = null // 自定义布局
|
var customLayoutView: View? = null // 自定义布局
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -35,8 +35,8 @@ import android.net.Uri
|
|||||||
import android.provider.Settings
|
import android.provider.Settings
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import androidx.core.content.getSystemService
|
import androidx.core.content.getSystemService
|
||||||
import com.fankes.tsbattery.application.TSApplication.Companion.appContext
|
|
||||||
import com.google.android.material.snackbar.Snackbar
|
import com.google.android.material.snackbar.Snackbar
|
||||||
|
import com.highcapable.yukihookapi.hook.xposed.application.ModuleApplication.Companion.appContext
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 系统深色模式是否开启
|
* 系统深色模式是否开启
|
||||||
|
11
build.gradle
11
build.gradle
@@ -1,12 +1,13 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id 'com.android.application' version '7.1.2' apply false
|
id 'com.android.application' version '7.1.3' apply false
|
||||||
id 'com.android.library' version '7.1.2' apply false
|
id 'com.android.library' version '7.1.3' apply false
|
||||||
id 'org.jetbrains.kotlin.android' version '1.6.10' apply false
|
id 'org.jetbrains.kotlin.android' version '1.6.20' apply false
|
||||||
}
|
}
|
||||||
|
|
||||||
ext {
|
ext {
|
||||||
appVersionName = "3.6"
|
appVersionName = "3.8"
|
||||||
appVersionCode = 14
|
appVersionCode = 16
|
||||||
|
enableR8 = true
|
||||||
}
|
}
|
||||||
|
|
||||||
task clean(type: Delete) {
|
task clean(type: Delete) {
|
||||||
|
Reference in New Issue
Block a user