mirror of
https://github.com/fankes/ColorOSNotifyIcon.git
synced 2025-09-06 18:55:37 +08:00
优化深色模式的 Android 12 通知图标颜色
This commit is contained in:
@@ -30,7 +30,7 @@ android {
|
|||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
release {
|
release {
|
||||||
minifyEnabled true
|
minifyEnabled false
|
||||||
signingConfig signingConfigs.debug
|
signingConfig signingConfigs.debug
|
||||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||||
}
|
}
|
||||||
|
@@ -230,18 +230,24 @@ class HookEntry : YukiHookXposedInitProxy {
|
|||||||
val oldStyle = (if (context.isSystemInDarkMode) 0xffdcdcdc else 0xff707173).toInt()
|
val oldStyle = (if (context.isSystemInDarkMode) 0xffdcdcdc else 0xff707173).toInt()
|
||||||
|
|
||||||
/** 新版风格 */
|
/** 新版风格 */
|
||||||
val newStyle = (if (context.isSystemInDarkMode) 0xff2d2d2d else Color.WHITE).toInt()
|
val newStyle = (if (context.isSystemInDarkMode) 0xffdcdcdc else Color.WHITE).toInt()
|
||||||
|
|
||||||
/** 图标着色 */
|
/** 优化风格 */
|
||||||
val applyColor = customPair.second.takeIf { it != 0 } ?: iconColor.takeIf { it != 0 } ?: oldStyle
|
val fixStyle = (if (context.isSystemInDarkMode) 0xff707173 else oldStyle).toInt()
|
||||||
|
|
||||||
|
/** 旧版图标着色 */
|
||||||
|
val oldApplyColor = customPair.second.takeIf { it != 0 } ?: iconColor.takeIf { it != 0 } ?: oldStyle
|
||||||
|
|
||||||
|
/** 新版图标着色 */
|
||||||
|
val newApplyColor = customPair.second.takeIf { it != 0 } ?: iconColor.takeIf { it != 0 } ?: fixStyle
|
||||||
/** 判断风格并开始 Hook */
|
/** 判断风格并开始 Hook */
|
||||||
if (isA12Style) {
|
if (isA12Style) {
|
||||||
background = DrawableBuilder().rounded().solidColor(applyColor).build()
|
background = DrawableBuilder().rounded().solidColor(newApplyColor).build()
|
||||||
setColorFilter(if (isA12Style) newStyle else oldStyle)
|
setColorFilter(newStyle)
|
||||||
setPadding(2.dp(context), 2.dp(context), 2.dp(context), 2.dp(context))
|
setPadding(2.dp(context), 2.dp(context), 2.dp(context), 2.dp(context))
|
||||||
} else {
|
} else {
|
||||||
background = null
|
background = null
|
||||||
setColorFilter(applyColor)
|
setColorFilter(oldApplyColor)
|
||||||
setPadding(0, 0, 0, 0)
|
setPadding(0, 0, 0, 0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user