mirror of
https://github.com/fankes/ColorOSNotifyIcon.git
synced 2025-09-05 10:15:33 +08:00
Update YukiHookAPI
This commit is contained in:
@@ -72,9 +72,8 @@ tasks.whenTaskAdded {
|
||||
|
||||
dependencies {
|
||||
compileOnly 'de.robv.android.xposed:api:82'
|
||||
implementation 'com.highcapable.yukihookapi:api:1.0.75'
|
||||
ksp 'com.highcapable.yukihookapi:ksp-xposed:1.0.75'
|
||||
implementation 'com.github.tiann:FreeReflection:3.1.0'
|
||||
implementation 'com.highcapable.yukihookapi:api:1.0.77'
|
||||
ksp 'com.highcapable.yukihookapi:ksp-xposed:1.0.77'
|
||||
implementation "com.github.topjohnwu.libsu:core:3.1.2"
|
||||
implementation 'androidx.annotation:annotation:1.3.0'
|
||||
implementation 'com.geyifeng.immersionbar:immersionbar:3.2.0'
|
||||
|
@@ -24,32 +24,13 @@
|
||||
|
||||
package com.fankes.coloros.notify.application
|
||||
|
||||
import android.app.Application
|
||||
import android.content.Context
|
||||
import androidx.appcompat.app.AppCompatDelegate
|
||||
import me.weishu.reflection.Reflection
|
||||
import com.highcapable.yukihookapi.hook.xposed.application.ModuleApplication
|
||||
|
||||
class CNNApplication : Application() {
|
||||
|
||||
companion object {
|
||||
|
||||
/** 全局静态实例 */
|
||||
private var context: CNNApplication? = null
|
||||
|
||||
/** 调用全局静态实例 */
|
||||
val appContext get() = context ?: error("App is death")
|
||||
}
|
||||
|
||||
override fun attachBaseContext(base: Context?) {
|
||||
super.attachBaseContext(base)
|
||||
/** 解锁隐藏 API */
|
||||
Reflection.unseal(base)
|
||||
}
|
||||
class CNNApplication : ModuleApplication() {
|
||||
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
/** 设置静态实例 */
|
||||
context = this
|
||||
/** 跟随系统夜间模式 */
|
||||
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM)
|
||||
}
|
||||
|
@@ -597,7 +597,7 @@ class SystemUIHooker : YukiBaseHooker() {
|
||||
.get(field { name = "iconBuilder" }.get(instance).cast()).cast<Context>()?.also { context ->
|
||||
NotificationEntryClass.clazz.method {
|
||||
name = "getSbn"
|
||||
}.get(args[0]).invoke<StatusBarNotification>()?.also { nf ->
|
||||
}.get(args().first().any()).invoke<StatusBarNotification>()?.also { nf ->
|
||||
nf.notification.smallIcon.loadDrawable(context).also { iconDrawable ->
|
||||
compatStatusIcon(
|
||||
context = context,
|
||||
@@ -629,7 +629,7 @@ class SystemUIHooker : YukiBaseHooker() {
|
||||
param(StatusBarNotificationClass)
|
||||
}
|
||||
afterHook {
|
||||
if (args[0] != null) instance<ImageView>().also {
|
||||
if (args().first().any() != null) instance<ImageView>().also {
|
||||
/** 注册壁纸颜色监听 */
|
||||
registerWallpaperColorChanged(it)
|
||||
/** 注册广播 */
|
||||
|
@@ -28,11 +28,11 @@ import android.app.Activity
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import android.view.WindowManager
|
||||
import com.fankes.coloros.notify.application.CNNApplication.Companion.appContext
|
||||
import com.fankes.coloros.notify.ui.activity.base.BaseActivity
|
||||
import com.fankes.coloros.notify.utils.factory.delayedRun
|
||||
import com.fankes.coloros.notify.utils.tool.IconRuleManagerTool
|
||||
import com.fankes.coloros.notify.utils.tool.SystemUITool
|
||||
import com.highcapable.yukihookapi.hook.xposed.application.ModuleApplication.Companion.appContext
|
||||
|
||||
class NotifyIconRuleUpdateActivity : Activity() {
|
||||
|
||||
|
@@ -50,13 +50,13 @@ import android.util.Base64
|
||||
import android.widget.Toast
|
||||
import androidx.core.app.NotificationManagerCompat
|
||||
import androidx.core.content.getSystemService
|
||||
import com.fankes.coloros.notify.application.CNNApplication.Companion.appContext
|
||||
import com.google.android.material.snackbar.Snackbar
|
||||
import com.highcapable.yukihookapi.hook.factory.classOf
|
||||
import com.highcapable.yukihookapi.hook.factory.field
|
||||
import com.highcapable.yukihookapi.hook.factory.hasClass
|
||||
import com.highcapable.yukihookapi.hook.factory.method
|
||||
import com.highcapable.yukihookapi.hook.type.java.StringType
|
||||
import com.highcapable.yukihookapi.hook.xposed.application.ModuleApplication.Companion.appContext
|
||||
import com.topjohnwu.superuser.Shell
|
||||
import java.io.ByteArrayOutputStream
|
||||
import java.text.SimpleDateFormat
|
||||
|
@@ -26,11 +26,11 @@ import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.IntentFilter
|
||||
import com.fankes.coloros.notify.application.CNNApplication.Companion.appContext
|
||||
import com.fankes.coloros.notify.const.Const
|
||||
import com.fankes.coloros.notify.utils.factory.*
|
||||
import com.google.android.material.snackbar.Snackbar
|
||||
import com.highcapable.yukihookapi.hook.factory.isXposedModuleActive
|
||||
import com.highcapable.yukihookapi.hook.xposed.application.ModuleApplication.Companion.appContext
|
||||
|
||||
/**
|
||||
* 系统界面工具
|
||||
|
Reference in New Issue
Block a user