Skip to content
This repository was archived by the owner on May 29, 2025. It is now read-only.

Commit 6f012bd

Browse files
committed
fix: 隐藏通知图标 on HyperOS2.0
1 parent a3dcb0e commit 6f012bd

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

app/src/main/kotlin/statusbar/lyric/hook/module/SystemUILyric.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ class SystemUILyric : BaseHook() {
137137
}
138138
private var canLoad: Boolean = true
139139
private var isScreenLocked: Boolean = false
140+
private var statusBarShowing: Boolean = true
140141
private var iconSwitch: Boolean = config.iconSwitch
141142

142143
@Volatile
@@ -161,9 +162,6 @@ class SystemUILyric : BaseHook() {
161162
private lateinit var targetView: ViewGroup
162163

163164

164-
private var statusBarShowing: Boolean = true
165-
166-
167165
private val lyricView: LyricSwitchView by lazy {
168166
object : LyricSwitchView(context) {
169167
override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) {
@@ -215,8 +213,8 @@ class SystemUILyric : BaseHook() {
215213
//////////////////////////////Hook//////////////////////////////////////
216214
private var defaultDisplay: Any? = null
217215
private var centralSurfacesImpl: Any? = null
218-
private var notificationIconArea: View? = null
219216
private var statusBatteryContainer: View? = null
217+
var notificationIconArea: View? = null
220218

221219
override fun init() {
222220
"Initializing Hook".log()
@@ -287,6 +285,7 @@ class SystemUILyric : BaseHook() {
287285
}
288286
}
289287

288+
// 限制可见性更改
290289
if (config.limitVisibilityChange) {
291290
moduleRes.getString(R.string.limit_visibility_change).log()
292291
View::class.java.methodFinder().filterByName("setVisibility").single().createHook {
@@ -321,6 +320,7 @@ class SystemUILyric : BaseHook() {
321320
}
322321
}
323322

323+
// 隐藏通知图标
324324
if (config.hideNotificationIcon) {
325325
moduleRes.getString(R.string.hide_notification_icon).log()
326326
fun HookFactory.hideNoticeIcon(mode: Int) {

app/src/main/kotlin/statusbar/lyric/hook/module/xiaomi/XiaomiHooks.kt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,18 @@ class XiaomiHooks {
101101
}
102102
}
103103

104+
// 隐藏通知图标
105+
if (config.hideNotificationIcon) {
106+
loadClassOrNull("com.android.systemui.statusbar.phone.NotificationIconContainer").isNotNull {
107+
it.methodFinder().filterByName("onLayout").single().createHook {
108+
after {
109+
if (systemUILyric.notificationIconArea != null) return@after
110+
systemUILyric.notificationIconArea = it.thisObject as View
111+
}
112+
}
113+
}
114+
}
115+
104116
// 隐藏小米网络速度
105117
if (config.mMiuiHideNetworkSpeed) {
106118
moduleRes.getString(R.string.miui_hide_network_speed).log()

0 commit comments

Comments
 (0)