Skip to content

Commit

Permalink
Update 2.5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
YuKongA committed Aug 25, 2024
1 parent 05fbec0 commit 596eae2
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 31 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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()) }
Expand Down
64 changes: 35 additions & 29 deletions app/src/main/kotlin/top/yukonga/mediaControlBlur/MainHook.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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 {
Expand Down

0 comments on commit 596eae2

Please sign in to comment.