mirror of
https://github.com/fankes/MIUINativeNotifyIcon.git
synced 2025-09-06 10:45:20 +08:00
优化代码
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'
|
||||||
}
|
}
|
||||||
|
@@ -107,15 +107,18 @@ class HookEntry : YukiHookXposedInitProxy {
|
|||||||
* @return [Boolean]
|
* @return [Boolean]
|
||||||
*/
|
*/
|
||||||
private val PackageParam.hasIgnoreStatusBarIconColor
|
private val PackageParam.hasIgnoreStatusBarIconColor
|
||||||
get() = NotificationUtilClass.clazz.hasMethod(name = "ignoreStatusBarIconColor", ExpandedNotificationClass.clazz)
|
get() = safeOfFalse {
|
||||||
|
NotificationUtilClass.clazz.hasMethod(name = "ignoreStatusBarIconColor", ExpandedNotificationClass.clazz)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取当前通知栏的样式
|
* 获取当前通知栏的样式
|
||||||
* @return [Boolean]
|
* @return [Boolean]
|
||||||
*/
|
*/
|
||||||
private fun PackageParam.isShowMiuiStyle() = safeOfFalse {
|
private val PackageParam.isShowMiuiStyle
|
||||||
NotificationUtilClass.clazz.method { name = "showMiuiStyle" }.get().invoke() ?: false
|
get() = safeOfFalse {
|
||||||
}
|
NotificationUtilClass.clazz.method { name = "showMiuiStyle" }.get().invoke() ?: false
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取 [ExpandedNotificationClass] 的应用名称
|
* 获取 [ExpandedNotificationClass] 的应用名称
|
||||||
@@ -416,7 +419,7 @@ class HookEntry : YukiHookXposedInitProxy {
|
|||||||
* 因为之前的 MIUI 版本的状态栏图标颜色会全部设置为白色的 - 找不到修复的地方就直接判断版本了
|
* 因为之前的 MIUI 版本的状态栏图标颜色会全部设置为白色的 - 找不到修复的地方就直接判断版本了
|
||||||
* 对于之前没有通知图标色彩判断功能的版本判断是 MIUI 样式就停止 Hook
|
* 对于之前没有通知图标色彩判断功能的版本判断是 MIUI 样式就停止 Hook
|
||||||
*/
|
*/
|
||||||
replaceAny { if (hasIgnoreStatusBarIconColor) false else isShowMiuiStyle() }
|
replaceAny { if (hasIgnoreStatusBarIconColor) false else isShowMiuiStyle }
|
||||||
}
|
}
|
||||||
if (hasIgnoreStatusBarIconColor)
|
if (hasIgnoreStatusBarIconColor)
|
||||||
injectMember {
|
injectMember {
|
||||||
@@ -449,7 +452,7 @@ class HookEntry : YukiHookXposedInitProxy {
|
|||||||
}
|
}
|
||||||
afterHook {
|
afterHook {
|
||||||
/** 对于之前没有通知图标色彩判断功能的版本判断是 MIUI 样式就停止 Hook */
|
/** 对于之前没有通知图标色彩判断功能的版本判断是 MIUI 样式就停止 Hook */
|
||||||
if (hasIgnoreStatusBarIconColor || !isShowMiuiStyle())
|
if (hasIgnoreStatusBarIconColor || !isShowMiuiStyle)
|
||||||
(globalContext ?: args[0] as Context).also { context ->
|
(globalContext ?: args[0] as Context).also { context ->
|
||||||
hookSmallIconOnSet(
|
hookSmallIconOnSet(
|
||||||
context = context,
|
context = context,
|
||||||
@@ -507,7 +510,7 @@ class HookEntry : YukiHookXposedInitProxy {
|
|||||||
method { name = "handleHeaderViews" }
|
method { name = "handleHeaderViews" }
|
||||||
afterHook {
|
afterHook {
|
||||||
/** 对于之前没有通知图标色彩判断功能的版本判断是 MIUI 样式就停止 Hook */
|
/** 对于之前没有通知图标色彩判断功能的版本判断是 MIUI 样式就停止 Hook */
|
||||||
if (!hasIgnoreStatusBarIconColor && isShowMiuiStyle()) return@afterHook
|
if (!hasIgnoreStatusBarIconColor && isShowMiuiStyle) return@afterHook
|
||||||
|
|
||||||
/** 获取小图标 */
|
/** 获取小图标 */
|
||||||
val iconImageView =
|
val iconImageView =
|
||||||
|
Reference in New Issue
Block a user