mirror of
https://github.com/HighCapable/YukiHookAPI.git
synced 2025-09-04 09:45:19 +08:00
Merge document file
This commit is contained in:
@@ -50,7 +50,7 @@
|
||||
|
||||
> 你大概率会遇到浏览器缓存造成文档不是最新版本的问题,若已经查看过一次文档,请手动在每个页面上刷新一次以同步最新版本,或清除浏览器缓存。
|
||||
|
||||
The latest version update time/最新版本更新时间:2022-05-06 14:48
|
||||
The latest version update time/最新版本更新时间:2022-05-08 15:25
|
||||
|
||||
## Contacts
|
||||
|
||||
|
@@ -12,7 +12,7 @@
|
||||
|
||||
- 方便移植 快速上手
|
||||
|
||||
<font size=3 style="opacity: 0.6">`更新时间 2022-05-06 14:48`</font>
|
||||
<font size=3 style="opacity: 0.6">`更新时间 2022-05-08 15:25`</font>
|
||||
|
||||
[GitHub](https://github.com/fankes/YukiHookAPI)
|
||||
[Get Started](#介绍)
|
||||
|
@@ -85,7 +85,7 @@ fun encase(vararg hooker: YukiBaseHooker)
|
||||
> 示例如下
|
||||
|
||||
```kotlin
|
||||
class CustomHooker : YukiBaseHooker() {
|
||||
object CustomHooker : YukiBaseHooker() {
|
||||
|
||||
override fun onHook() {
|
||||
// Your code here.
|
||||
@@ -93,12 +93,14 @@ class CustomHooker : YukiBaseHooker() {
|
||||
}
|
||||
```
|
||||
|
||||
子 Hooker **建议使用**单例 `object` 创建,你也可以使用 `class` 但不推荐。
|
||||
|
||||
!> 你无需再在继承于 `YukiBaseHooker` 的 `onHook` 方法中重新调用 `encase`,这是错误的,你应该直接开始编写你的 Hook 代码。
|
||||
|
||||
> 示例如下
|
||||
|
||||
```kotlin
|
||||
class CustomHooker : YukiBaseHooker() {
|
||||
object CustomHooker : YukiBaseHooker() {
|
||||
|
||||
override fun onHook() {
|
||||
loadApp(name = "com.example.demo1") {
|
||||
@@ -120,14 +122,14 @@ class CustomHooker : YukiBaseHooker() {
|
||||
> 示例如下
|
||||
|
||||
```kotlin
|
||||
class HookEntryClass : IYukiHookXposedInit {
|
||||
class HookEntry : IYukiHookXposedInit {
|
||||
|
||||
override fun onHook() = encase {
|
||||
loadApp(name = "com.example.demo", ChildCustomHooker())
|
||||
loadApp(name = "com.example.demo", ChildCustomHooker)
|
||||
}
|
||||
}
|
||||
|
||||
class ChildCustomHooker : YukiBaseHooker() {
|
||||
object ChildCustomHooker : YukiBaseHooker() {
|
||||
|
||||
override fun onHook() {
|
||||
findClass(name = "$packageName.DemoClass").hook {
|
||||
@@ -142,14 +144,14 @@ class ChildCustomHooker : YukiBaseHooker() {
|
||||
> 示例如下
|
||||
|
||||
```kotlin
|
||||
class FirstHooker : YukiBaseHooker() {
|
||||
object FirstHooker : YukiBaseHooker() {
|
||||
|
||||
override fun onHook() {
|
||||
findClass(name = "$packageName.DemoClass").hook {
|
||||
// Your code here.
|
||||
}
|
||||
loadHooker(SecondHooker())
|
||||
loadHooker(ThirdHooker())
|
||||
loadHooker(SecondHooker)
|
||||
loadHooker(ThirdHooker)
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -159,7 +161,7 @@ class FirstHooker : YukiBaseHooker() {
|
||||
> 示例如下
|
||||
|
||||
```kotlin
|
||||
class HookEntryClass : IYukiHookXposedInit {
|
||||
class HookEntry : IYukiHookXposedInit {
|
||||
|
||||
override fun onHook() =
|
||||
YukiHookAPI.encase(FirstHooker(), SecondHooker(), ThirdHooker() ...)
|
||||
@@ -171,9 +173,9 @@ class HookEntryClass : IYukiHookXposedInit {
|
||||
> 示例如下
|
||||
|
||||
```kotlin
|
||||
class HookEntryClass : IYukiHookXposedInit {
|
||||
class HookEntry : IYukiHookXposedInit {
|
||||
|
||||
override fun onHook() = encase(FirstHooker(), SecondHooker(), ThirdHooker() ...)
|
||||
override fun onHook() = encase(FirstHooker, SecondHooker, ThirdHooker ...)
|
||||
}
|
||||
```
|
||||
|
||||
|
Reference in New Issue
Block a user