mirror of
https://github.com/fankes/MIUINativeNotifyIcon.git
synced 2025-09-06 02:35:32 +08:00
Update YukiHookAPI
This commit is contained in:
@@ -38,17 +38,17 @@ android {
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled true
|
||||
minifyEnabled false
|
||||
signingConfig signingConfigs.debug
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
sourceCompatibility JavaVersion.VERSION_11
|
||||
targetCompatibility JavaVersion.VERSION_11
|
||||
}
|
||||
kotlinOptions {
|
||||
jvmTarget = '1.8'
|
||||
jvmTarget = '11'
|
||||
}
|
||||
buildFeatures {
|
||||
viewBinding true
|
||||
@@ -72,8 +72,8 @@ tasks.whenTaskAdded {
|
||||
|
||||
dependencies {
|
||||
compileOnly 'de.robv.android.xposed:api:82'
|
||||
implementation 'com.highcapable.yukihookapi:api:1.0.67'
|
||||
ksp 'com.highcapable.yukihookapi:ksp-xposed:1.0.67'
|
||||
implementation 'com.highcapable.yukihookapi:api:1.0.68'
|
||||
ksp 'com.highcapable.yukihookapi:ksp-xposed:1.0.68'
|
||||
implementation "com.github.topjohnwu.libsu:core:3.1.2"
|
||||
implementation 'androidx.annotation:annotation:1.3.0'
|
||||
implementation 'com.geyifeng.immersionbar:immersionbar:3.2.0'
|
||||
|
@@ -232,7 +232,7 @@ class SystemUIHooker : YukiBaseHooker() {
|
||||
}.get(it.method {
|
||||
name = "getInstance"
|
||||
param(ContextClass)
|
||||
}.get().invoke(context)).callBoolean(drawable)
|
||||
}.get().invoke(context)).boolean(drawable)
|
||||
}
|
||||
} else BitmapCompatTool.isGrayscaleDrawable(drawable)
|
||||
|
||||
@@ -359,7 +359,7 @@ class SystemUIHooker : YukiBaseHooker() {
|
||||
StatusBarIconViewClass.clazz.field { name = "mNotification" }.also { result ->
|
||||
statusBarIconViews.takeIf { it.isNotEmpty() }?.forEach {
|
||||
/** 得到通知实例 */
|
||||
val nf = result.of<StatusBarNotification>(it) ?: return
|
||||
val nf = result.get(it).cast<StatusBarNotification>() ?: return
|
||||
/** 刷新状态栏图标 */
|
||||
compatStatusIcon(it.context, nf, nf.notification.smallIcon.loadDrawable(it.context)).also { pair ->
|
||||
pair.first.let { e -> it.setImageDrawable(e) }
|
||||
@@ -591,7 +591,7 @@ class SystemUIHooker : YukiBaseHooker() {
|
||||
isExpanded = ExpandableNotificationRowClass.clazz.method {
|
||||
name = "isExpanded"
|
||||
returnType = BooleanType
|
||||
}.get(it).callBoolean()
|
||||
}.get(it).boolean()
|
||||
}).call()?.let {
|
||||
it.javaClass.method {
|
||||
name = "getSbn"
|
||||
@@ -662,7 +662,7 @@ class SystemUIHooker : YukiBaseHooker() {
|
||||
}
|
||||
afterHook {
|
||||
(globalContext ?: firstArgs())?.also { context ->
|
||||
val expandedNf = args(if (isUseLegacy) 1 else 0).of<StatusBarNotification?>()
|
||||
val expandedNf = args(if (isUseLegacy) 1 else 0).cast<StatusBarNotification?>()
|
||||
/** Hook 状态栏小图标 */
|
||||
compatStatusIcon(
|
||||
context = context,
|
||||
@@ -681,7 +681,7 @@ class SystemUIHooker : YukiBaseHooker() {
|
||||
afterHook {
|
||||
instance<ImageView>().also {
|
||||
if (hasIgnoreStatusBarIconColor(it.context, field { name = "mNotification" }
|
||||
.of<StatusBarNotification>(instance))) it.apply {
|
||||
.get(instance).cast<StatusBarNotification>())) it.apply {
|
||||
alpha = 1f
|
||||
colorFilter = null
|
||||
} else it.apply {
|
||||
@@ -690,7 +690,7 @@ class SystemUIHooker : YukiBaseHooker() {
|
||||
* 图标在任何场景下跟随状态栏其它图标保持半透明
|
||||
* MIUI 12 进行单独判断
|
||||
*/
|
||||
field { name = "mCurrentSetColor" }.ofInt(instance).also { color ->
|
||||
field { name = "mCurrentSetColor" }.get(instance).int().also { color ->
|
||||
if (hasIgnoreStatusBarIconColor) {
|
||||
alpha = if (color.isWhite) 0.95f else 0.8f
|
||||
setColorFilter(if (color.isWhite) color else Color.BLACK)
|
||||
@@ -769,7 +769,7 @@ class SystemUIHooker : YukiBaseHooker() {
|
||||
/** 获取小图标 */
|
||||
val iconImageView =
|
||||
NotificationHeaderViewWrapperClass.clazz
|
||||
.field { name = "mIcon" }.of<ImageView>(instance) ?: return@afterHook
|
||||
.field { name = "mIcon" }.get(instance).cast<ImageView>() ?: return@afterHook
|
||||
|
||||
/** 获取 [StatusBarNotification] */
|
||||
val sbnPair = instance.getSbnPair()
|
||||
@@ -799,7 +799,7 @@ class SystemUIHooker : YukiBaseHooker() {
|
||||
injectMember {
|
||||
method { name = "handleAppIcon" }
|
||||
replaceUnit {
|
||||
field { name = "mAppIcon" }.of<ImageView>(instance)?.apply {
|
||||
field { name = "mAppIcon" }.get(instance).cast<ImageView>()?.apply {
|
||||
compatNotifyIcon(context, instance.getSbnPair().second, iconImageView = this, isUseAndroid12Style = true)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user