mirror of
https://github.com/fankes/MIUINativeNotifyIcon.git
synced 2025-09-05 18:25:23 +08:00
尝试修复反色异常,并以small图标为基准。 (#218)
This commit is contained in:
@@ -944,18 +944,18 @@ object SystemUIHooker : YukiBaseHooker() {
|
|||||||
param(ExpandedNotificationClass)
|
param(ExpandedNotificationClass)
|
||||||
}
|
}
|
||||||
}.hook().after {
|
}.hook().after {
|
||||||
globalContext?.also { context ->
|
(globalContext ?: args().first().cast())?.also { context ->
|
||||||
val expandedNf = args().first().cast<StatusBarNotification?>()
|
val expandedNf = args().first().cast<StatusBarNotification?>()
|
||||||
|
val small = expandedNf?.notification?.smallIcon?.loadDrawable(context)
|
||||||
|
val icon = small?.toBitmap()
|
||||||
/** Hook 状态栏小图标 */
|
/** Hook 状态栏小图标 */
|
||||||
compatStatusIcon(
|
compatStatusIcon(
|
||||||
context = context,
|
context = context,
|
||||||
nf = expandedNf,
|
nf = expandedNf,
|
||||||
iconDrawable = result<Icon>()?.loadDrawable(context)
|
iconDrawable = icon?.toDrawable(context.resources)
|
||||||
).also { pair ->
|
).also { pair -> if (!pair.second) return@after
|
||||||
if (!pair.second) return@after
|
val bitmap = pair.first?.toBitmap()?.replaceColor(Color.WHITE, Color.BLACK, tolerance = 90)
|
||||||
val bitmap = pair.first?.toBitmap()?.replaceColor(Color.WHITE, Color.BLACK, tolerance = 210)
|
result = Icon.createWithBitmap(bitmap)}
|
||||||
result = Icon.createWithBitmap(bitmap)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
method {
|
method {
|
||||||
@@ -969,14 +969,16 @@ object SystemUIHooker : YukiBaseHooker() {
|
|||||||
}.hook().after {
|
}.hook().after {
|
||||||
(globalContext ?: args().first().cast())?.also { context ->
|
(globalContext ?: args().first().cast())?.also { context ->
|
||||||
val expandedNf = args(0).cast<StatusBarNotification?>()
|
val expandedNf = args(0).cast<StatusBarNotification?>()
|
||||||
|
val small = expandedNf?.notification?.smallIcon?.loadDrawable(context)
|
||||||
|
val icon = small?.toBitmap()
|
||||||
/** Hook 状态栏小图标 */
|
/** Hook 状态栏小图标 */
|
||||||
compatStatusIcon(
|
compatStatusIcon(
|
||||||
context = context,
|
context = context,
|
||||||
nf = expandedNf,
|
nf = expandedNf,
|
||||||
iconDrawable = result<Icon>()?.loadDrawable(context)
|
iconDrawable = icon?.toDrawable(context.resources)
|
||||||
).also { pair ->
|
).also { pair -> if (!pair.second) return@after
|
||||||
if (pair.second) result = Icon.createWithBitmap(pair.first?.toBitmap())
|
val bitmap = pair.first?.toBitmap()?.replaceColor(Color.BLACK, Color.WHITE, tolerance = 90)
|
||||||
}
|
result = Icon.createWithBitmap(bitmap)}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user