From d943aa61845177642d6e74c03c113d4b8a6b87bc Mon Sep 17 00:00:00 2001 From: Fankesyooni Date: Mon, 28 Mar 2022 01:20:38 +0800 Subject: [PATCH] Merge code --- .../miui/notify/hook/entity/SystemUIHooker.kt | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/com/fankes/miui/notify/hook/entity/SystemUIHooker.kt b/app/src/main/java/com/fankes/miui/notify/hook/entity/SystemUIHooker.kt index fe26411..fc211dd 100644 --- a/app/src/main/java/com/fankes/miui/notify/hook/entity/SystemUIHooker.kt +++ b/app/src/main/java/com/fankes/miui/notify/hook/entity/SystemUIHooker.kt @@ -367,14 +367,13 @@ class SystemUIHooker : YukiBaseHooker() { private fun compatCustomIcon(isGrayscaleIcon: Boolean, packageName: String): Pair { var customPair: Pair? = null if (prefs.get(DataConst.ENABLE_NOTIFY_ICON_FIX)) run { - if (iconDatas.isNotEmpty()) - iconDatas.forEach { - if (packageName == it.packageName && isAppNotifyHookOf(it)) { - if (isGrayscaleIcon.not() || isAppNotifyHookAllOf(it)) - customPair = Pair(it.iconBitmap, it.iconColor) - return@run - } + iconDatas.takeIf { it.isNotEmpty() }?.forEach { + if (packageName == it.packageName && isAppNotifyHookOf(it)) { + if (isGrayscaleIcon.not() || isAppNotifyHookAllOf(it)) + customPair = Pair(it.iconBitmap, it.iconColor) + return@run } + } } return customPair ?: Pair(null, 0) }