优化代码

This commit is contained in:
2022-02-18 04:10:17 +08:00
parent 7b4b728523
commit 4e5e2cee09

View File

@@ -523,20 +523,23 @@ class HookEntry : YukiHookXposedInitProxy {
afterHook { afterHook {
/** 对于之前没有通知图标色彩判断功能的版本判断是 MIUI 样式就停止 Hook */ /** 对于之前没有通知图标色彩判断功能的版本判断是 MIUI 样式就停止 Hook */
if (!hasIgnoreStatusBarIconColor() && isShowMiuiStyle()) return@afterHook if (!hasIgnoreStatusBarIconColor() && isShowMiuiStyle()) return@afterHook
/** 获取小图标 */ /** 获取小图标 */
val iconImageView = val iconImageView =
NotificationHeaderViewWrapperClass.clazz NotificationHeaderViewWrapperClass.clazz
.field { name = "mIcon" }.of<ImageView>(instance) ?: return@afterHook .field { name = "mIcon" }.of<ImageView>(instance) ?: return@afterHook
/** 从父类中得到 mRow 变量 - [ExpandableNotificationRowClass] */
NotificationViewWrapperClass.clazz.field { name = "mRow" }.get(instance).apply { /**
/** 获取其中的得到通知方法 */ * 从父类中得到 mRow 变量 - [ExpandableNotificationRowClass]
val expandedNf = * 获取其中的得到通知方法
ExpandableNotificationRowClass.clazz */
.method { name = "getStatusBarNotification" } val expandedNf =
.get(self).invoke<StatusBarNotification>() ExpandableNotificationRowClass.clazz
/** 执行 Hook */ .method { name = "getStatusBarNotification" }
hookNotifyIconOnSet(iconImageView.context, expandedNf, iconImageView) .get(NotificationViewWrapperClass.clazz.field { name = "mRow" }.get(instance).self)
} .invoke<StatusBarNotification>()
/** 执行 Hook */
hookNotifyIconOnSet(iconImageView.context, expandedNf, iconImageView)
} }
} }
} }