mirror of
https://github.com/LittleTurtle2333/SimplicityTools.git
synced 2026-07-12 19:31:17 +08:00
Merge pull request #169
* 修复 隐藏网速单位 & 随便精简了下代码 * Update SettingsActivity.kt
This commit is contained in:
@@ -319,10 +319,6 @@ class SettingsActivity : MIUIActivity() {
|
||||
dataBindingSend = customMobileTypeTextBinding.bindingSend
|
||||
)
|
||||
)
|
||||
TextWithSwitch(
|
||||
TextV(resId = R.string.show_wifi_standard),
|
||||
SwitchV("show_wifi_standard")
|
||||
)
|
||||
TextSummaryArrow(
|
||||
TextSummaryV(
|
||||
textId = R.string.custom_mobile_type_text
|
||||
@@ -366,6 +362,10 @@ class SettingsActivity : MIUIActivity() {
|
||||
2 -> view.visibility = if (data as Boolean) View.VISIBLE else View.GONE
|
||||
}
|
||||
}
|
||||
TextWithSwitch(
|
||||
TextV(resId = R.string.show_wifi_standard),
|
||||
SwitchV("show_wifi_standard")
|
||||
)
|
||||
TextSummaryWithSwitch(
|
||||
TextSummaryV(
|
||||
textId = R.string.big_mobile_type_icon
|
||||
|
||||
@@ -3,16 +3,12 @@ package com.lt2333.simplicitytools.hook.app
|
||||
import com.lt2333.simplicitytools.hook.app.android.*
|
||||
import com.lt2333.simplicitytools.hook.app.android.corepatch.CorePatch
|
||||
import com.lt2333.simplicitytools.util.xposed.base.AppRegister
|
||||
import de.robv.android.xposed.XposedBridge
|
||||
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
||||
|
||||
object Android : AppRegister() {
|
||||
override val packageName: String = "android"
|
||||
override val processName: List<String> = emptyList()
|
||||
override val logTag: String = "WooBox"
|
||||
|
||||
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
|
||||
XposedBridge.log("WooBox: 成功 Hook " + javaClass.simpleName)
|
||||
//核心破解
|
||||
CorePatch().handleLoadPackage(lpparam)
|
||||
|
||||
|
||||
@@ -2,16 +2,12 @@ package com.lt2333.simplicitytools.hook.app
|
||||
|
||||
import com.lt2333.simplicitytools.hook.app.cast.ForceSupportSendApp
|
||||
import com.lt2333.simplicitytools.util.xposed.base.AppRegister
|
||||
import de.robv.android.xposed.XposedBridge
|
||||
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
||||
|
||||
object Cast: AppRegister() {
|
||||
override val packageName: String = "com.milink.service"
|
||||
override val processName: List<String> = emptyList()
|
||||
override val logTag: String = "WooBox"
|
||||
|
||||
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
|
||||
XposedBridge.log("WooBox: 成功 Hook "+javaClass.simpleName)
|
||||
autoInitHooks(lpparam,
|
||||
ForceSupportSendApp, //强制允许所有应用接力
|
||||
)
|
||||
|
||||
@@ -2,16 +2,12 @@ package com.lt2333.simplicitytools.hook.app
|
||||
|
||||
import com.lt2333.simplicitytools.hook.app.mediaeditor.UnlockUnlimitedCropping
|
||||
import com.lt2333.simplicitytools.util.xposed.base.AppRegister
|
||||
import de.robv.android.xposed.XposedBridge
|
||||
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
||||
|
||||
object MediaEditor: AppRegister() {
|
||||
override val packageName: String = "com.miui.mediaeditor"
|
||||
override val processName: List<String> = emptyList()
|
||||
override val logTag: String = "WooBox"
|
||||
|
||||
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
|
||||
XposedBridge.log("WooBox: 成功 Hook "+javaClass.simpleName)
|
||||
autoInitHooks(lpparam,
|
||||
UnlockUnlimitedCropping, //解锁裁切最小值
|
||||
)
|
||||
|
||||
@@ -3,16 +3,12 @@ package com.lt2333.simplicitytools.hook.app
|
||||
import com.lt2333.simplicitytools.hook.app.miuihome.AlwaysDisplayTime
|
||||
import com.lt2333.simplicitytools.hook.app.miuihome.DoubleTapToSleep
|
||||
import com.lt2333.simplicitytools.util.xposed.base.AppRegister
|
||||
import de.robv.android.xposed.XposedBridge
|
||||
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
||||
|
||||
object MiuiHome: AppRegister() {
|
||||
override val packageName: String = "com.miui.home"
|
||||
override val processName: List<String> = emptyList()
|
||||
override val logTag: String = "WooBox"
|
||||
|
||||
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
|
||||
XposedBridge.log("WooBox: 成功 Hook "+javaClass.simpleName)
|
||||
autoInitHooks(lpparam,
|
||||
AlwaysDisplayTime, //时钟显示时钟
|
||||
DoubleTapToSleep, //双击锁屏
|
||||
|
||||
@@ -3,16 +3,12 @@ package com.lt2333.simplicitytools.hook.app
|
||||
import com.lt2333.simplicitytools.hook.app.powerkeeper.LockMaxFps
|
||||
import com.lt2333.simplicitytools.hook.app.powerkeeper.PreventRecoveryOfBatteryOptimizationWhitelist
|
||||
import com.lt2333.simplicitytools.util.xposed.base.AppRegister
|
||||
import de.robv.android.xposed.XposedBridge
|
||||
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
||||
|
||||
object PowerKeeper: AppRegister() {
|
||||
override val packageName: String = "com.miui.powerkeeper"
|
||||
override val processName: List<String> = emptyList()
|
||||
override val logTag: String = "WooBox"
|
||||
|
||||
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
|
||||
XposedBridge.log("WooBox: 成功 Hook "+javaClass.simpleName)
|
||||
autoInitHooks(lpparam,
|
||||
LockMaxFps, //锁定最高刷新率
|
||||
PreventRecoveryOfBatteryOptimizationWhitelist, //防止恢复电池优化白名单
|
||||
|
||||
@@ -1,17 +1,13 @@
|
||||
package com.lt2333.simplicitytools.hook.app
|
||||
|
||||
import com.lt2333.simplicitytools.hook.app.cast.RearDisplayWeather
|
||||
import com.lt2333.simplicitytools.hook.app.reardisplay.RearDisplayWeather
|
||||
import com.lt2333.simplicitytools.util.xposed.base.AppRegister
|
||||
import de.robv.android.xposed.XposedBridge
|
||||
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
||||
|
||||
object RearDisplay: AppRegister() {
|
||||
override val packageName: String = "com.xiaomi.misubscreenui"
|
||||
override val processName: List<String> = emptyList()
|
||||
override val logTag: String = "WooBox"
|
||||
|
||||
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
|
||||
XposedBridge.log("WooBox: 成功 Hook "+javaClass.simpleName)
|
||||
autoInitHooks(lpparam,
|
||||
RearDisplayWeather, //背屏显示天气
|
||||
)
|
||||
|
||||
@@ -2,16 +2,12 @@ package com.lt2333.simplicitytools.hook.app
|
||||
|
||||
import com.lt2333.simplicitytools.hook.app.screenshot.UnlockUnlimitedCropping
|
||||
import com.lt2333.simplicitytools.util.xposed.base.AppRegister
|
||||
import de.robv.android.xposed.XposedBridge
|
||||
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
||||
|
||||
object ScreenShot: AppRegister() {
|
||||
override val packageName: String = "com.miui.screenshot"
|
||||
override val processName: List<String> = emptyList()
|
||||
override val logTag: String = "WooBox"
|
||||
|
||||
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
|
||||
XposedBridge.log("WooBox: 成功 Hook " + javaClass.simpleName)
|
||||
autoInitHooks(lpparam,
|
||||
UnlockUnlimitedCropping, //锁定最高刷新率
|
||||
)
|
||||
|
||||
@@ -2,16 +2,12 @@ package com.lt2333.simplicitytools.hook.app
|
||||
|
||||
import com.lt2333.simplicitytools.hook.app.securitycenter.*
|
||||
import com.lt2333.simplicitytools.util.xposed.base.AppRegister
|
||||
import de.robv.android.xposed.XposedBridge
|
||||
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
||||
|
||||
object SecurityCenter: AppRegister() {
|
||||
override val packageName: String = "com.miui.securitycenter"
|
||||
override val processName: List<String> = emptyList()
|
||||
override val logTag: String = "WooBox"
|
||||
|
||||
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
|
||||
XposedBridge.log("WooBox: 成功 Hook " + javaClass.simpleName)
|
||||
autoInitHooks(lpparam,
|
||||
SkipWaitingTime, //跳过 5/10秒等待时间
|
||||
LockOneHundred, //锁定 100分
|
||||
|
||||
@@ -2,16 +2,12 @@ package com.lt2333.simplicitytools.hook.app
|
||||
|
||||
import com.lt2333.simplicitytools.hook.app.settings.ShowNotificationImportance
|
||||
import com.lt2333.simplicitytools.util.xposed.base.AppRegister
|
||||
import de.robv.android.xposed.XposedBridge
|
||||
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
||||
|
||||
object Settings: AppRegister() {
|
||||
override val packageName: String = "com.android.settings"
|
||||
override val processName: List<String> = emptyList()
|
||||
override val logTag: String = "WooBox"
|
||||
|
||||
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
|
||||
XposedBridge.log("WooBox: 成功 Hook "+javaClass.simpleName)
|
||||
autoInitHooks(lpparam,
|
||||
ShowNotificationImportance, //显示通知重要程度
|
||||
)
|
||||
|
||||
@@ -2,16 +2,12 @@ package com.lt2333.simplicitytools.hook.app
|
||||
|
||||
import com.lt2333.simplicitytools.hook.app.systemui.*
|
||||
import com.lt2333.simplicitytools.util.xposed.base.AppRegister
|
||||
import de.robv.android.xposed.XposedBridge
|
||||
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
||||
|
||||
object SystemUI: AppRegister() {
|
||||
override val packageName: String = "com.android.systemui"
|
||||
override val processName: List<String> = emptyList()
|
||||
override val logTag: String = "WooBox"
|
||||
|
||||
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
|
||||
XposedBridge.log("WooBox: 成功 Hook "+javaClass.simpleName)
|
||||
autoInitHooks(lpparam,
|
||||
HideStatusBarIcon, //隐藏状态栏图标
|
||||
HideBatteryIcon, //隐藏电池
|
||||
|
||||
@@ -2,16 +2,12 @@ package com.lt2333.simplicitytools.hook.app
|
||||
|
||||
import com.lt2333.simplicitytools.hook.app.thememanager.RemoveAds
|
||||
import com.lt2333.simplicitytools.util.xposed.base.AppRegister
|
||||
import de.robv.android.xposed.XposedBridge
|
||||
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
||||
|
||||
object ThemeManager: AppRegister() {
|
||||
override val packageName: String = "com.android.thememanager"
|
||||
override val processName: List<String> = emptyList()
|
||||
override val logTag: String = "WooBox"
|
||||
|
||||
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
|
||||
XposedBridge.log("WooBox: 成功 Hook "+javaClass.simpleName)
|
||||
autoInitHooks(lpparam,
|
||||
RemoveAds, //移除主题壁纸的广告
|
||||
)
|
||||
|
||||
@@ -5,16 +5,12 @@ import com.github.kyuubiran.ezxhelper.utils.hookReturnConstant
|
||||
import com.github.kyuubiran.ezxhelper.utils.loadClassOrNull
|
||||
import com.lt2333.simplicitytools.util.hasEnable
|
||||
import com.lt2333.simplicitytools.util.xposed.base.AppRegister
|
||||
import de.robv.android.xposed.XposedBridge
|
||||
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
||||
|
||||
object Updater : AppRegister() {
|
||||
override val packageName: String = "com.android.updater"
|
||||
override val processName: List<String> = emptyList()
|
||||
override val logTag: String = "WooBox"
|
||||
|
||||
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
|
||||
XposedBridge.log("WooBox: 成功 Hook " + javaClass.simpleName)
|
||||
|
||||
hasEnable("remove_ota_validate") {
|
||||
Array(26) { "com.android.updater.common.utils.${'a' + it}" }
|
||||
|
||||
@@ -12,4 +12,5 @@ object AllowUntrustedTouches : HookRegister() {
|
||||
name == "getBlockUntrustedTouchesMode" && parameterTypes[0] == Context::class.java
|
||||
}.hookReturnConstant(0)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -15,4 +15,5 @@ object DeleteOnPostNotification : HookRegister() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -15,4 +15,5 @@ object DisableFlagSecure : HookRegister() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -15,4 +15,5 @@ object MaxWallpaperScale : HookRegister() {
|
||||
it.thisObject.putObject("mMaxWallpaperScale", value)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -42,4 +42,5 @@ object RemoveSmallWindowRestrictions : HookRegister() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -18,4 +18,5 @@ object SystemPropertiesHook : HookRegister() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,20 +1,20 @@
|
||||
package com.lt2333.simplicitytools.hook.app.cast
|
||||
|
||||
import com.github.kyuubiran.ezxhelper.utils.findMethod
|
||||
import com.github.kyuubiran.ezxhelper.utils.hookMethod
|
||||
import com.github.kyuubiran.ezxhelper.utils.hookAfter
|
||||
import com.lt2333.simplicitytools.util.hasEnable
|
||||
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||
|
||||
object ForceSupportSendApp : HookRegister() {
|
||||
|
||||
override fun init() {
|
||||
hasEnable("force_support_send_app") {
|
||||
findMethod("com.xiaomi.mirror.synergy.MiuiSynergySdk") {
|
||||
name == "isSupportSendApp"
|
||||
}.hookMethod {
|
||||
after { param ->
|
||||
param.result = true
|
||||
}
|
||||
}.hookAfter {
|
||||
it.result = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,44 +1,29 @@
|
||||
package com.lt2333.simplicitytools.hook.app.mediaeditor
|
||||
|
||||
import com.lt2333.simplicitytools.util.XSPUtils
|
||||
import com.github.kyuubiran.ezxhelper.utils.findMethod
|
||||
import com.github.kyuubiran.ezxhelper.utils.hookBefore
|
||||
import com.lt2333.simplicitytools.util.hasEnable
|
||||
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||
import de.robv.android.xposed.XC_MethodHook
|
||||
import de.robv.android.xposed.XposedHelpers
|
||||
|
||||
object UnlockUnlimitedCropping : HookRegister() {
|
||||
|
||||
override fun init() {
|
||||
//解锁图库裁切最小值
|
||||
val classIfExists = XposedHelpers.findClassIfExists(
|
||||
"com.miui.gallery.editor.photo.core.imports.obsoletes.Crop\$ResizeDetector",
|
||||
getDefaultClassLoader()
|
||||
)
|
||||
XposedHelpers.findAndHookMethod(
|
||||
classIfExists,
|
||||
"calculateMinSize",
|
||||
object : XC_MethodHook() {
|
||||
override fun beforeHookedMethod(param: MethodHookParam) {
|
||||
if (XSPUtils.getBoolean("unlock_unlimited_cropping",false)) {
|
||||
param.result = 0
|
||||
findMethod("com.miui.gallery.editor.photo.core.imports.obsoletes.Crop\$ResizeDetector") {
|
||||
name == "calculateMinSize"
|
||||
}.hookBefore {
|
||||
hasEnable("unlock_unlimited_cropping") {
|
||||
it.result = 0
|
||||
}
|
||||
}
|
||||
})
|
||||
//截图无限裁切
|
||||
val classIfExists2 = XposedHelpers.findClassIfExists(
|
||||
"com.miui.gallery.editor.photo.screen.crop.ScreenCropView\$ResizeDetector",
|
||||
getDefaultClassLoader()
|
||||
)
|
||||
|
||||
XposedHelpers.findAndHookMethod(
|
||||
classIfExists2,
|
||||
"calculateMinSize",
|
||||
object : XC_MethodHook() {
|
||||
override fun beforeHookedMethod(param: MethodHookParam) {
|
||||
if (XSPUtils.getBoolean("unlock_unlimited_cropping",false)) {
|
||||
param.result = 0
|
||||
findMethod("com.miui.gallery.editor.photo.screen.crop.ScreenCropView\$ResizeDetector") {
|
||||
name == "calculateMinSize"
|
||||
}.hookBefore {
|
||||
hasEnable("unlock_unlimited_cropping") {
|
||||
it.result = 0
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,27 +1,20 @@
|
||||
package com.lt2333.simplicitytools.hook.app.miuihome
|
||||
|
||||
import com.lt2333.simplicitytools.util.XSPUtils
|
||||
import com.github.kyuubiran.ezxhelper.utils.findMethod
|
||||
import com.github.kyuubiran.ezxhelper.utils.hookBefore
|
||||
import com.lt2333.simplicitytools.util.hasEnable
|
||||
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||
import de.robv.android.xposed.XC_MethodHook
|
||||
import de.robv.android.xposed.XposedHelpers
|
||||
|
||||
object AlwaysDisplayTime : HookRegister() {
|
||||
|
||||
override fun init() {
|
||||
val classIfExists = XposedHelpers.findClassIfExists(
|
||||
"com.miui.home.launcher.Workspace",
|
||||
getDefaultClassLoader()
|
||||
)
|
||||
XposedHelpers.findAndHookMethod(
|
||||
classIfExists,
|
||||
"isScreenHasClockGadget", Long::class.javaPrimitiveType,
|
||||
object : XC_MethodHook() {
|
||||
override fun beforeHookedMethod(param: MethodHookParam) {
|
||||
if (XSPUtils.getBoolean("home_time", false)) {
|
||||
param.result = false
|
||||
findMethod("com.miui.home.launcher.Workspace") {
|
||||
name == "isScreenHasClockGadget" && parameterCount == 1
|
||||
}.hookBefore {
|
||||
hasEnable("home_time") {
|
||||
it.result = false
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.yuk.miuihome.module
|
||||
package com.lt2333.simplicitytools.hook.app.miuihome
|
||||
|
||||
import android.content.Context
|
||||
import android.os.SystemClock
|
||||
@@ -48,4 +48,5 @@ class DoubleTapController internal constructor(mContext: Context) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,19 +4,16 @@ import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.view.MotionEvent
|
||||
import com.github.kyuubiran.ezxhelper.utils.*
|
||||
import com.lt2333.simplicitytools.util.*
|
||||
import com.lt2333.simplicitytools.util.hasEnable
|
||||
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||
import com.yuk.miuihome.module.DoubleTapController
|
||||
import de.robv.android.xposed.XposedHelpers
|
||||
|
||||
object DoubleTapToSleep : HookRegister() {
|
||||
|
||||
override fun init() = hasEnable("double_tap_to_sleep") {
|
||||
hookAllConstructorAfter("com.miui.home.launcher.Workspace") {
|
||||
var mDoubleTapControllerEx =
|
||||
XposedHelpers.getAdditionalInstanceField(
|
||||
it.thisObject,
|
||||
"mDoubleTapControllerEx"
|
||||
)
|
||||
XposedHelpers.getAdditionalInstanceField(it.thisObject, "mDoubleTapControllerEx")
|
||||
if (mDoubleTapControllerEx != null) return@hookAllConstructorAfter
|
||||
mDoubleTapControllerEx = DoubleTapController((it.args[0] as Context))
|
||||
XposedHelpers.setAdditionalInstanceField(
|
||||
@@ -25,7 +22,6 @@ object DoubleTapToSleep : HookRegister() {
|
||||
mDoubleTapControllerEx
|
||||
)
|
||||
}
|
||||
|
||||
findMethod("com.miui.home.launcher.Workspace") {
|
||||
name == "dispatchTouchEvent" && parameterTypes[0] == MotionEvent::class.java
|
||||
}.hookBefore {
|
||||
@@ -47,4 +43,5 @@ object DoubleTapToSleep : HookRegister() {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,29 +1,20 @@
|
||||
package com.lt2333.simplicitytools.hook.app.powerkeeper
|
||||
|
||||
import com.lt2333.simplicitytools.util.XSPUtils
|
||||
import com.github.kyuubiran.ezxhelper.utils.findMethod
|
||||
import com.github.kyuubiran.ezxhelper.utils.hookBefore
|
||||
import com.lt2333.simplicitytools.util.hasEnable
|
||||
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||
import de.robv.android.xposed.XC_MethodHook
|
||||
import de.robv.android.xposed.XposedHelpers
|
||||
|
||||
object LockMaxFps : HookRegister() {
|
||||
|
||||
override fun init() {
|
||||
val classIfExists = XposedHelpers.findClassIfExists(
|
||||
"com.miui.powerkeeper.statemachine.DisplayFrameSetting",
|
||||
getDefaultClassLoader()
|
||||
)
|
||||
XposedHelpers.findAndHookMethod(
|
||||
classIfExists,
|
||||
"setScreenEffect",
|
||||
String::class.java, Int::class.javaPrimitiveType, Int::class.javaPrimitiveType,
|
||||
object : XC_MethodHook() {
|
||||
override fun beforeHookedMethod(param: MethodHookParam) {
|
||||
super.beforeHookedMethod(param)
|
||||
if (XSPUtils.getBoolean("lock_max_fps", false)) {
|
||||
param.result = null
|
||||
findMethod("com.miui.powerkeeper.statemachine.DisplayFrameSetting") {
|
||||
name == "setScreenEffect" && parameterCount == 3
|
||||
}.hookBefore {
|
||||
hasEnable("lock_max_fps") {
|
||||
it.result = null
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,32 +1,22 @@
|
||||
package com.lt2333.simplicitytools.hook.app.powerkeeper
|
||||
|
||||
import com.lt2333.simplicitytools.util.XSPUtils
|
||||
import com.github.kyuubiran.ezxhelper.utils.findMethod
|
||||
import com.github.kyuubiran.ezxhelper.utils.hookBefore
|
||||
import com.lt2333.simplicitytools.util.hasEnable
|
||||
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||
import de.robv.android.xposed.XC_MethodHook
|
||||
import de.robv.android.xposed.XposedHelpers
|
||||
|
||||
object PreventRecoveryOfBatteryOptimizationWhitelist : HookRegister() {
|
||||
|
||||
override fun init() {
|
||||
val classIfExists = XposedHelpers.findClassIfExists(
|
||||
"com.miui.powerkeeper.statemachine.ForceDozeController",
|
||||
getDefaultClassLoader()
|
||||
)
|
||||
XposedHelpers.findAndHookMethod(
|
||||
classIfExists,
|
||||
"restoreWhiteListAppsIfQuitForceIdle",
|
||||
object : XC_MethodHook() {
|
||||
override fun beforeHookedMethod(param: MethodHookParam) {
|
||||
super.beforeHookedMethod(param)
|
||||
if (XSPUtils.getBoolean(
|
||||
"prevent_recovery_of_battery_optimization_white_list",
|
||||
false
|
||||
)
|
||||
findMethod(
|
||||
"com.miui.powerkeeper.statemachine.ForceDozeController"
|
||||
) {
|
||||
param.result = null
|
||||
name == "restoreWhiteListAppsIfQuitForceIdle"
|
||||
}.hookBefore {
|
||||
hasEnable("prevent_recovery_of_battery_optimization_white_list") {
|
||||
it.result = null
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.lt2333.simplicitytools.hook.app.cast
|
||||
package com.lt2333.simplicitytools.hook.app.reardisplay
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.graphics.Typeface
|
||||
import android.util.TypedValue
|
||||
import android.view.Gravity
|
||||
@@ -10,36 +9,29 @@ import android.widget.RelativeLayout
|
||||
import android.widget.TextView
|
||||
import cn.fkj233.ui.activity.dp2px
|
||||
import com.github.kyuubiran.ezxhelper.utils.findMethod
|
||||
import com.github.kyuubiran.ezxhelper.utils.hookMethod
|
||||
import com.github.kyuubiran.ezxhelper.utils.hookAfter
|
||||
import com.github.kyuubiran.ezxhelper.utils.hookBefore
|
||||
import com.lt2333.simplicitytools.util.hasEnable
|
||||
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||
import com.lt2333.simplicitytools.view.WeatherView
|
||||
|
||||
object RearDisplayWeather : HookRegister() {
|
||||
@SuppressLint("ResourceType")
|
||||
|
||||
override fun init() {
|
||||
hasEnable("rear_show_weather") {
|
||||
findMethod("com.xiaomi.misubscreenui.light.aod.view.VerticalClockView") {
|
||||
name == "onFinishInflate"
|
||||
}.hookMethod {
|
||||
after {
|
||||
}.hookAfter {
|
||||
val viewGroup = it.thisObject as ViewGroup
|
||||
val context = viewGroup.context
|
||||
|
||||
//获取原组件
|
||||
val gradientLayoutID =
|
||||
context.resources.getIdentifier(
|
||||
"gradient_layout",
|
||||
"id",
|
||||
context.packageName
|
||||
)
|
||||
context.resources.getIdentifier("gradient_layout", "id", context.packageName)
|
||||
val gradientLayout: ViewGroup = viewGroup.findViewById(gradientLayoutID)
|
||||
|
||||
val dateID =
|
||||
context.resources.getIdentifier("date", "id", context.packageName)
|
||||
val dateID = context.resources.getIdentifier("date", "id", context.packageName)
|
||||
val date: TextView = viewGroup.findViewById(dateID)
|
||||
|
||||
|
||||
//创建天气组件
|
||||
val mWeatherView = WeatherView(context, false).apply {
|
||||
gravity = Gravity.END
|
||||
@@ -52,36 +44,24 @@ object RearDisplayWeather : HookRegister() {
|
||||
)
|
||||
typeface = Typeface.create("mipro-medium", Typeface.NORMAL)
|
||||
setTextSize(TypedValue.COMPLEX_UNIT_DIP, 12f)
|
||||
|
||||
}
|
||||
gradientLayout.addView(mWeatherView, (gradientLayout.indexOfChild(date) + 1))
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
findMethod("com.xiaomi.misubscreenui.light.aod.view.HorizontalClockView") {
|
||||
name == "onFinishInflate"
|
||||
}.hookMethod {
|
||||
before {
|
||||
val viewGroup = it.thisObject as ViewGroup
|
||||
}.hookBefore { param ->
|
||||
val viewGroup = param.thisObject as ViewGroup
|
||||
val context = viewGroup.context
|
||||
|
||||
//获取原组件
|
||||
val gradientLayoutID =
|
||||
context.resources.getIdentifier(
|
||||
"gradient_layout",
|
||||
"id",
|
||||
context.packageName
|
||||
)
|
||||
context.resources.getIdentifier("gradient_layout", "id", context.packageName)
|
||||
val gradientLayout: RelativeLayout = viewGroup.findViewById(gradientLayoutID)
|
||||
|
||||
val dateID =
|
||||
context.resources.getIdentifier("date", "id", context.packageName)
|
||||
val dateID = context.resources.getIdentifier("date", "id", context.packageName)
|
||||
val date: TextView = viewGroup.findViewById(dateID)
|
||||
|
||||
val dateParentLayout: ViewGroup = date.parent as ViewGroup
|
||||
|
||||
|
||||
//创建天气组件
|
||||
val mWeatherView = WeatherView(context, false).apply {
|
||||
id = View.generateViewId()
|
||||
@@ -94,32 +74,26 @@ object RearDisplayWeather : HookRegister() {
|
||||
context.packageName
|
||||
)
|
||||
)
|
||||
typeface = Typeface.create("mipro-medium", 0)
|
||||
|
||||
typeface = Typeface.create("mipro-medium", Typeface.NORMAL)
|
||||
layoutParams = RelativeLayout.LayoutParams(
|
||||
RelativeLayout.LayoutParams.WRAP_CONTENT, dp2px(context, 30f)
|
||||
RelativeLayout.LayoutParams.WRAP_CONTENT,
|
||||
dp2px(context, 30f)
|
||||
).also {
|
||||
it.addRule(RelativeLayout.END_OF, dateID)
|
||||
it.marginStart = dp2px(context, 3f)
|
||||
it.marginEnd = dp2px(context, 3f)
|
||||
}
|
||||
}
|
||||
dateParentLayout.addView(
|
||||
mWeatherView,
|
||||
(dateParentLayout.indexOfChild(date) + 1)
|
||||
)
|
||||
dateParentLayout.addView(mWeatherView, (dateParentLayout.indexOfChild(date) + 1))
|
||||
|
||||
//电池位置
|
||||
val batteryID =
|
||||
context.resources.getIdentifier(
|
||||
"battery_container",
|
||||
"id",
|
||||
context.packageName
|
||||
)
|
||||
context.resources.getIdentifier("battery_container", "id", context.packageName)
|
||||
val battery: ViewGroup = viewGroup.findViewById(batteryID)
|
||||
|
||||
battery.layoutParams = RelativeLayout.LayoutParams(
|
||||
RelativeLayout.LayoutParams.WRAP_CONTENT, dp2px(context, 30f)
|
||||
RelativeLayout.LayoutParams.WRAP_CONTENT,
|
||||
dp2px(context, 30f)
|
||||
).also {
|
||||
it.addRule(RelativeLayout.END_OF, mWeatherView.id)
|
||||
}
|
||||
@@ -127,5 +101,5 @@ object RearDisplayWeather : HookRegister() {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,29 +1,21 @@
|
||||
package com.lt2333.simplicitytools.hook.app.screenshot
|
||||
|
||||
import com.lt2333.simplicitytools.util.XSPUtils
|
||||
import com.github.kyuubiran.ezxhelper.utils.findMethod
|
||||
import com.github.kyuubiran.ezxhelper.utils.hookBefore
|
||||
import com.lt2333.simplicitytools.util.hasEnable
|
||||
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||
import de.robv.android.xposed.XC_MethodHook
|
||||
import de.robv.android.xposed.XposedHelpers
|
||||
|
||||
object UnlockUnlimitedCropping : HookRegister() {
|
||||
|
||||
override fun init() {
|
||||
//截图无限裁切
|
||||
val classIfExists2 = XposedHelpers.findClassIfExists(
|
||||
"com.miui.gallery.editor.photo.screen.crop.ScreenCropView\$b",
|
||||
getDefaultClassLoader()
|
||||
)
|
||||
|
||||
XposedHelpers.findAndHookMethod(
|
||||
classIfExists2,
|
||||
"a",
|
||||
object : XC_MethodHook() {
|
||||
override fun beforeHookedMethod(param: MethodHookParam) {
|
||||
if (XSPUtils.getBoolean("unlock_unlimited_cropping",false)) {
|
||||
param.result = 0
|
||||
findMethod("com.miui.gallery.editor.photo.screen.crop.ScreenCropView\$b") {
|
||||
name == "a"
|
||||
}.hookBefore {
|
||||
hasEnable("unlock_unlimited_cropping") {
|
||||
it.result = 0
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import com.lt2333.simplicitytools.util.hasEnable
|
||||
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||
|
||||
object LockOneHundred : HookRegister() {
|
||||
|
||||
override fun init() {
|
||||
//防止点击重新检测
|
||||
findMethod("com.miui.securityscan.ui.main.MainContentFrame") {
|
||||
@@ -26,4 +27,5 @@ object LockOneHundred : HookRegister() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import com.lt2333.simplicitytools.util.hasEnable
|
||||
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||
|
||||
object RemoveOpenAppConfirmationPopup : HookRegister() {
|
||||
|
||||
override fun init() {
|
||||
findMethod("android.widget.TextView") {
|
||||
name == "setText" && parameterTypes[0] == CharSequence::class.java
|
||||
@@ -28,4 +29,5 @@ object RemoveOpenAppConfirmationPopup : HookRegister() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ import com.github.kyuubiran.ezxhelper.utils.findMethod
|
||||
import com.github.kyuubiran.ezxhelper.utils.getObjectAs
|
||||
import com.github.kyuubiran.ezxhelper.utils.hookAfter
|
||||
import com.github.kyuubiran.ezxhelper.utils.hookBefore
|
||||
import com.lt2333.simplicitytools.util.*
|
||||
import com.lt2333.simplicitytools.util.hasEnable
|
||||
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||
|
||||
object ShowBatteryTemperature : HookRegister() {
|
||||
@@ -100,4 +100,5 @@ object ShowBatteryTemperature : HookRegister() {
|
||||
linearLayout.addView(tempView)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import com.lt2333.simplicitytools.util.hasEnable
|
||||
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||
|
||||
object SkipWaitingTime : HookRegister() {
|
||||
|
||||
override fun init() {
|
||||
findMethod("android.widget.TextView") {
|
||||
name == "setText" && parameterCount == 4
|
||||
@@ -26,4 +27,5 @@ object SkipWaitingTime : HookRegister() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,7 +2,7 @@ package com.lt2333.simplicitytools.hook.app.settings
|
||||
|
||||
import android.app.NotificationChannel
|
||||
import com.github.kyuubiran.ezxhelper.utils.*
|
||||
import com.lt2333.simplicitytools.util.*
|
||||
import com.lt2333.simplicitytools.util.XSPUtils
|
||||
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||
import de.robv.android.xposed.XposedHelpers
|
||||
|
||||
@@ -13,24 +13,36 @@ object ShowNotificationImportance : HookRegister() {
|
||||
name == "removeDefaultPrefs"
|
||||
}.hookBefore {
|
||||
if (!XSPUtils.getBoolean("show_notification_importance", false)) return@hookBefore
|
||||
val importance = it.thisObject.invokeMethodAuto("findPreference", "importance") ?: return@hookBefore
|
||||
val importance =
|
||||
it.thisObject.invokeMethodAuto("findPreference", "importance") ?: return@hookBefore
|
||||
val mChannel = it.thisObject.getObject("mChannel") as NotificationChannel
|
||||
val index = importance.invokeMethodAuto("findSpinnerIndexOfValue", mChannel.importance.toString()) as Int
|
||||
val index = importance.invokeMethodAutoAs<Int>(
|
||||
"findSpinnerIndexOfValue",
|
||||
mChannel.importance.toString()
|
||||
) as Int
|
||||
if (index < 0) return@hookBefore
|
||||
importance.invokeMethodAuto("setValueIndex", index)
|
||||
XposedHelpers.setAdditionalInstanceField(importance, "channelNotificationSettings", it.thisObject)
|
||||
XposedHelpers.setAdditionalInstanceField(
|
||||
importance,
|
||||
"channelNotificationSettings",
|
||||
it.thisObject
|
||||
)
|
||||
it.result = null
|
||||
}
|
||||
|
||||
findMethod("androidx.preference.Preference"){
|
||||
name == "callChangeListener" && parameterTypes[0] == Any::class.java
|
||||
}.hookAfter {
|
||||
val channelNotificationSettings = XposedHelpers.getAdditionalInstanceField(it.thisObject, "channelNotificationSettings") ?: return@hookAfter
|
||||
val channelNotificationSettings = XposedHelpers.getAdditionalInstanceField(
|
||||
it.thisObject,
|
||||
"channelNotificationSettings"
|
||||
) ?: return@hookAfter
|
||||
val mChannel = channelNotificationSettings.getObject("mChannel") as NotificationChannel
|
||||
mChannel.invokeMethodAuto("setImportance", (it.args[0] as String).toInt())
|
||||
val mBackend = channelNotificationSettings.getObjectOrNull("mBackend") ?: return@hookAfter
|
||||
val mPkg = channelNotificationSettings.getObject("mPkg") as String
|
||||
val mUid = channelNotificationSettings.getObject("mUid") as Int
|
||||
val mBackend =
|
||||
channelNotificationSettings.getObjectOrNull("mBackend") ?: return@hookAfter
|
||||
val mPkg = channelNotificationSettings.getObjectAs<String>("mPkg")
|
||||
val mUid = channelNotificationSettings.getObjectAs<Int>("mUid")
|
||||
mBackend.invokeMethodAuto("updateChannel", mPkg, mUid, mChannel)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,21 +3,23 @@ package com.lt2333.simplicitytools.hook.app.systemui
|
||||
import android.util.TypedValue
|
||||
import android.widget.TextView
|
||||
import com.github.kyuubiran.ezxhelper.utils.findMethod
|
||||
import com.github.kyuubiran.ezxhelper.utils.getObject
|
||||
import com.github.kyuubiran.ezxhelper.utils.getObjectAs
|
||||
import com.github.kyuubiran.ezxhelper.utils.hookAfter
|
||||
import com.lt2333.simplicitytools.util.XSPUtils
|
||||
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||
|
||||
object BatteryPercentage : HookRegister() {
|
||||
|
||||
override fun init() {
|
||||
val size = XSPUtils.getFloat("battery_percentage_font_size", 0f)
|
||||
if (size == 0f) return
|
||||
findMethod("com.android.systemui.statusbar.views.MiuiBatteryMeterView") {
|
||||
name == "updateResources"
|
||||
}.hookAfter {
|
||||
(it.thisObject.getObject("mBatteryPercentView") as TextView).setTextSize(
|
||||
(it.thisObject.getObjectAs<TextView>("mBatteryPercentView")).setTextSize(
|
||||
TypedValue.COMPLEX_UNIT_DIP, size
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.lt2333.simplicitytools.hook.app.systemui
|
||||
|
||||
import com.github.kyuubiran.ezxhelper.utils.findMethod
|
||||
import com.github.kyuubiran.ezxhelper.utils.hookMethod
|
||||
import com.github.kyuubiran.ezxhelper.utils.hookAfter
|
||||
import com.lt2333.simplicitytools.util.hasEnable
|
||||
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||
|
||||
@@ -10,11 +10,9 @@ object CanNotificationSlide: HookRegister() {
|
||||
override fun init() {
|
||||
findMethod("com.android.systemui.statusbar.notification.NotificationSettingsManager") {
|
||||
name == "canSlide"
|
||||
}.hookMethod {
|
||||
after { param ->
|
||||
}.hookAfter {
|
||||
hasEnable("can_notification_slide") {
|
||||
param.result = true
|
||||
}
|
||||
it.result = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,29 +17,21 @@ import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||
import com.lt2333.simplicitytools.view.WeatherView
|
||||
|
||||
object ControlCenterWeather : HookRegister() {
|
||||
|
||||
override fun init() = hasEnable("control_center_weather") {
|
||||
var mWeatherView: TextView? = null
|
||||
var mConstraintLayout: ConstraintLayout? = null
|
||||
val isDisplayCity = XSPUtils.getBoolean("control_center_weather_city", false)
|
||||
findMethod("com.android.systemui.controlcenter.phone.widget.QSControlCenterHeaderView") {
|
||||
name == "onFinishInflate"
|
||||
}.hookAfter {
|
||||
val viewGroup = it.thisObject as ViewGroup
|
||||
}.hookAfter { param ->
|
||||
val viewGroup = param.thisObject as ViewGroup
|
||||
val context = viewGroup.context
|
||||
|
||||
// MIUI编译时间大于 2022-03-12 00:00:00 且为内测版
|
||||
if (SystemProperties.get(context, "ro.build.date.utc")!!
|
||||
.toInt() >= 1647014400 &&
|
||||
|
||||
!SystemProperties.get(
|
||||
context,
|
||||
"ro.build.version.incremental"
|
||||
)!!.endsWith("DEV") &&
|
||||
|
||||
!SystemProperties.get(
|
||||
context,
|
||||
"ro.build.version.incremental"
|
||||
)!!.endsWith("XM")
|
||||
if (SystemProperties[context, "ro.build.date.utc"]!!.toInt() >= 1647014400 && !SystemProperties[context, "ro.build.version.incremental"]!!.endsWith(
|
||||
"DEV"
|
||||
) && !SystemProperties[context, "ro.build.version.incremental"]!!.endsWith("XM")
|
||||
) {
|
||||
//获取原组件
|
||||
val big_time_ID =
|
||||
@@ -69,18 +61,15 @@ object ControlCenterWeather : HookRegister() {
|
||||
|
||||
(big_time.parent as ViewGroup).addView(mConstraintLayout, 0)
|
||||
|
||||
|
||||
//从原布局中删除组件
|
||||
(big_time.parent as ViewGroup).removeView(big_time)
|
||||
(date_time.parent as ViewGroup).removeView(date_time)
|
||||
|
||||
|
||||
//添加组件至新布局
|
||||
mConstraintLayout!!.addView(big_time)
|
||||
mConstraintLayout!!.addView(date_time)
|
||||
|
||||
//组件属性
|
||||
|
||||
val date_time_LP = ConstraintLayout.LayoutParams(
|
||||
ConstraintLayout.LayoutParams.WRAP_CONTENT,
|
||||
ConstraintLayout.LayoutParams.WRAP_CONTENT
|
||||
@@ -190,18 +179,9 @@ object ControlCenterWeather : HookRegister() {
|
||||
val context = viewGroup.context
|
||||
val mOrientation = viewGroup.getObject("mOrientation") as Int
|
||||
// MIUI编译时间大于 2022-03-12 00:00:00 且为内测版
|
||||
if (SystemProperties.get(context, "ro.build.date.utc")!!
|
||||
.toInt() >= 1647014400 &&
|
||||
|
||||
!SystemProperties.get(
|
||||
context,
|
||||
"ro.build.version.incremental"
|
||||
)!!.endsWith("DEV") &&
|
||||
|
||||
!SystemProperties.get(
|
||||
context,
|
||||
"ro.build.version.incremental"
|
||||
)!!.endsWith("XM")
|
||||
if (SystemProperties[context, "ro.build.date.utc"]!!.toInt() >= 1647014400 && !SystemProperties[context, "ro.build.version.incremental"]!!.endsWith(
|
||||
"DEV"
|
||||
) && !SystemProperties[context, "ro.build.version.incremental"]!!.endsWith("XM")
|
||||
) {
|
||||
if (mOrientation == 1) {
|
||||
mConstraintLayout!!.visibility = View.VISIBLE
|
||||
@@ -217,4 +197,5 @@ object ControlCenterWeather : HookRegister() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.lt2333.simplicitytools.util.hasEnable
|
||||
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||
|
||||
object CustomMobileTypeText : HookRegister() {
|
||||
|
||||
override fun init() = hasEnable("custom_mobile_type_text_switch") {
|
||||
findMethod("com.android.systemui.statusbar.policy.MobileSignalController") {
|
||||
name == "getMobileTypeName" && parameterTypes[0] == Int::class.java
|
||||
@@ -14,4 +15,5 @@ object CustomMobileTypeText : HookRegister() {
|
||||
it.result = XSPUtils.getString("custom_mobile_type_text", "5G")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -52,9 +52,9 @@ object DoubleLineNetworkSpeed : HookRegister() {
|
||||
mView.isSingleLine = false
|
||||
mView.setLineSpacing(0F, 0.8F)
|
||||
if (getDualAlign == 0) {
|
||||
mView.gravity = Gravity.LEFT or Gravity.CENTER_VERTICAL
|
||||
mView.gravity = Gravity.START or Gravity.CENTER_VERTICAL
|
||||
} else {
|
||||
mView.gravity = Gravity.RIGHT or Gravity.CENTER_VERTICAL
|
||||
mView.gravity = Gravity.END or Gravity.CENTER_VERTICAL
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,9 +64,7 @@ object DoubleLineNetworkSpeed : HookRegister() {
|
||||
if (getDualAlign == 0) {
|
||||
it.result =
|
||||
"$upIcon ${getTotalUpSpeed(it.args[0] as Context)}\n${downIcon} ${
|
||||
getTotalDownloadSpeed(
|
||||
it.args[0] as Context
|
||||
)
|
||||
getTotalDownloadSpeed(it.args[0] as Context)
|
||||
}"
|
||||
} else {
|
||||
it.result =
|
||||
@@ -81,7 +79,7 @@ object DoubleLineNetworkSpeed : HookRegister() {
|
||||
|
||||
//获取总的上行速度
|
||||
private fun getTotalUpSpeed(context: Context): String {
|
||||
var totalUpSpeed: Float
|
||||
val totalUpSpeed: Float
|
||||
|
||||
val currentTotalTxBytes = TrafficStats.getTotalTxBytes()
|
||||
val nowTimeStampTotalUp = System.currentTimeMillis()
|
||||
@@ -89,7 +87,7 @@ object DoubleLineNetworkSpeed : HookRegister() {
|
||||
//计算上传速度
|
||||
val bytes =
|
||||
(currentTotalTxBytes - mLastTotalUp) * 1000 / (nowTimeStampTotalUp - lastTimeStampTotalUp).toFloat()
|
||||
var unit: String
|
||||
val unit: String
|
||||
|
||||
if (bytes >= 1048576) {
|
||||
totalUpSpeed =
|
||||
@@ -126,7 +124,7 @@ object DoubleLineNetworkSpeed : HookRegister() {
|
||||
|
||||
//获取总的下行速度
|
||||
private fun getTotalDownloadSpeed(context: Context): String {
|
||||
var totalDownSpeed: Float
|
||||
val totalDownSpeed: Float
|
||||
val currentTotalRxBytes = TrafficStats.getTotalRxBytes()
|
||||
val nowTimeStampTotalDown = System.currentTimeMillis()
|
||||
|
||||
@@ -134,7 +132,7 @@ object DoubleLineNetworkSpeed : HookRegister() {
|
||||
val bytes =
|
||||
(currentTotalRxBytes - mLastTotalDown) * 1000 / (nowTimeStampTotalDown - lastTimeStampTotalDown).toFloat()
|
||||
|
||||
var unit: String
|
||||
val unit: String
|
||||
|
||||
if (bytes >= 1048576) {
|
||||
totalDownSpeed =
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import com.github.kyuubiran.ezxhelper.utils.findMethod
|
||||
import com.github.kyuubiran.ezxhelper.utils.getObject
|
||||
import com.github.kyuubiran.ezxhelper.utils.getObjectAs
|
||||
import com.github.kyuubiran.ezxhelper.utils.hookAfter
|
||||
import com.lt2333.simplicitytools.util.hasEnable
|
||||
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||
@@ -18,19 +19,19 @@ object HideBatteryIcon : HookRegister() {
|
||||
}.hookAfter {
|
||||
//隐藏电池图标
|
||||
hasEnable("hide_battery_icon") {
|
||||
(it.thisObject.getObject("mBatteryIconView") as ImageView).visibility = View.GONE
|
||||
(it.thisObject.getObjectAs<ImageView>("mBatteryIconView")).visibility = View.GONE
|
||||
if (it.thisObject.getObject("mBatteryStyle") == 1) {
|
||||
(it.thisObject.getObject("mBatteryDigitalView") as FrameLayout).visibility =
|
||||
(it.thisObject.getObjectAs<FrameLayout>("mBatteryDigitalView")).visibility =
|
||||
View.GONE
|
||||
}
|
||||
}
|
||||
//隐藏电池内的百分比
|
||||
hasEnable("hide_battery_percentage_icon") {
|
||||
(it.thisObject.getObject("mBatteryPercentMarkView") as TextView).textSize = 0F
|
||||
(it.thisObject.getObjectAs<TextView>("mBatteryPercentMarkView")).textSize = 0F
|
||||
}
|
||||
//隐藏电池百分号
|
||||
hasEnable("hide_battery_percentage_icon") {
|
||||
(it.thisObject.getObject("mBatteryPercentMarkView") as TextView).textSize = 0F
|
||||
(it.thisObject.getObjectAs<TextView>("mBatteryPercentMarkView")).textSize = 0F
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,11 +40,12 @@ object HideBatteryIcon : HookRegister() {
|
||||
}.hookAfter {
|
||||
//隐藏电池充电图标
|
||||
hasEnable("hide_battery_charging_icon") {
|
||||
(it.thisObject.getObject("mBatteryChargingInView") as ImageView).visibility =
|
||||
(it.thisObject.getObjectAs<ImageView>("mBatteryChargingInView")).visibility =
|
||||
View.GONE
|
||||
(it.thisObject.getObject("mBatteryChargingView") as ImageView).visibility =
|
||||
(it.thisObject.getObjectAs<ImageView>("mBatteryChargingView")).visibility =
|
||||
View.GONE
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,13 +3,14 @@ package com.lt2333.simplicitytools.hook.app.systemui
|
||||
import android.view.View
|
||||
import android.widget.ImageView
|
||||
import com.github.kyuubiran.ezxhelper.utils.findMethod
|
||||
import com.github.kyuubiran.ezxhelper.utils.getObject
|
||||
import com.github.kyuubiran.ezxhelper.utils.getObjectAs
|
||||
import com.github.kyuubiran.ezxhelper.utils.hookAfter
|
||||
import com.lt2333.simplicitytools.util.hasEnable
|
||||
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||
import de.robv.android.xposed.XC_MethodHook
|
||||
|
||||
object HideHDIcon : HookRegister() {
|
||||
|
||||
override fun init() {
|
||||
findMethod("com.android.systemui.statusbar.StatusBarMobileView") {
|
||||
name == "initViewState" && parameterCount == 1
|
||||
@@ -26,14 +27,14 @@ object HideHDIcon : HookRegister() {
|
||||
|
||||
private fun hide(it: XC_MethodHook.MethodHookParam) {
|
||||
hasEnable("hide_big_hd_icon") {
|
||||
(it.thisObject.getObject("mVolte") as ImageView).visibility = View.GONE
|
||||
(it.thisObject.getObjectAs<ImageView>("mVolte")).visibility = View.GONE
|
||||
}
|
||||
hasEnable("hide_small_hd_icon") {
|
||||
(it.thisObject.getObject("mSmallHd") as ImageView).visibility = View.GONE
|
||||
(it.thisObject.getObjectAs<ImageView>("mSmallHd")).visibility = View.GONE
|
||||
}
|
||||
hasEnable("hide_hd_no_service_icon") {
|
||||
(it.thisObject.getObject("mVolteNoService") as ImageView).visibility =
|
||||
View.GONE
|
||||
(it.thisObject.getObjectAs<ImageView>("mVolteNoService")).visibility = View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,13 +3,14 @@ package com.lt2333.simplicitytools.hook.app.systemui
|
||||
import android.view.View
|
||||
import android.widget.ImageView
|
||||
import com.github.kyuubiran.ezxhelper.utils.findMethod
|
||||
import com.github.kyuubiran.ezxhelper.utils.getObject
|
||||
import com.github.kyuubiran.ezxhelper.utils.getObjectAs
|
||||
import com.github.kyuubiran.ezxhelper.utils.hookAfter
|
||||
import com.lt2333.simplicitytools.util.hasEnable
|
||||
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||
import de.robv.android.xposed.XC_MethodHook
|
||||
|
||||
object HideMobileActivityIcon : HookRegister() {
|
||||
|
||||
override fun init() {
|
||||
findMethod("com.android.systemui.statusbar.StatusBarMobileView") {
|
||||
name == "initViewState" && parameterCount == 1
|
||||
@@ -26,8 +27,9 @@ object HideMobileActivityIcon : HookRegister() {
|
||||
|
||||
private fun hide(it: XC_MethodHook.MethodHookParam) {
|
||||
hasEnable("hide_mobile_activity_icon") {
|
||||
(it.thisObject.getObject("mLeftInOut") as ImageView).visibility = View.GONE
|
||||
(it.thisObject.getObject("mRightInOut") as ImageView).visibility = View.GONE
|
||||
(it.thisObject.getObjectAs<ImageView>("mLeftInOut")).visibility = View.GONE
|
||||
(it.thisObject.getObjectAs<ImageView>("mRightInOut")).visibility = View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,7 +4,7 @@ import android.view.View
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import com.github.kyuubiran.ezxhelper.utils.findMethod
|
||||
import com.github.kyuubiran.ezxhelper.utils.getObject
|
||||
import com.github.kyuubiran.ezxhelper.utils.getObjectAs
|
||||
import com.github.kyuubiran.ezxhelper.utils.hookAfter
|
||||
import com.lt2333.simplicitytools.util.XSPUtils
|
||||
import com.lt2333.simplicitytools.util.hasEnable
|
||||
@@ -32,20 +32,21 @@ object HideMobileTypeIcon : HookRegister() {
|
||||
private fun hideMobileTypeIcon(it: XC_MethodHook.MethodHookParam) {
|
||||
hasEnable("hide_mobile_type_icon") {
|
||||
if (isBigType) {
|
||||
(it.thisObject.getObject("mMobileType") as TextView).visibility =
|
||||
(it.thisObject.getObjectAs<TextView>("mMobileType")).visibility =
|
||||
View.GONE
|
||||
(it.thisObject.getObject("mMobileTypeImage") as ImageView).visibility =
|
||||
(it.thisObject.getObjectAs<ImageView>("mMobileTypeImage")).visibility =
|
||||
View.GONE
|
||||
(it.thisObject.getObject("mMobileTypeSingle") as TextView).visibility =
|
||||
(it.thisObject.getObjectAs<TextView>("mMobileTypeSingle")).visibility =
|
||||
View.GONE
|
||||
} else {
|
||||
(it.thisObject.getObject("mMobileType") as TextView).visibility =
|
||||
(it.thisObject.getObjectAs<TextView>("mMobileType")).visibility =
|
||||
View.INVISIBLE
|
||||
(it.thisObject.getObject("mMobileTypeImage") as ImageView).visibility =
|
||||
(it.thisObject.getObjectAs<ImageView>("mMobileTypeImage")).visibility =
|
||||
View.INVISIBLE
|
||||
(it.thisObject.getObject("mMobileTypeSingle") as TextView).visibility =
|
||||
(it.thisObject.getObjectAs<TextView>("mMobileTypeSingle")).visibility =
|
||||
View.INVISIBLE
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import com.lt2333.simplicitytools.util.hasEnable
|
||||
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||
|
||||
object HideNetworkSpeedSplitter : HookRegister() {
|
||||
|
||||
override fun init() {
|
||||
findMethod("com.android.systemui.statusbar.views.NetworkSpeedSplitter") {
|
||||
name == "init"
|
||||
@@ -17,4 +18,5 @@ object HideNetworkSpeedSplitter : HookRegister() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.lt2333.simplicitytools.util.hasEnable
|
||||
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||
|
||||
object HideSimIcon : HookRegister() {
|
||||
|
||||
override fun init() {
|
||||
findMethod("com.android.systemui.statusbar.phone.StatusBarSignalPolicy") {
|
||||
name == "hasCorrectSubs" && parameterTypes[0] == MutableList::class.java
|
||||
@@ -20,4 +21,5 @@ object HideSimIcon : HookRegister() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||
import de.robv.android.xposed.XC_MethodHook
|
||||
|
||||
object HideStatusBarIcon : HookRegister() {
|
||||
|
||||
override fun init() {
|
||||
findMethod("com.android.systemui.statusbar.phone.StatusBarIconControllerImpl") {
|
||||
name == "setIconVisibility" && parameterCount == 2
|
||||
@@ -82,4 +83,5 @@ object HideStatusBarIcon : HookRegister() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,19 +6,22 @@ import com.lt2333.simplicitytools.util.hasEnable
|
||||
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||
|
||||
object HideStatusBarNetworkSpeedSecond : HookRegister() {
|
||||
|
||||
override fun init() {
|
||||
findMethod("com.android.systemui.statusbar.views.NetworkSpeedView") {
|
||||
name == "setNetworkSpeed" && parameterTypes[0] == String::class.java
|
||||
name == "setNetworkSpeed" && parameterCount == 1
|
||||
}.hookBefore {
|
||||
hasEnable("hide_status_bar_network_speed_second") {
|
||||
if (it.args[0] != null) {
|
||||
(it.args[0] as String)
|
||||
val mText = (it.args[0] as String)
|
||||
.replace("/", "")
|
||||
.replace("s", "")
|
||||
.replace("'", "")
|
||||
.replace("\'", "")
|
||||
.replace("วิ", "")
|
||||
it.args[0] = mText
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,7 +4,7 @@ import android.view.View
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import com.github.kyuubiran.ezxhelper.utils.findMethod
|
||||
import com.github.kyuubiran.ezxhelper.utils.getObject
|
||||
import com.github.kyuubiran.ezxhelper.utils.getObjectAs
|
||||
import com.github.kyuubiran.ezxhelper.utils.hookAfter
|
||||
import com.lt2333.simplicitytools.util.hasEnable
|
||||
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||
@@ -29,12 +29,12 @@ object HideWifiActivityIcon : HookRegister() {
|
||||
private fun hide(it: XC_MethodHook.MethodHookParam) {
|
||||
//隐藏WIFI箭头
|
||||
hasEnable("hide_wifi_activity_icon") {
|
||||
(it.thisObject.getObject("mWifiActivityView") as ImageView).visibility =
|
||||
(it.thisObject.getObjectAs<ImageView>("mWifiActivityView")).visibility =
|
||||
View.INVISIBLE
|
||||
}
|
||||
//隐藏WIFI标准图标
|
||||
hasEnable("hide_wifi_standard_icon") {
|
||||
(it.thisObject.getObject("mWifiStandardView") as TextView).visibility =
|
||||
(it.thisObject.getObjectAs<TextView>("mWifiStandardView")).visibility =
|
||||
View.INVISIBLE
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,8 +37,7 @@ object LockScreenClockDisplaySeconds : HookRegister() {
|
||||
}
|
||||
}
|
||||
Timer().scheduleAtFixedRate(T(), 1000 - System.currentTimeMillis() % 1000, 1000)
|
||||
} catch (e: Exception) {
|
||||
|
||||
} catch (_: Exception) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,7 +59,7 @@ object LockScreenClockDisplaySeconds : HookRegister() {
|
||||
}
|
||||
|
||||
private fun updateTime(it: XC_MethodHook.MethodHookParam, isVertical: Boolean) {
|
||||
val textV = it.thisObject.getObject("mTimeText") as TextView
|
||||
val textV = it.thisObject.getObjectAs<TextView>("mTimeText")
|
||||
val c: Context = textV.context
|
||||
|
||||
Log.d(
|
||||
@@ -82,12 +81,13 @@ object LockScreenClockDisplaySeconds : HookRegister() {
|
||||
@SuppressLint("SimpleDateFormat")
|
||||
private fun getTime(is24: Boolean, isVertical: Boolean): String {
|
||||
var timePattern = ""
|
||||
if (isVertical) { //垂直
|
||||
timePattern += if (is24) "HH\nmm\nss" else "hh\nmm\nss"
|
||||
timePattern += if (isVertical) { //垂直
|
||||
if (is24) "HH\nmm\nss" else "hh\nmm\nss"
|
||||
} else { //水平
|
||||
timePattern += if (is24) "HH:mm:ss" else "h:mm:ss"
|
||||
if (is24) "HH:mm:ss" else "h:mm:ss"
|
||||
}
|
||||
timePattern = SimpleDateFormat(timePattern).format(nowTime)
|
||||
return timePattern
|
||||
}
|
||||
|
||||
}
|
||||
@@ -93,7 +93,7 @@ object LockScreenCurrent : HookRegister() {
|
||||
val i: Int = bufferedReader.readLine().toInt(10)
|
||||
bufferedReader.close()
|
||||
return i
|
||||
} catch (localException: java.lang.Exception) {
|
||||
} catch (_: java.lang.Exception) {
|
||||
}
|
||||
return defaultValue
|
||||
}
|
||||
|
||||
@@ -11,8 +11,10 @@ import com.github.kyuubiran.ezxhelper.utils.hookBefore
|
||||
import com.lt2333.simplicitytools.util.hasEnable
|
||||
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||
import de.robv.android.xposed.XposedHelpers
|
||||
import kotlin.math.abs
|
||||
|
||||
object LockScreenDoubleTapToSleep : HookRegister() {
|
||||
|
||||
override fun init() = hasEnable("lock_screen_double_tap_to_sleep") {
|
||||
findMethod("com.android.systemui.statusbar.phone.NotificationsQuickSettingsContainer") {
|
||||
name == "onFinishInflate"
|
||||
@@ -35,7 +37,7 @@ object LockScreenDoubleTapToSleep : HookRegister() {
|
||||
currentTouchTime = System.currentTimeMillis()
|
||||
currentTouchX = event.x
|
||||
currentTouchY = event.y
|
||||
if (currentTouchTime - lastTouchTime < 250L && Math.abs(currentTouchX - lastTouchX) < 100f && Math.abs(
|
||||
if (currentTouchTime - lastTouchTime < 250L && abs(currentTouchX - lastTouchX) < 100f && abs(
|
||||
currentTouchY - lastTouchY
|
||||
) < 100f
|
||||
) {
|
||||
@@ -64,4 +66,5 @@ object LockScreenDoubleTapToSleep : HookRegister() {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,6 +8,7 @@ import com.lt2333.simplicitytools.util.XSPUtils
|
||||
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||
|
||||
object MaximumNumberOfNotificationIcons : HookRegister() {
|
||||
|
||||
override fun init() {
|
||||
val icons = XSPUtils.getInt("maximum_number_of_notification_icons", 3)
|
||||
val dots = XSPUtils.getInt("maximum_number_of_notification_dots", 3)
|
||||
@@ -26,4 +27,5 @@ object MaximumNumberOfNotificationIcons : HookRegister() {
|
||||
it.thisObject.invokeMethod("updateState")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,7 +10,9 @@ import android.widget.Toast
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import cn.fkj233.ui.activity.dp2px
|
||||
import com.github.kyuubiran.ezxhelper.utils.*
|
||||
import com.lt2333.simplicitytools.util.*
|
||||
import com.lt2333.simplicitytools.util.SystemProperties
|
||||
import com.lt2333.simplicitytools.util.XSPUtils
|
||||
import com.lt2333.simplicitytools.util.hasEnable
|
||||
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||
import com.lt2333.simplicitytools.view.WeatherView
|
||||
|
||||
@@ -22,23 +24,14 @@ object NotificationWeather : HookRegister() {
|
||||
val isDisplayCity = XSPUtils.getBoolean("notification_weather_city", false)
|
||||
findMethod("com.android.systemui.qs.MiuiNotificationHeaderView") {
|
||||
name == "onFinishInflate"
|
||||
}.hookAfter {
|
||||
val viewGroup = it.thisObject as ViewGroup
|
||||
}.hookAfter { param ->
|
||||
val viewGroup = param.thisObject as ViewGroup
|
||||
val context = viewGroup.context
|
||||
|
||||
// MIUI编译时间大于 2022-03-12 00:00:00 且为内测版
|
||||
if (SystemProperties.get(context, "ro.build.date.utc")!!
|
||||
.toInt() >= 1647014400 &&
|
||||
|
||||
!SystemProperties.get(
|
||||
context,
|
||||
"ro.build.version.incremental"
|
||||
)!!.endsWith("DEV") &&
|
||||
|
||||
!SystemProperties.get(
|
||||
context,
|
||||
"ro.build.version.incremental"
|
||||
)!!.endsWith("XM")
|
||||
if (SystemProperties[context, "ro.build.date.utc"]!!.toInt() >= 1647014400 && !SystemProperties[context, "ro.build.version.incremental"]!!.endsWith(
|
||||
"DEV"
|
||||
) && !SystemProperties[context, "ro.build.version.incremental"]!!.endsWith("XM")
|
||||
) {
|
||||
//获取原组件
|
||||
val big_time_ID =
|
||||
@@ -188,18 +181,9 @@ object NotificationWeather : HookRegister() {
|
||||
val context = viewGroup.context
|
||||
val mOrientation = viewGroup.getObject("mOrientation") as Int
|
||||
// MIUI编译时间大于 2022-03-12 00:00:00 且为内测版
|
||||
if (SystemProperties.get(context, "ro.build.date.utc")!!
|
||||
.toInt() >= 1647014400 &&
|
||||
|
||||
!SystemProperties.get(
|
||||
context,
|
||||
"ro.build.version.incremental"
|
||||
)!!.endsWith("DEV") &&
|
||||
|
||||
!SystemProperties.get(
|
||||
context,
|
||||
"ro.build.version.incremental"
|
||||
)!!.endsWith("XM")
|
||||
if (SystemProperties[context, "ro.build.date.utc"]!!.toInt() >= 1647014400 && !SystemProperties[context, "ro.build.version.incremental"]!!.endsWith(
|
||||
"DEV"
|
||||
) && !SystemProperties[context, "ro.build.version.incremental"]!!.endsWith("XM")
|
||||
) {
|
||||
if (mOrientation == 1) {
|
||||
mConstraintLayout!!.visibility = View.VISIBLE
|
||||
|
||||
@@ -13,6 +13,7 @@ import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||
import com.lt2333.simplicitytools.view.WeatherView
|
||||
|
||||
object OldNotificationWeather : HookRegister() {
|
||||
|
||||
override fun init() = hasEnable("notification_weather") {
|
||||
var mWeatherView: TextView? = null
|
||||
val isDisplayCity = XSPUtils.getBoolean("notification_weather_city", false)
|
||||
@@ -93,4 +94,5 @@ object OldNotificationWeather : HookRegister() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -9,9 +9,9 @@ import com.github.kyuubiran.ezxhelper.utils.putObject
|
||||
import com.lt2333.simplicitytools.util.XSPUtils
|
||||
import com.lt2333.simplicitytools.util.hasEnable
|
||||
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||
import de.robv.android.xposed.XposedHelpers
|
||||
|
||||
object OldQSCustom : HookRegister() {
|
||||
|
||||
override fun init() = hasEnable("old_qs_custom_switch") {
|
||||
val mRows = XSPUtils.getInt("qs_custom_rows", 3)
|
||||
val mRowsHorizontal = XSPUtils.getInt("qs_custom_rows_horizontal", 2)
|
||||
@@ -39,11 +39,12 @@ object OldQSCustom : HookRegister() {
|
||||
val viewGroup = it.thisObject as ViewGroup
|
||||
val mConfiguration: Configuration = viewGroup.context.resources.configuration
|
||||
if (mConfiguration.orientation == Configuration.ORIENTATION_PORTRAIT) {
|
||||
XposedHelpers.setObjectField(viewGroup, "mMaxAllowedRows", mRows)
|
||||
viewGroup.putObject("mMaxAllowedRows", mRows)
|
||||
} else {
|
||||
XposedHelpers.setObjectField(viewGroup, "mMaxAllowedRows", mRowsHorizontal)
|
||||
viewGroup.putObject("mMaxAllowedRows", mRowsHorizontal)
|
||||
}
|
||||
viewGroup.requestLayout()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -38,5 +38,6 @@ object RemoveLockScreenCamera : HookRegister() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.lt2333.simplicitytools.util.hasEnable
|
||||
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||
|
||||
object RemoveTheLeftSideOfTheLockScreen : HookRegister() {
|
||||
|
||||
override fun init() {
|
||||
findMethod("com.android.keyguard.negative.MiuiKeyguardMoveLeftViewContainer") {
|
||||
name == "inflateLeftView"
|
||||
@@ -15,4 +16,5 @@ object RemoveTheLeftSideOfTheLockScreen : HookRegister() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,11 +1,14 @@
|
||||
package com.lt2333.simplicitytools.hook.app.systemui
|
||||
|
||||
import com.github.kyuubiran.ezxhelper.utils.*
|
||||
import com.github.kyuubiran.ezxhelper.utils.findMethod
|
||||
import com.github.kyuubiran.ezxhelper.utils.getObjectAs
|
||||
import com.github.kyuubiran.ezxhelper.utils.hookBefore
|
||||
import com.github.kyuubiran.ezxhelper.utils.putObject
|
||||
import com.lt2333.simplicitytools.util.hasEnable
|
||||
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||
|
||||
|
||||
object ShowWifiStandard : HookRegister() {
|
||||
|
||||
override fun init() {
|
||||
findMethod("com.android.systemui.statusbar.StatusBarWifiView") {
|
||||
name == "initViewState" && parameterCount == 1
|
||||
@@ -33,4 +36,5 @@ object ShowWifiStandard : HookRegister() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -12,10 +12,10 @@ import android.widget.TextView
|
||||
import com.github.kyuubiran.ezxhelper.utils.findMethod
|
||||
import com.github.kyuubiran.ezxhelper.utils.hookAfter
|
||||
import com.github.kyuubiran.ezxhelper.utils.hookReturnConstant
|
||||
import com.github.kyuubiran.ezxhelper.utils.putObject
|
||||
import com.lt2333.simplicitytools.util.XSPUtils
|
||||
import com.lt2333.simplicitytools.util.hasEnable
|
||||
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||
import de.robv.android.xposed.XposedHelpers
|
||||
|
||||
|
||||
object StatusBarBigMobileTypeIcon : HookRegister() {
|
||||
@@ -29,8 +29,8 @@ object StatusBarBigMobileTypeIcon : HookRegister() {
|
||||
override fun init() = hasEnable("big_mobile_type_icon") {
|
||||
findMethod("com.android.systemui.statusbar.StatusBarMobileView") {
|
||||
name == "init"
|
||||
}.hookAfter {
|
||||
val statusBarMobileView = it.thisObject as ViewGroup
|
||||
}.hookAfter { param ->
|
||||
val statusBarMobileView = param.thisObject as ViewGroup
|
||||
val context: Context = statusBarMobileView.context
|
||||
val res: Resources = context.resources
|
||||
|
||||
@@ -69,15 +69,13 @@ object StatusBarBigMobileTypeIcon : HookRegister() {
|
||||
val newLinearLayoutLP = LinearLayout.LayoutParams(
|
||||
LinearLayout.LayoutParams.WRAP_CONTENT,
|
||||
LinearLayout.LayoutParams.MATCH_PARENT
|
||||
).also {
|
||||
|
||||
}
|
||||
)
|
||||
val newLinearlayout = LinearLayout(context).also {
|
||||
it.layoutParams = newLinearLayoutLP
|
||||
it.id = mobileContainerLeftId
|
||||
it.setPadding(leftAndRightMargin, 0, leftAndRightMargin, 0)
|
||||
}
|
||||
XposedHelpers.setObjectField(it.thisObject, "mMobileLeftContainer", newLinearlayout)
|
||||
param.thisObject.putObject("mMobileLeftContainer", newLinearlayout)
|
||||
rightParentLayout.addView(
|
||||
newLinearlayout,
|
||||
mobileContainerRightIndex
|
||||
@@ -121,4 +119,5 @@ object StatusBarBigMobileTypeIcon : HookRegister() {
|
||||
}.hookReturnConstant(null)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,8 +10,10 @@ import com.github.kyuubiran.ezxhelper.utils.hookBefore
|
||||
import com.lt2333.simplicitytools.util.hasEnable
|
||||
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||
import de.robv.android.xposed.XposedHelpers
|
||||
import kotlin.math.abs
|
||||
|
||||
object StatusBarDoubleTapToSleep : HookRegister() {
|
||||
|
||||
override fun init() = hasEnable("status_bar_double_tap_to_sleep") {
|
||||
findMethod("com.android.systemui.statusbar.phone.MiuiPhoneStatusBarView") {
|
||||
name == "onFinishInflate"
|
||||
@@ -34,7 +36,7 @@ object StatusBarDoubleTapToSleep : HookRegister() {
|
||||
currentTouchTime = System.currentTimeMillis()
|
||||
currentTouchX = event.x
|
||||
currentTouchY = event.y
|
||||
if (currentTouchTime - lastTouchTime < 250L && Math.abs(currentTouchX - lastTouchX) < 100f && Math.abs(
|
||||
if (currentTouchTime - lastTouchTime < 250L && abs(currentTouchX - lastTouchX) < 100f && abs(
|
||||
currentTouchY - lastTouchY
|
||||
) < 100f
|
||||
) {
|
||||
@@ -59,4 +61,5 @@ object StatusBarDoubleTapToSleep : HookRegister() {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -12,13 +12,11 @@ import android.widget.TextView
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import cn.fkj233.ui.activity.dp2px
|
||||
import com.github.kyuubiran.ezxhelper.utils.findMethod
|
||||
import com.github.kyuubiran.ezxhelper.utils.getObject
|
||||
import com.github.kyuubiran.ezxhelper.utils.getObjectAs
|
||||
import com.github.kyuubiran.ezxhelper.utils.hookAfter
|
||||
import com.lt2333.simplicitytools.util.XSPUtils
|
||||
import com.lt2333.simplicitytools.util.hasEnable
|
||||
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||
import de.robv.android.xposed.XposedHelpers
|
||||
|
||||
|
||||
object StatusBarLayout : HookRegister() {
|
||||
|
||||
@@ -30,7 +28,7 @@ object StatusBarLayout : HookRegister() {
|
||||
override fun init() {
|
||||
var mLeftLayout: LinearLayout? = null
|
||||
var mRightLayout: LinearLayout? = null
|
||||
var mCenterLayout: LinearLayout? = null
|
||||
var mCenterLayout: LinearLayout?
|
||||
var statusBar: ViewGroup? = null
|
||||
|
||||
fun updateLayout(context: Context) {
|
||||
@@ -55,11 +53,11 @@ object StatusBarLayout : HookRegister() {
|
||||
1 -> {
|
||||
findMethod("com.android.systemui.statusbar.phone.CollapsedStatusBarFragment") {
|
||||
name == "onViewCreated" && parameterCount == 2
|
||||
}.hookAfter {
|
||||
val MiuiPhoneStatusBarView: ViewGroup =
|
||||
it.thisObject.getObject("mStatusBar") as ViewGroup
|
||||
val context: Context = MiuiPhoneStatusBarView.context
|
||||
val res: Resources = MiuiPhoneStatusBarView.resources
|
||||
}.hookAfter { param ->
|
||||
val miuiPhoneStatusBarView =
|
||||
param.thisObject.getObjectAs<ViewGroup>("mStatusBar")
|
||||
val context: Context = miuiPhoneStatusBarView.context
|
||||
val res: Resources = miuiPhoneStatusBarView.resources
|
||||
val statusBarId: Int =
|
||||
res.getIdentifier("status_bar", "id", "com.android.systemui")
|
||||
val statusBarContentsId: Int =
|
||||
@@ -79,17 +77,17 @@ object StatusBarLayout : HookRegister() {
|
||||
"id",
|
||||
"com.android.systemui"
|
||||
)
|
||||
statusBar = MiuiPhoneStatusBarView.findViewById(statusBarId)
|
||||
statusBar = miuiPhoneStatusBarView.findViewById(statusBarId)
|
||||
val statusBarContents: ViewGroup =
|
||||
MiuiPhoneStatusBarView.findViewById(statusBarContentsId)
|
||||
miuiPhoneStatusBarView.findViewById(statusBarContentsId)
|
||||
if (statusBar == null) return@hookAfter
|
||||
val clock: TextView = MiuiPhoneStatusBarView.findViewById(clockId)
|
||||
val clock: TextView = miuiPhoneStatusBarView.findViewById(clockId)
|
||||
val phoneStatusBarLeftContainer: ViewGroup =
|
||||
MiuiPhoneStatusBarView.findViewById(phoneStatusBarLeftContainerId)
|
||||
miuiPhoneStatusBarView.findViewById(phoneStatusBarLeftContainerId)
|
||||
val notificationIconAreaInner: ViewGroup =
|
||||
MiuiPhoneStatusBarView.findViewById(notificationIconAreaInnerId)
|
||||
miuiPhoneStatusBarView.findViewById(notificationIconAreaInnerId)
|
||||
val systemIconArea: ViewGroup =
|
||||
MiuiPhoneStatusBarView.findViewById(systemIconAreaId)
|
||||
miuiPhoneStatusBarView.findViewById(systemIconAreaId)
|
||||
|
||||
(clock.parent as ViewGroup).removeView(clock)
|
||||
(phoneStatusBarLeftContainer.parent as ViewGroup).removeView(
|
||||
@@ -119,23 +117,23 @@ object StatusBarLayout : HookRegister() {
|
||||
|
||||
//增加一个左对齐布局
|
||||
mLeftLayout = LinearLayout(context)
|
||||
val LeftLp: LinearLayout.LayoutParams =
|
||||
val leftLp: LinearLayout.LayoutParams =
|
||||
LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.MATCH_PARENT, 1.0f)
|
||||
mLeftLayout!!.layoutParams = LeftLp
|
||||
mLeftLayout!!.layoutParams = leftLp
|
||||
mLeftLayout!!.gravity = Gravity.START or Gravity.CENTER_VERTICAL
|
||||
|
||||
//增加一个居中布局
|
||||
mCenterLayout = LinearLayout(context)
|
||||
val CenterLp: LinearLayout.LayoutParams = LinearLayout.LayoutParams(
|
||||
val centerLp: LinearLayout.LayoutParams = LinearLayout.LayoutParams(
|
||||
LinearLayout.LayoutParams.WRAP_CONTENT,
|
||||
LinearLayout.LayoutParams.MATCH_PARENT
|
||||
)
|
||||
mCenterLayout!!.layoutParams = CenterLp
|
||||
mCenterLayout!!.layoutParams = centerLp
|
||||
mCenterLayout!!.gravity = Gravity.CENTER or Gravity.CENTER_VERTICAL
|
||||
mRightLayout = LinearLayout(context)
|
||||
val RightLp: LinearLayout.LayoutParams =
|
||||
val rightLp: LinearLayout.LayoutParams =
|
||||
LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.MATCH_PARENT, 1.0f)
|
||||
mRightLayout!!.layoutParams = RightLp
|
||||
mRightLayout!!.layoutParams = rightLp
|
||||
mRightLayout!!.gravity = Gravity.END or Gravity.CENTER_VERTICAL
|
||||
mLeftLayout!!.addView(phoneStatusBarLeftContainer)
|
||||
mLeftLayout!!.addView(mConstraintLayout)
|
||||
@@ -179,11 +177,11 @@ object StatusBarLayout : HookRegister() {
|
||||
2 -> {
|
||||
findMethod("com.android.systemui.statusbar.phone.CollapsedStatusBarFragment") {
|
||||
name == "onViewCreated" && parameterCount == 2
|
||||
}.hookAfter {
|
||||
val MiuiPhoneStatusBarView =
|
||||
it.thisObject.getObject("mStatusBar") as ViewGroup
|
||||
val context: Context = MiuiPhoneStatusBarView.context
|
||||
val res: Resources = MiuiPhoneStatusBarView.resources
|
||||
}.hookAfter { param ->
|
||||
val miuiPhoneStatusBarView =
|
||||
param.thisObject.getObjectAs<ViewGroup>("mStatusBar")
|
||||
val context: Context = miuiPhoneStatusBarView.context
|
||||
val res: Resources = miuiPhoneStatusBarView.resources
|
||||
|
||||
//组件ID
|
||||
val statusBarId: Int =
|
||||
@@ -192,20 +190,20 @@ object StatusBarLayout : HookRegister() {
|
||||
val batteryId: Int = res.getIdentifier("battery", "id", "com.android.systemui")
|
||||
|
||||
//查找组件
|
||||
statusBar = MiuiPhoneStatusBarView.findViewById(statusBarId)
|
||||
statusBar = miuiPhoneStatusBarView.findViewById(statusBarId)
|
||||
if (statusBar == null) return@hookAfter
|
||||
val clock: TextView = MiuiPhoneStatusBarView.findViewById(clockId)
|
||||
val battery: ViewGroup = MiuiPhoneStatusBarView.findViewById(batteryId)
|
||||
val clock: TextView = miuiPhoneStatusBarView.findViewById(clockId)
|
||||
val battery: ViewGroup = miuiPhoneStatusBarView.findViewById(batteryId)
|
||||
|
||||
//新建布局
|
||||
val RightLp = LinearLayout.LayoutParams(
|
||||
val rightLp = LinearLayout.LayoutParams(
|
||||
LinearLayout.LayoutParams.WRAP_CONTENT,
|
||||
LinearLayout.LayoutParams.MATCH_PARENT
|
||||
).also {
|
||||
it.marginStart = dp2px(context, 5f)
|
||||
}
|
||||
mRightLayout = LinearLayout(context).also {
|
||||
it.layoutParams = RightLp
|
||||
it.layoutParams = rightLp
|
||||
}
|
||||
|
||||
//添加布局与组件
|
||||
@@ -218,11 +216,11 @@ object StatusBarLayout : HookRegister() {
|
||||
3 -> {
|
||||
findMethod("com.android.systemui.statusbar.phone.CollapsedStatusBarFragment") {
|
||||
name == "onViewCreated" && parameterCount == 2
|
||||
}.hookAfter {
|
||||
val MiuiPhoneStatusBarView =
|
||||
it.thisObject.getObject("mStatusBar") as ViewGroup
|
||||
val context: Context = MiuiPhoneStatusBarView.context
|
||||
val res: Resources = MiuiPhoneStatusBarView.resources
|
||||
}.hookAfter { param ->
|
||||
val miuiPhoneStatusBarView =
|
||||
param.thisObject.getObjectAs<ViewGroup>("mStatusBar")
|
||||
val context: Context = miuiPhoneStatusBarView.context
|
||||
val res: Resources = miuiPhoneStatusBarView.resources
|
||||
val statusBarId: Int =
|
||||
res.getIdentifier("status_bar", "id", "com.android.systemui")
|
||||
val statusBarContentsId: Int =
|
||||
@@ -260,32 +258,24 @@ object StatusBarLayout : HookRegister() {
|
||||
"id",
|
||||
"com.android.systemui"
|
||||
)
|
||||
val notificationIconAreaInnerId: Int =
|
||||
res.getIdentifier(
|
||||
"notification_icon_area_inner",
|
||||
"id",
|
||||
"com.android.systemui"
|
||||
)
|
||||
|
||||
statusBar = MiuiPhoneStatusBarView.findViewById(statusBarId)
|
||||
statusBar = miuiPhoneStatusBarView.findViewById(statusBarId)
|
||||
val statusBarContents: ViewGroup =
|
||||
MiuiPhoneStatusBarView.findViewById(statusBarContentsId)
|
||||
miuiPhoneStatusBarView.findViewById(statusBarContentsId)
|
||||
if (statusBar == null) return@hookAfter
|
||||
val clock: TextView = MiuiPhoneStatusBarView.findViewById(clockId)
|
||||
val clock: TextView = miuiPhoneStatusBarView.findViewById(clockId)
|
||||
val phoneStatusBarLeftContainer: ViewGroup =
|
||||
MiuiPhoneStatusBarView.findViewById(phoneStatusBarLeftContainerId)
|
||||
miuiPhoneStatusBarView.findViewById(phoneStatusBarLeftContainerId)
|
||||
val fullscreenNotificationIconArea: ViewGroup =
|
||||
MiuiPhoneStatusBarView.findViewById(fullscreenNotificationIconAreaId)
|
||||
miuiPhoneStatusBarView.findViewById(fullscreenNotificationIconAreaId)
|
||||
val systemIconArea: ViewGroup =
|
||||
MiuiPhoneStatusBarView.findViewById(systemIconAreaId)
|
||||
miuiPhoneStatusBarView.findViewById(systemIconAreaId)
|
||||
val statusIcons: ViewGroup =
|
||||
MiuiPhoneStatusBarView.findViewById(statusIconsId)
|
||||
miuiPhoneStatusBarView.findViewById(statusIconsId)
|
||||
val systemIcons: ViewGroup =
|
||||
MiuiPhoneStatusBarView.findViewById(systemIconsId)
|
||||
miuiPhoneStatusBarView.findViewById(systemIconsId)
|
||||
val battery: ViewGroup =
|
||||
MiuiPhoneStatusBarView.findViewById(batteryId)
|
||||
val notificationIconAreaInner: ViewGroup =
|
||||
MiuiPhoneStatusBarView.findViewById(notificationIconAreaInnerId)
|
||||
miuiPhoneStatusBarView.findViewById(batteryId)
|
||||
|
||||
(clock.parent as ViewGroup).removeView(clock)
|
||||
(phoneStatusBarLeftContainer.parent as ViewGroup).removeView(
|
||||
@@ -331,25 +321,25 @@ object StatusBarLayout : HookRegister() {
|
||||
|
||||
//增加一个左对齐布局
|
||||
mLeftLayout = LinearLayout(context)
|
||||
val LeftLp: LinearLayout.LayoutParams =
|
||||
val leftLp: LinearLayout.LayoutParams =
|
||||
LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.MATCH_PARENT, 1.0f)
|
||||
mLeftLayout!!.layoutParams = LeftLp
|
||||
mLeftLayout!!.layoutParams = leftLp
|
||||
mLeftLayout!!.gravity = Gravity.START or Gravity.CENTER_VERTICAL
|
||||
|
||||
//增加一个居中布局
|
||||
mCenterLayout = LinearLayout(context)
|
||||
val CenterLp: LinearLayout.LayoutParams = LinearLayout.LayoutParams(
|
||||
val centerLp: LinearLayout.LayoutParams = LinearLayout.LayoutParams(
|
||||
LinearLayout.LayoutParams.WRAP_CONTENT,
|
||||
LinearLayout.LayoutParams.MATCH_PARENT
|
||||
)
|
||||
mCenterLayout!!.layoutParams = CenterLp
|
||||
mCenterLayout!!.layoutParams = centerLp
|
||||
mCenterLayout!!.gravity = Gravity.CENTER or Gravity.CENTER_VERTICAL
|
||||
|
||||
//增加一个右布局
|
||||
mRightLayout = LinearLayout(context)
|
||||
val RightLp: LinearLayout.LayoutParams =
|
||||
val rightLp: LinearLayout.LayoutParams =
|
||||
LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.MATCH_PARENT, 1.0f)
|
||||
mRightLayout!!.layoutParams = RightLp
|
||||
mRightLayout!!.layoutParams = rightLp
|
||||
mRightLayout!!.gravity = Gravity.END or Gravity.CENTER_VERTICAL
|
||||
|
||||
|
||||
@@ -402,12 +392,11 @@ object StatusBarLayout : HookRegister() {
|
||||
findMethod("com.android.systemui.statusbar.phone.MiuiCollapsedStatusBarFragment") {
|
||||
name == "showClock" && parameterTypes[0] == Boolean::class.java
|
||||
}.hookAfter {
|
||||
val MiuiPhoneStatusBarView =
|
||||
XposedHelpers.getObjectField(it.thisObject, "mStatusBar") as ViewGroup
|
||||
val res = MiuiPhoneStatusBarView.resources
|
||||
val miuiPhoneStatusBarView = it.thisObject.getObjectAs<ViewGroup>("mStatusBar")
|
||||
val res = miuiPhoneStatusBarView.resources
|
||||
val status_bar_ID =
|
||||
res.getIdentifier("status_bar", "id", "com.android.systemui")
|
||||
val status_bar = MiuiPhoneStatusBarView.findViewById<ViewGroup>(status_bar_ID)
|
||||
val status_bar = miuiPhoneStatusBarView.findViewById<ViewGroup>(status_bar_ID)
|
||||
//非锁屏下整个状态栏布局
|
||||
val keyguardMgr =
|
||||
status_bar.context.getSystemService(Context.KEYGUARD_SERVICE) as KeyguardManager
|
||||
@@ -419,8 +408,6 @@ object StatusBarLayout : HookRegister() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import com.lt2333.simplicitytools.util.hasEnable
|
||||
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||
|
||||
object StatusBarNetworkSpeedRefreshSpeed : HookRegister() {
|
||||
|
||||
override fun init() {
|
||||
findMethod("com.android.systemui.statusbar.policy.NetworkSpeedController") {
|
||||
name == "postUpdateNetworkSpeedDelay" && parameterTypes[0] == Long::class.java
|
||||
@@ -15,4 +16,5 @@ object StatusBarNetworkSpeedRefreshSpeed : HookRegister() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -32,7 +32,7 @@ object StatusBarTimeCustomization : HookRegister() {
|
||||
private val isCenterAlign =
|
||||
XSPUtils.getBoolean("status_bar_time_double_line_center_align", false)
|
||||
private val getClockDoubleSize = XSPUtils.getInt("status_bar_clock_double_line_size", 0)
|
||||
private var nowTime: Date? = null
|
||||
private lateinit var nowTime: Date
|
||||
private var str = ""
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
@@ -74,7 +74,7 @@ object StatusBarTimeCustomization : HookRegister() {
|
||||
}
|
||||
}
|
||||
Timer().scheduleAtFixedRate(T(), 1000 - System.currentTimeMillis() % 1000, 1000)
|
||||
} catch (e: Exception) {
|
||||
} catch (_: Exception) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ object StatusBarTimeCustomization : HookRegister() {
|
||||
nowTime = Calendar.getInstance().time
|
||||
textV.text = getDate(c!!) + str + getTime(c!!, is24)
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
} catch (_: Exception) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,11 +100,11 @@ object StatusBarTimeCustomization : HookRegister() {
|
||||
findMethod("com.android.systemui.statusbar.phone.CollapsedStatusBarFragment") {
|
||||
name == "onViewCreated" && parameterCount == 2
|
||||
}.hookAfter {
|
||||
val MiuiPhoneStatusBarView =
|
||||
val miuiPhoneStatusBarView =
|
||||
it.thisObject.getObject("mStatusBar") as ViewGroup
|
||||
val res: Resources = MiuiPhoneStatusBarView.resources
|
||||
val res: Resources = miuiPhoneStatusBarView.resources
|
||||
val clockId: Int = res.getIdentifier("clock", "id", "com.android.systemui")
|
||||
val clock: TextView = MiuiPhoneStatusBarView.findViewById(clockId)
|
||||
val clock: TextView = miuiPhoneStatusBarView.findViewById(clockId)
|
||||
clock.gravity = Gravity.CENTER
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package com.lt2333.simplicitytools.hook.app.systemui
|
||||
|
||||
import com.github.kyuubiran.ezxhelper.utils.findMethod
|
||||
import com.github.kyuubiran.ezxhelper.utils.hookMethod
|
||||
import com.github.kyuubiran.ezxhelper.utils.hookAfter
|
||||
import com.github.kyuubiran.ezxhelper.utils.putObject
|
||||
import com.lt2333.simplicitytools.util.hasEnable
|
||||
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||
import de.robv.android.xposed.XposedHelpers
|
||||
|
||||
object WaveCharge: HookRegister() {
|
||||
|
||||
@@ -12,8 +12,7 @@ object WaveCharge: HookRegister() {
|
||||
hasEnable("enable_wave_charge_animation") {
|
||||
findMethod("com.android.keyguard.charge.ChargeUtils") {
|
||||
name == "supportWaveChargeAnimation"
|
||||
}.hookMethod {
|
||||
after { param ->
|
||||
}.hookAfter {
|
||||
val ex = Throwable()
|
||||
val stackElement = ex.stackTrace
|
||||
var mResult = false
|
||||
@@ -29,15 +28,12 @@ object WaveCharge: HookRegister() {
|
||||
}
|
||||
}
|
||||
}
|
||||
param.result = mResult
|
||||
}
|
||||
it.result = mResult
|
||||
}
|
||||
findMethod("com.android.keyguard.charge.wave.WaveView") {
|
||||
name == "updateWaveHeight"
|
||||
}.hookMethod {
|
||||
after { param ->
|
||||
XposedHelpers.setIntField(param.thisObject, "mWaveXOffset", 0)
|
||||
}
|
||||
}.hookAfter {
|
||||
it.thisObject.putObject("mWaveXOffset", 0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.lt2333.simplicitytools.util.hasEnable
|
||||
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||
|
||||
object RemoveAds : HookRegister() {
|
||||
|
||||
override fun init() {
|
||||
findMethod("com.android.thememanager.basemodule.ad.model.AdInfoResponse") {
|
||||
name == "isAdValid" && parameterCount == 1
|
||||
@@ -15,4 +16,5 @@ object RemoveAds : HookRegister() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -184,11 +184,17 @@ public class ShellUtils {
|
||||
*/
|
||||
public static class CommandResult {
|
||||
|
||||
/** result of command **/
|
||||
/**
|
||||
* result of command
|
||||
**/
|
||||
public int result;
|
||||
/** success message of command result **/
|
||||
/**
|
||||
* success message of command result
|
||||
**/
|
||||
public String successMsg;
|
||||
/** error message of command result **/
|
||||
/**
|
||||
* error message of command result
|
||||
**/
|
||||
public String errorMsg;
|
||||
|
||||
public CommandResult(int result) {
|
||||
|
||||
@@ -1,21 +1,23 @@
|
||||
package com.lt2333.simplicitytools.util
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
|
||||
object SystemProperties {
|
||||
@SuppressLint("PrivateApi")
|
||||
operator fun get(context: Context, key: String?): String? {
|
||||
var ret = ""
|
||||
try {
|
||||
val cl = context.classLoader
|
||||
val SystemProperties = cl.loadClass("android.os.SystemProperties")
|
||||
val systemProperties = cl.loadClass("android.os.SystemProperties")
|
||||
//参数类型
|
||||
val paramTypes: Array<Class<*>?> = arrayOfNulls(1)
|
||||
paramTypes[0] = String::class.java
|
||||
val get = SystemProperties.getMethod("get", *paramTypes)
|
||||
val get = systemProperties.getMethod("get", *paramTypes)
|
||||
//参数
|
||||
val params = arrayOfNulls<Any>(1)
|
||||
params[0] = key
|
||||
ret = get.invoke(SystemProperties, *params) as String
|
||||
ret = get.invoke(systemProperties, *params) as String
|
||||
} catch (iAE: IllegalArgumentException) {
|
||||
throw iAE
|
||||
} catch (e: Exception) {
|
||||
@@ -23,4 +25,5 @@ object SystemProperties {
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
}
|
||||
@@ -12,6 +12,7 @@ object XSPUtils {
|
||||
}
|
||||
return prefs.getBoolean(key, defValue)
|
||||
}
|
||||
|
||||
fun getInt(key: String, defValue: Int): Int {
|
||||
if (prefs.hasFileChanged()) {
|
||||
prefs.reload()
|
||||
@@ -34,7 +35,12 @@ object XSPUtils {
|
||||
}
|
||||
}
|
||||
|
||||
inline fun hasEnable(key: String, default: Boolean = false, noinline extraCondition: (() -> Boolean)? = null, crossinline block: () -> Unit) {
|
||||
inline fun hasEnable(
|
||||
key: String,
|
||||
default: Boolean = false,
|
||||
noinline extraCondition: (() -> Boolean)? = null,
|
||||
crossinline block: () -> Unit
|
||||
) {
|
||||
val conditionResult = if (extraCondition != null) extraCondition() else true
|
||||
if (XSPUtils.getBoolean(key, default) && conditionResult) {
|
||||
block()
|
||||
|
||||
@@ -5,20 +5,26 @@ import com.github.kyuubiran.ezxhelper.utils.Log.logexIfThrow
|
||||
import com.lt2333.simplicitytools.util.xposed.base.AppRegister
|
||||
import de.robv.android.xposed.IXposedHookLoadPackage
|
||||
import de.robv.android.xposed.IXposedHookZygoteInit
|
||||
import de.robv.android.xposed.XposedBridge
|
||||
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
||||
|
||||
abstract class EasyXposedInit : IXposedHookLoadPackage, IXposedHookZygoteInit {
|
||||
|
||||
private lateinit var packageParam: XC_LoadPackage.LoadPackageParam
|
||||
abstract val registeredApp: List<AppRegister>
|
||||
private val TAG = "WooBox"
|
||||
|
||||
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam?) {
|
||||
|
||||
packageParam = lpparam!!
|
||||
registeredApp.forEach { app ->
|
||||
if (app.packageName == lpparam.packageName && (lpparam.processName in app.processName || app.processName.isEmpty())) {
|
||||
EzXHelperInit.initHandleLoadPackage(lpparam)
|
||||
EzXHelperInit.setLogTag(app.logTag)
|
||||
EzXHelperInit.setToastTag(app.logTag)
|
||||
if (app.packageName == lpparam.packageName) {
|
||||
EzXHelperInit.apply {
|
||||
setLogXp(true)
|
||||
setLogTag(TAG)
|
||||
setToastTag(TAG)
|
||||
initHandleLoadPackage(lpparam)
|
||||
}
|
||||
runCatching { app.handleLoadPackage(lpparam) }.logexIfThrow("Failed call handleLoadPackage, package: ${app.packageName}")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,29 +1,26 @@
|
||||
package com.lt2333.simplicitytools.util.xposed.base
|
||||
|
||||
import com.github.kyuubiran.ezxhelper.utils.Log
|
||||
import com.github.kyuubiran.ezxhelper.utils.Log.logexIfThrow
|
||||
import de.robv.android.xposed.IXposedHookInitPackageResources
|
||||
import de.robv.android.xposed.IXposedHookLoadPackage
|
||||
import de.robv.android.xposed.callbacks.XC_InitPackageResources
|
||||
import de.robv.android.xposed.XposedBridge
|
||||
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
||||
|
||||
abstract class AppRegister: IXposedHookLoadPackage {
|
||||
|
||||
abstract val packageName: String
|
||||
abstract val processName: List<String>
|
||||
abstract val logTag: String
|
||||
|
||||
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {}
|
||||
|
||||
protected fun autoInitHooks(lpparam: XC_LoadPackage.LoadPackageParam, vararg hook: HookRegister) {
|
||||
hook.forEach {
|
||||
hook.also {
|
||||
XposedBridge.log("WooBox: Try to Hook [$packageName]")
|
||||
}.forEach {
|
||||
runCatching {
|
||||
if (it.isInit) return@forEach
|
||||
it.setLoadPackageParam(lpparam)
|
||||
it.init()
|
||||
it.isInit = true
|
||||
Log.i("Inited hook: ${it.javaClass.simpleName}")
|
||||
}.logexIfThrow("Failed init hook: ${it.javaClass.simpleName}")
|
||||
}.logexIfThrow("Failed to Hook [$packageName]")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.lt2333.simplicitytools.view
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.database.ContentObserver
|
||||
import android.net.Uri
|
||||
@@ -9,6 +10,7 @@ import android.os.Message
|
||||
import android.text.TextUtils
|
||||
import android.widget.TextView
|
||||
|
||||
@SuppressLint("ViewConstructor")
|
||||
class WeatherView(context: Context?, private val showCity: Boolean) : TextView(context) {
|
||||
|
||||
private val mContext: Context
|
||||
|
||||
Reference in New Issue
Block a user