优化代码

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

View File

@@ -523,17 +523,21 @@ 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 = val expandedNf =
ExpandableNotificationRowClass.clazz ExpandableNotificationRowClass.clazz
.method { name = "getStatusBarNotification" } .method { name = "getStatusBarNotification" }
.get(self).invoke<StatusBarNotification>() .get(NotificationViewWrapperClass.clazz.field { name = "mRow" }.get(instance).self)
.invoke<StatusBarNotification>()
/** 执行 Hook */ /** 执行 Hook */
hookNotifyIconOnSet(iconImageView.context, expandedNf, iconImageView) hookNotifyIconOnSet(iconImageView.context, expandedNf, iconImageView)
} }
@@ -544,4 +548,3 @@ class HookEntry : YukiHookXposedInitProxy {
} }
} }
} }
}