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