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