From 596eae233c547d0ca3dd249887d9945af25c0bb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BD=99=E7=A9=BA?= <70465933+YuKongA@users.noreply.github.com> Date: Sun, 25 Aug 2024 19:32:36 +0800 Subject: [PATCH] Update 2.5.1 --- app/build.gradle.kts | 4 +- .../top/yukonga/mediaControlBlur/MainHook.kt | 64 ++++++++++--------- 2 files changed, 37 insertions(+), 31 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 01083fd..7c339a9 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -15,8 +15,8 @@ android { applicationId = namespace minSdk = 34 targetSdk = 35 - versionCode = 2500 - versionName = "2.5.0" + versionCode = 2510 + versionName = "2.5.1" } val properties = Properties() runCatching { properties.load(project.rootProject.file("local.properties").inputStream()) } diff --git a/app/src/main/kotlin/top/yukonga/mediaControlBlur/MainHook.kt b/app/src/main/kotlin/top/yukonga/mediaControlBlur/MainHook.kt index f6b788c..59e4867 100644 --- a/app/src/main/kotlin/top/yukonga/mediaControlBlur/MainHook.kt +++ b/app/src/main/kotlin/top/yukonga/mediaControlBlur/MainHook.kt @@ -179,6 +179,41 @@ class MainHook : IXposedHookLoadPackage { } } + playerTwoCircleView?.constructors?.forEach { constructor -> + constructor.createAfterHook { + val context = AndroidAppHelper.currentApplication().applicationContext + + val miuiStubClass = loadClassOrNull("miui.stub.MiuiStub") + val miuiStubInstance = XposedHelpers.getStaticObjectField(miuiStubClass, "INSTANCE") + val mSysUIProvider = XposedHelpers.getObjectField(miuiStubInstance, "mSysUIProvider") + val mStatusBarStateController = XposedHelpers.getObjectField(mSysUIProvider, "mStatusBarStateController") + val getLazyClass = XposedHelpers.callMethod(mStatusBarStateController, "get") + val getState = XposedHelpers.callMethod(getLazyClass, "getState") + + + (it.thisObject as ImageView).setMiViewBlurMode(BACKGROUND) + (it.thisObject as ImageView).setBlurRoundRect(getNotificationElementRoundRect(context)) + (it.thisObject as ImageView).apply { + getNotificationElementBlendColors(context, getState == 1)?.let { iArr -> setMiBackgroundBlendColors(iArr, 1f) } + } + + statusBarStateControllerImpl?.methodFinder()?.filterByName("getState")?.first()?.createAfterHook { hookParam1 -> + val getStatusBarState = hookParam1.result as Int + val isInLockScreen = getStatusBarState == 1 + val isDarkMode = isDarkMode(context) + if (lockScreenStatus == null || darkModeStatus == null || lockScreenStatus != isInLockScreen || darkModeStatus != isDarkMode) { + if (BuildConfig.DEBUG) Log.dx("getStatusBarState: $getStatusBarState") + if (BuildConfig.DEBUG) Log.dx("darkModeStatus: $isDarkMode") + lockScreenStatus = isInLockScreen + darkModeStatus = isDarkMode + (it.thisObject as ImageView).apply { + getNotificationElementBlendColors(context, isInLockScreen)?.let { iArr -> setMiBackgroundBlendColors(iArr, 1f) } + } + } + } + } + } + playerTwoCircleView?.methodFinder()?.filterByName("onDraw")?.first()?.createBeforeHook { val context = AndroidAppHelper.currentApplication().applicationContext @@ -194,35 +229,6 @@ class MainHook : IXposedHookLoadPackage { mPaint1?.alpha = 0 mPaint2?.alpha = 0 it.thisObject.objectHelper().setObject("mRadius", 0f) - - (it.thisObject as ImageView).setMiViewBlurMode(BACKGROUND) - (it.thisObject as ImageView).setBlurRoundRect(getNotificationElementRoundRect(context)) - - val miuiStubClass = loadClassOrNull("miui.stub.MiuiStub") - val miuiStubInstance = XposedHelpers.getStaticObjectField(miuiStubClass, "INSTANCE") - val mSysUIProvider = XposedHelpers.getObjectField(miuiStubInstance, "mSysUIProvider") - val mStatusBarStateController = XposedHelpers.getObjectField(mSysUIProvider, "mStatusBarStateController") - val getLazyClass = XposedHelpers.callMethod(mStatusBarStateController, "get") - val getState = XposedHelpers.callMethod(getLazyClass, "getState") - - (it.thisObject as ImageView).apply { - getNotificationElementBlendColors(context, getState == 1)?.let { iArr -> setMiBackgroundBlendColors(iArr, 1f) } - } - - statusBarStateControllerImpl?.methodFinder()?.filterByName("getState")?.first()?.createAfterHook { hookParam1 -> - val getStatusBarState = hookParam1.result as Int - val isInLockScreen = getStatusBarState == 1 - val isDarkMode = isDarkMode(context) - if (lockScreenStatus == null || darkModeStatus == null || lockScreenStatus != isInLockScreen || darkModeStatus != isDarkMode) { - if (BuildConfig.DEBUG) Log.dx("getStatusBarState: $getStatusBarState") - if (BuildConfig.DEBUG) Log.dx("darkModeStatus: $isDarkMode") - lockScreenStatus = isInLockScreen - darkModeStatus = isDarkMode - (it.thisObject as ImageView).apply { - getNotificationElementBlendColors(context, isInLockScreen)?.let { iArr -> setMiBackgroundBlendColors(iArr, 1f) } - } - } - } } playerTwoCircleView?.methodFinder()?.filterByName("setBackground")?.first()?.createBeforeHook {