尝试修复反色异常,并以small图标为基准。 (#218)

This commit is contained in:
李太白
2024-12-08 19:43:06 +08:00
committed by GitHub
parent 4dcb05797c
commit 6d62c02b42

View File

@@ -944,18 +944,18 @@ object SystemUIHooker : YukiBaseHooker() {
param(ExpandedNotificationClass)
}
}.hook().after {
globalContext?.also { context ->
(globalContext ?: args().first().cast())?.also { context ->
val expandedNf = args().first().cast<StatusBarNotification?>()
val small = expandedNf?.notification?.smallIcon?.loadDrawable(context)
val icon = small?.toBitmap()
/** Hook 状态栏小图标 */
compatStatusIcon(
context = context,
nf = expandedNf,
iconDrawable = result<Icon>()?.loadDrawable(context)
).also { pair ->
if (!pair.second) return@after
val bitmap = pair.first?.toBitmap()?.replaceColor(Color.WHITE, Color.BLACK, tolerance = 210)
result = Icon.createWithBitmap(bitmap)
}
iconDrawable = icon?.toDrawable(context.resources)
).also { pair -> if (!pair.second) return@after
val bitmap = pair.first?.toBitmap()?.replaceColor(Color.WHITE, Color.BLACK, tolerance = 90)
result = Icon.createWithBitmap(bitmap)}
}
}
method {
@@ -969,14 +969,16 @@ object SystemUIHooker : YukiBaseHooker() {
}.hook().after {
(globalContext ?: args().first().cast())?.also { context ->
val expandedNf = args(0).cast<StatusBarNotification?>()
val small = expandedNf?.notification?.smallIcon?.loadDrawable(context)
val icon = small?.toBitmap()
/** Hook 状态栏小图标 */
compatStatusIcon(
context = context,
nf = expandedNf,
iconDrawable = result<Icon>()?.loadDrawable(context)
).also { pair ->
if (pair.second) result = Icon.createWithBitmap(pair.first?.toBitmap())
}
iconDrawable = icon?.toDrawable(context.resources)
).also { pair -> if (!pair.second) return@after
val bitmap = pair.first?.toBitmap()?.replaceColor(Color.BLACK, Color.WHITE, tolerance = 90)
result = Icon.createWithBitmap(bitmap)}
}
}
}