mirror of
https://github.com/HighCapable/YukiHookAPI.git
synced 2025-09-04 09:45:19 +08:00
Update demo
This commit is contained in:
@@ -31,6 +31,7 @@ package com.highcapable.yukihookapi.demo_module.hook
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Intent
|
||||
import android.os.Build
|
||||
import android.widget.Button
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import com.highcapable.yukihookapi.YukiHookAPI
|
||||
@@ -210,7 +211,9 @@ class HookEntry : IYukiHookXposedInit {
|
||||
loadApp(name = "com.highcapable.yukihookapi.demo_app") {
|
||||
// Register Activity Proxy
|
||||
// 注册模块 Activity 代理
|
||||
onAppLifecycle { onCreate { registerModuleAppActivities() } }
|
||||
onAppLifecycle {
|
||||
onCreate { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) registerModuleAppActivities() }
|
||||
}
|
||||
// Find Class to hook
|
||||
// 得到需要 Hook 的 Class
|
||||
findClass(name = "$packageName.ui.MainActivity").hook {
|
||||
@@ -307,13 +310,16 @@ class HookEntry : IYukiHookXposedInit {
|
||||
MaterialAlertDialogBuilder(context)
|
||||
.setTitle("Hooked")
|
||||
.setMessage("I am hook your toast showing!")
|
||||
.setPositiveButton("START PARASITIC") { _, _ ->
|
||||
MaterialAlertDialogBuilder(context)
|
||||
.setTitle("Start Parasitic")
|
||||
.setMessage("This function will start MainActivity that exists in the module app.")
|
||||
.setPositiveButton("YES") { _, _ ->
|
||||
context.startActivity(Intent(context, MainActivity::class.java))
|
||||
}.setNegativeButton("NO", null).show().compatStyle()
|
||||
.apply {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
|
||||
setPositiveButton("START PARASITIC") { _, _ ->
|
||||
MaterialAlertDialogBuilder(context)
|
||||
.setTitle("Start Parasitic")
|
||||
.setMessage("This function will start MainActivity that exists in the module app.")
|
||||
.setPositiveButton("YES") { _, _ ->
|
||||
context.startActivity(Intent(context, MainActivity::class.java))
|
||||
}.setNegativeButton("NO", null).show().compatStyle()
|
||||
}
|
||||
}.setNegativeButton("SEND MSG TO MODULE") { _, _ ->
|
||||
dataChannel.put(DataConst.TEST_CN_DATA, value = "I am host, can you hear me?")
|
||||
}.setNeutralButton("REMOVE HOOK") { _, _ ->
|
||||
|
Reference in New Issue
Block a user