mirror of
https://github.com/fankes/MIUINativeNotifyIcon.git
synced 2025-09-05 18:25:23 +08:00
fix: some problem in MIUI 14 (14.0.4) Android 14
This commit is contained in:
@@ -732,9 +732,9 @@ object SystemUIHooker : YukiBaseHooker() {
|
|||||||
*/
|
*/
|
||||||
private fun Any?.getSbn() =
|
private fun Any?.getSbn() =
|
||||||
ExpandableNotificationRowClass
|
ExpandableNotificationRowClass
|
||||||
.method { name = "getEntry" }
|
.field { name = "mEntry" }
|
||||||
.get(this).call()
|
.get(this)
|
||||||
?.current(ignored = true)
|
.current(ignored = true)
|
||||||
?.field { name = "mSbn" }
|
?.field { name = "mSbn" }
|
||||||
?.cast<StatusBarNotification>()
|
?.cast<StatusBarNotification>()
|
||||||
?: ExpandableNotificationRowClass
|
?: ExpandableNotificationRowClass
|
||||||
@@ -843,30 +843,34 @@ object SystemUIHooker : YukiBaseHooker() {
|
|||||||
param { it[0] extends StatusBarNotificationClass }
|
param { it[0] extends StatusBarNotificationClass }
|
||||||
}.hookAll().replaceToFalse()
|
}.hookAll().replaceToFalse()
|
||||||
var isUseLegacy = false
|
var isUseLegacy = false
|
||||||
/** 强制回写系统的状态栏图标样式为原生 */
|
/**
|
||||||
method {
|
* 强制回写系统的状态栏图标样式为原生
|
||||||
name = "getSmallIcon"
|
* 部分系统没有 "getSmallIcon" 这个方法 - 所以直接忽略
|
||||||
param { it[0] extends StatusBarNotificationClass && it[1] == IntType }
|
*/
|
||||||
}.remedys {
|
if (hasMethod { name = "getSmallIcon" })
|
||||||
method {
|
method {
|
||||||
name = "getSmallIcon"
|
name = "getSmallIcon"
|
||||||
param(ExpandedNotificationClass)
|
param { it[0] extends StatusBarNotificationClass && it[1] == IntType }
|
||||||
|
}.remedys {
|
||||||
|
method {
|
||||||
|
name = "getSmallIcon"
|
||||||
|
param(ExpandedNotificationClass)
|
||||||
|
}
|
||||||
|
method {
|
||||||
|
name = "getSmallIcon"
|
||||||
|
param(ContextClass, ExpandedNotificationClass)
|
||||||
|
}.onFind { isUseLegacy = true }
|
||||||
|
}.hook().after {
|
||||||
|
(globalContext ?: args().first().cast())?.also { context ->
|
||||||
|
val expandedNf = args(if (isUseLegacy) 1 else 0).cast<StatusBarNotification?>()
|
||||||
|
/** Hook 状态栏小图标 */
|
||||||
|
compatStatusIcon(
|
||||||
|
context = context,
|
||||||
|
nf = expandedNf,
|
||||||
|
iconDrawable = result<Icon>()?.loadDrawable(context)
|
||||||
|
).also { pair -> if (pair.second) result = Icon.createWithBitmap(pair.first?.toBitmap()) }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
method {
|
|
||||||
name = "getSmallIcon"
|
|
||||||
param(ContextClass, ExpandedNotificationClass)
|
|
||||||
}.onFind { isUseLegacy = true }
|
|
||||||
}.hook().after {
|
|
||||||
(globalContext ?: args().first().cast())?.also { context ->
|
|
||||||
val expandedNf = args(if (isUseLegacy) 1 else 0).cast<StatusBarNotification?>()
|
|
||||||
/** Hook 状态栏小图标 */
|
|
||||||
compatStatusIcon(
|
|
||||||
context = context,
|
|
||||||
nf = expandedNf,
|
|
||||||
iconDrawable = result<Icon>()?.loadDrawable(context)
|
|
||||||
).also { pair -> if (pair.second) result = Icon.createWithBitmap(pair.first?.toBitmap()) }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
/** 注入状态栏通知图标实例 */
|
/** 注入状态栏通知图标实例 */
|
||||||
StatusBarIconViewClass.method {
|
StatusBarIconViewClass.method {
|
||||||
|
Reference in New Issue
Block a user