mirror of
https://github.com/fankes/MIUINativeNotifyIcon.git
synced 2025-09-05 10:15:31 +08:00
强制修改 getCustomAppIcon 获取的图标为 smallIcon,同时清理错误提交的代码 (#216)
* 强制修改 getCustomAppIcon 获取的图标为 smallIcon,同时清理错误提交的代码 * Resources.getSystem 换成 ct.resources
This commit is contained in:
@@ -886,11 +886,32 @@ object SystemUIHooker : YukiBaseHooker() {
|
|||||||
param { it[0] extends StatusBarNotificationClass }
|
param { it[0] extends StatusBarNotificationClass }
|
||||||
}.hookAll().replaceToFalse()
|
}.hookAll().replaceToFalse()
|
||||||
var isUseLegacy = false
|
var isUseLegacy = false
|
||||||
|
/**
|
||||||
|
* 强制修改 getCustomAppIcon 获取的图标为 smallIcon
|
||||||
|
* 部分系统没有 "getCustomAppIcon" 这个方法 - 所以直接忽略
|
||||||
|
*/
|
||||||
|
if (hasMethod { name = "getCustomAppIcon" }){
|
||||||
|
method{
|
||||||
|
name = "getCustomAppIcon"
|
||||||
|
param(NotificationClass, ContextClass)
|
||||||
|
}.hook().after {
|
||||||
|
val nf = args(0).cast<Notification>()
|
||||||
|
val ct = args(1).cast<Context>()
|
||||||
|
val smail = nf?.smallIcon?.loadDrawable(ct)?.toBitmap()
|
||||||
|
if (smail != null && !smail.isRecycled) {
|
||||||
|
if (ct != null) {
|
||||||
|
result = BitmapDrawable(ct.resources, smail)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
result = null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 强制回写系统的状态栏图标样式为原生
|
* 强制回写系统的状态栏图标样式为原生
|
||||||
* 部分系统没有 "getSmallIcon" 这个方法 - 所以直接忽略
|
* 部分系统没有 "getSmallIcon" 这个方法 - 所以直接忽略
|
||||||
*/
|
*/
|
||||||
if (hasMethod { name = "getSmallIcon" })
|
if (hasMethod { name = "getSmallIcon" }){
|
||||||
method {
|
method {
|
||||||
name = "getSmallIcon"
|
name = "getSmallIcon"
|
||||||
param { it[0] extends StatusBarNotificationClass && it[1] == IntType }
|
param { it[0] extends StatusBarNotificationClass && it[1] == IntType }
|
||||||
@@ -899,10 +920,6 @@ object SystemUIHooker : YukiBaseHooker() {
|
|||||||
name = "getSmallIcon"
|
name = "getSmallIcon"
|
||||||
param(ExpandedNotificationClass)
|
param(ExpandedNotificationClass)
|
||||||
}
|
}
|
||||||
method {
|
|
||||||
name = "getSmallIcon"
|
|
||||||
param { it[0] == ContextClass && it[1] extends SystemUIApplicationClass && it[2] == IntType && it[3] == BooleanType }
|
|
||||||
}
|
|
||||||
method {
|
method {
|
||||||
name = "getSmallIcon"
|
name = "getSmallIcon"
|
||||||
param { it[0] == ContextClass && it[1] extends StatusBarNotificationClass }
|
param { it[0] == ContextClass && it[1] extends StatusBarNotificationClass }
|
||||||
@@ -919,6 +936,7 @@ object SystemUIHooker : YukiBaseHooker() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/** 去他妈的焦点通知彩色图标 */
|
/** 去他妈的焦点通知彩色图标 */
|
||||||
FocusUtils?.apply {
|
FocusUtils?.apply {
|
||||||
method {
|
method {
|
||||||
|
Reference in New Issue
Block a user