From 94cf128d1baa7d3ce7f6b2f338fc480bcba79a80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=84=95=E6=99=A8HChen?= <123531821+HChenX@users.noreply.github.com> Date: Sun, 29 Dec 2024 15:31:05 +0800 Subject: [PATCH] =?UTF-8?q?opt:=20=E4=BC=98=E5=8C=96=E6=8E=A7=E5=88=B6?= =?UTF-8?q?=E4=B8=AD=E5=BF=83=E5=A4=A7=E6=97=B6=E9=92=9F=E8=BF=87=E6=B8=A1?= =?UTF-8?q?=E5=8A=A8=E7=94=BB=20(#506)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lyric/hook/module/SystemUILyric.kt | 39 ++++++++++--------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/app/src/main/kotlin/statusbar/lyric/hook/module/SystemUILyric.kt b/app/src/main/kotlin/statusbar/lyric/hook/module/SystemUILyric.kt index 8700c7dd..1f94aeea 100644 --- a/app/src/main/kotlin/statusbar/lyric/hook/module/SystemUILyric.kt +++ b/app/src/main/kotlin/statusbar/lyric/hook/module/SystemUILyric.kt @@ -96,6 +96,7 @@ import statusbar.lyric.tools.Tools.isNull import statusbar.lyric.tools.Tools.isPad import statusbar.lyric.tools.Tools.isTargetView import statusbar.lyric.tools.Tools.observableChange +import statusbar.lyric.tools.Tools.setObjectField import statusbar.lyric.tools.Tools.shell import statusbar.lyric.tools.Tools.togglePrompts import statusbar.lyric.view.LyricSwitchView @@ -531,25 +532,27 @@ class SystemUILyric : BaseHook() { } } } + } - loadClassOrNull("com.android.systemui.controlcenter.shade.NotificationHeaderExpandController\$notificationCallback\$1").isNotNull { - it.methodFinder().filterByName("onExpansionChanged").first().createHook { - before { hook -> - if (isPlaying && !isHiding) { - val notificationHeaderExpandController = hook.thisObject.getObjectField("this\$0") - val headerController = notificationHeaderExpandController?.getObjectField("headerController") - val combinedHeaderController = headerController?.callMethod("get") - val notificationBigTime = combinedHeaderController?.getObjectField("notificationBigTime") as View - // val notificationDateTime = combinedHeaderController.getObjectField("notificationDateTime") as View - - val f = hook.args[0] as Float - if (f < 0.8f) - notificationBigTime.visibility = View.GONE - else - notificationBigTime.visibility = View.VISIBLE - - this@SystemUILyric.notificationBigTime = notificationBigTime - } + loadClassOrNull("com.android.systemui.controlcenter.shade.NotificationHeaderExpandController\$notificationCallback\$1").isNotNull { + it.methodFinder().filterByName("onExpansionChanged").first().createHook { + before { hook -> + if (isPlaying && !isHiding) { + val notificationHeaderExpandController = hook.thisObject.getObjectField("this\$0") + notificationHeaderExpandController?.setObjectField("bigTimeTranslationY", 0) + notificationHeaderExpandController?.setObjectField("notificationTranslationX", 0) + // notificationHeaderExpandController?.setObjectField("notificationTranslationY", 0) + + val notificationBigTime = notificationHeaderExpandController?.getObjectField("headerController") + ?.callMethod("get")?.getObjectField("notificationBigTime") as View + + val f = hook.args[0] as Float + if (f < 0.75f) + notificationBigTime.visibility = View.GONE + else + notificationBigTime.visibility = View.VISIBLE + + this@SystemUILyric.notificationBigTime = notificationBigTime } } }