Update document file

This commit is contained in:
2022-05-01 09:52:53 +08:00
parent 8d226bc42d
commit dfa3362c35
30 changed files with 1957 additions and 164 deletions

View File

@@ -1,7 +1,7 @@
## ConstructorFinder [class]
```kotlin
class ConstructorFinder(override val hookInstance: YukiHookCreater.MemberHookCreater?, override val classSet: Class<*>) : BaseFinder()
class ConstructorFinder(override val hookInstance: YukiMemberHookCreater.MemberHookCreater?, override val classSet: Class<*>) : BaseFinder()
```
**变更记录**
@@ -112,6 +112,22 @@ fun paramCount(num: Int): IndexTypeCondition
!> 存在多个 `IndexTypeCondition` 时除了 `order` 只会生效最后一个。
### superClass [method]
```kotlin
fun superClass(isOnlySuperClass: Boolean)
```
**变更记录**
`v1.0.80` `新增`
**功能描述**
> 设置在 `classSet` 的所有父类中查找当前 `Constructor`。
!> 若当前 `classSet` 的父类较多可能会耗时API 会自动循环到父类继承是 `Any` 前的最后一个类。
### RemedyPlan [class]
```kotlin

View File

@@ -1,7 +1,7 @@
## CurrentClass [class]
```kotlin
class CurrentClass(private val instance: Class<*>, private val self: Any)
class CurrentClass(internal val instance: Class<*>, internal val self: Any)
```
**变更记录**
@@ -12,10 +12,24 @@ class CurrentClass(private val instance: Class<*>, private val self: Any)
> 当前实例的类操作对象。
### superClass [method]
```kotlin
fun superClass(): SuperClass
```
**变更记录**
`v1.0.80` `新增`
**功能描述**
> 调用父类实例。
### field [method]
```kotlin
fun field(initiate: FieldFinder.() -> Unit): FieldFinder.Result.Instance
inline fun field(initiate: FieldFinder.() -> Unit): FieldFinder.Result.Instance
```
**变更记录**
@@ -29,7 +43,7 @@ fun field(initiate: FieldFinder.() -> Unit): FieldFinder.Result.Instance
### method [method]
```kotlin
fun method(initiate: MethodFinder.() -> Unit): MethodFinder.Result.Instance
inline fun method(initiate: MethodFinder.() -> Unit): MethodFinder.Result.Instance
```
**变更记录**
@@ -38,4 +52,46 @@ fun method(initiate: MethodFinder.() -> Unit): MethodFinder.Result.Instance
**功能描述**
> 调用当前实例中的方法。
> 调用当前实例中的方法。
### SuperClass [class]
```kotlin
inner class SuperClass
```
**变更记录**
`v1.0.80` `新增`
**功能描述**
> 当前类的父类实例的类操作对象。
#### field [method]
```kotlin
inline fun field(initiate: FieldFinder.() -> Unit): FieldFinder.Result.Instance
```
**变更记录**
`v1.0.80` `新增`
**功能描述**
> 调用父类实例中的变量。
#### method [method]
```kotlin
inline fun method(initiate: MethodFinder.() -> Unit): MethodFinder.Result.Instance
```
**变更记录**
`v1.0.80` `新增`
**功能描述**
> 调用父类实例中的方法。

View File

@@ -1,7 +1,7 @@
## FieldFinder [class]
```kotlin
class FieldFinder(override val hookInstance: YukiHookCreater.MemberHookCreater?, override val classSet: Class<*>?) : BaseFinder()
class FieldFinder(override val hookInstance: YukiMemberHookCreater.MemberHookCreater?, override val classSet: Class<*>?) : BaseFinder()
```
**变更记录**
@@ -132,6 +132,22 @@ fun type(value: Any): IndexTypeCondition
!> 存在多个 `IndexTypeCondition` 时除了 `order` 只会生效最后一个。
### superClass [method]
```kotlin
fun superClass(isOnlySuperClass: Boolean)
```
**变更记录**
`v1.0.80` `新增`
**功能描述**
> 设置在 `classSet` 的所有父类中查找当前 `Field`。
!> 若当前 `classSet` 的父类较多可能会耗时API 会自动循环到父类继承是 `Any` 前的最后一个类。
### Result [class]
```kotlin

View File

@@ -1,7 +1,7 @@
## HookParam [class]
```kotlin
class HookParam(private val createrInstance: YukiHookCreater, private val wrapper: HookParamWrapper)
class HookParam(private val createrInstance: YukiMemberHookCreater, private var wrapper: HookParamWrapper?)
```
**变更记录**

View File

@@ -0,0 +1,13 @@
## HookResources [class]
```kotlin
class HookResources(var instance: YukiResources?)
```
**变更记录**
`v1.0.80` `新增`
**功能描述**
> 创建一个当前 Hook 的 `YukiResources` 接管类。

View File

@@ -48,4 +48,42 @@ fun onHook()
**功能描述**
> Xposed API 的模块装载调用入口方法。
> Xposed API 的模块装载调用入口方法。
### onXposedEvent [method]
```kotlin
fun onXposedEvent()
```
**变更记录**
`v1.0.80` `新增`
**功能描述**
> 监听 Xposed 原生装载事件。
若你的 Hook 事件中存在需要兼容的原生 Xposed 功能,可在这里实现。
请在这里使用 `YukiXposedEvent` 创建回调事件监听。
可监听的事件如下:
`YukiXposedEvent.onInitZygote`
`YukiXposedEvent.onHandleLoadPackage`
`YukiXposedEvent.onHandleInitPackageResources`
!> 此接口仅供监听和实现原生 Xposed API 的功能,请不要在这里操作 `YukiHookAPI`
## ~~YukiHookXposedInitProxy [interface]~~ <!-- {docsify-ignore} -->
**变更记录**
`v1.0` `添加`
`v1.0.80` `作废`
请转移到 `IYukiHookXposedInit`

View File

@@ -1,7 +1,7 @@
## MethodFinder [class]
```kotlin
class MethodFinder(override val hookInstance: YukiHookCreater.MemberHookCreater?, override val classSet: Class<*>) : BaseFinder()
class MethodFinder(override val hookInstance: YukiMemberHookCreater.MemberHookCreater?, override val classSet: Class<*>) : BaseFinder()
```
**变更记录**
@@ -196,6 +196,22 @@ fun returnType(value: Any): IndexTypeCondition
!> 存在多个 `IndexTypeCondition` 时除了 `order` 只会生效最后一个。
### superClass [method]
```kotlin
fun superClass(isOnlySuperClass: Boolean)
```
**变更记录**
`v1.0.80` `新增`
**功能描述**
> 设置在 `classSet` 的所有父类中查找当前 `Method`。
!> 若当前 `classSet` 的父类较多可能会耗时API 会自动循环到父类继承是 `Any` 前的最后一个类。
### RemedyPlan [class]
```kotlin

View File

@@ -1,7 +1,7 @@
## PackageParam [class]
```kotlin
open class PackageParam(private var wrapper: PackageParamWrapper?)
open class PackageParam(internal var wrapper: PackageParamWrapper?)
```
**变更记录**
@@ -54,6 +54,24 @@ val appContext: Application
> 获取当前 Hook APP 的 `Application`。
!> 首次装载可能是空的,请延迟一段时间再获取。
### appResources [field]
```kotlin
val appResourcesResources
```
**变更记录**
`v1.0.80` `新增`
**功能描述**
> 获取当前 Hook APP 的 Resources。
!> 你只能在 `HookResources.hook` 方法体内或 `appContext` 装载完毕时进行调用。
### processName [field]
```kotlin
@@ -112,6 +130,38 @@ val mainProcessName: String
其对应的就是 `packageName`
### moduleAppFilePath [field]
```kotlin
val moduleAppFilePath: String
```
**变更记录**
`v1.0.80` `新增`
**功能描述**
> 获取当前 Xposed 模块自身 APK 文件路径。
!> 作为 Hook API 装载时无法使用,会获取到空字符串。
### moduleAppResources [field]
```kotlin
val moduleAppResources: YukiModuleResources
```
**变更记录**
`v1.0.80` `新增`
**功能描述**
> 获取当前 Xposed 模块自身 `Resources`。
!> 作为 Hook API 或不支持的 Hook Framework 装载时无法使用,会抛出异常。
### prefs [field]
```kotlin
@@ -126,6 +176,8 @@ val prefs: YukiHookModulePrefs
> 获得当前使用的存取数据对象缓存实例。
!> 作为 Hook API 装载时无法使用,会抛出异常。
### prefs [method]
```kotlin
@@ -146,6 +198,24 @@ fun prefs(name: String): YukiHookModulePrefs
你可以通过 `name` 来自定义 Sp 存储的名称。
!> 作为 Hook API 装载时无法使用,会抛出异常。
### resources [method]
```kotlin
fun resources(): HookResources
```
**变更记录**
`v1.0.80` `新增`
**功能描述**
> 获得当前 Hook APP 的 `YukiResources` 对象。
请调用 `HookResources.hook` 方法开始 Hook。
### loadApp [method]
```kotlin
@@ -170,6 +240,28 @@ fun loadApp(name: String, hooker: YukiBaseHooker)
`name` 为 APP 的包名,后方的两个参数一个可作为 `lambda` 方法体使用,一个可以直接装载子 Hooker。
装载并 Hook 指定、全部包名的 APP若要 Hook 系统框架,请使用 `loadZygote`
### loadZygote [method]
```kotlin
inline fun loadZygote(initiate: PackageParam.() -> Unit)
```
```kotlin
fun loadZygote(hooker: YukiBaseHooker)
```
**变更记录**
`v1.0.80` `新增`
**功能描述**
> 装载并 Hook 系统框架。
方法中的两个参数一个可作为 `lambda` 方法体使用,一个可以直接装载子 Hooker。
### withProcess [method]
```kotlin
@@ -331,19 +423,19 @@ val variousClass = VariousClass("com.example.demo.DemoClass1", "com.example.demo
### hook [method]
```kotlin
inline fun String.hook(isUseAppClassLoader: Boolean, initiate: YukiHookCreater.() -> Unit): YukiHookCreater.Result
inline fun String.hook(isUseAppClassLoader: Boolean, initiate: YukiMemberHookCreater.() -> Unit): YukiMemberHookCreater.Result
```
```kotlin
inline fun Class<*>.hook(isUseAppClassLoader: Boolean, initiate: YukiHookCreater.() -> Unit): YukiHookCreater.Result
inline fun Class<*>.hook(isUseAppClassLoader: Boolean, initiate: YukiMemberHookCreater.() -> Unit): YukiMemberHookCreater.Result
```
```kotlin
inline fun VariousClass.hook(isUseAppClassLoader: Boolean, initiate: YukiHookCreater.() -> Unit): YukiHookCreater.Result
inline fun VariousClass.hook(isUseAppClassLoader: Boolean, initiate: YukiMemberHookCreater.() -> Unit): YukiMemberHookCreater.Result
```
```kotlin
inline fun HookClass.hook(isUseAppClassLoader: Boolean, initiate: YukiHookCreater.() -> Unit): YukiHookCreater.Result
inline fun HookClass.hook(isUseAppClassLoader: Boolean, initiate: YukiMemberHookCreater.() -> Unit): YukiMemberHookCreater.Result
```
**变更记录**
@@ -360,7 +452,7 @@ inline fun HookClass.hook(isUseAppClassLoader: Boolean, initiate: YukiHookCreate
`v1.0.3` `修改`
新增 `YukiHookCreater.Result` 返回值
新增 `YukiMemberHookCreater.Result` 返回值
`v1.0.70` `修改`
@@ -443,4 +535,34 @@ findClass("com.example.demo.DemoClass1", "com.example.demo.DemoClass2").hook {
YourClass.hook(isUseAppClassLoader = false) {
// Your code here.
}
```
```
### hook [method]
```kotlin
inline fun HookResources.hook(initiate: YukiResourcesHookCreater.() -> Unit)
```
**变更记录**
`v1.0.80` `新增
**功能描述**
> Hook APP 的 Resources。
**功能示例**
Resources Hook 为固定用法,获取 `resources` 对象,然后调用 `hook` 方法开始 Hook。
> 示例如下
```kotlin
resources().hook {
// Your code here.
}
```
!> 这是固定用法,为了防止发生问题,你不可手动实现任何 `HookResources` 实例执行 `hook` 调用。
将 Resources 的 Hook 设置为这样是为了与 `findClass(...).hook` 做到统一,使得调用起来逻辑不会混乱。

View File

@@ -8,6 +8,34 @@
> 这是自定义 `Member` 和 `Class` 相关功能的查找匹配以及 `invoke` 的封装类。
### hookClass [field]
```kotlin
val Class<*>.hookClass: HookClass
```
**变更记录**
`v1.0` `添加`
**功能描述**
> 将 `Class` 转换为 `HookClass`。
### normalClass [field]
```kotlin
val HookClass.normalClass: Class<*>?
```
**变更记录**
`v1.0` `添加`
**功能描述**
> 将 `HookClass` 转换为 `Class`。
### hasClass [field]
```kotlin
@@ -36,33 +64,19 @@ if("com.example.demo.DemoClass".hasClass) {
}
```
### hookClass [field]
### hasExtends [field]
```kotlin
val Class<*>.hookClass: HookClass
val Class<*>.hasExtends: Boolean
```
**变更记录**
`v1.0` `添加`
`v1.0.80` `新增`
**功能描述**
> `Class` 转换为 `HookClass`
### normalClass [field]
```kotlin
val HookClass.normalClass: Class<*>?
```
**变更记录**
`v1.0` `添加`
**功能描述**
> 将 `HookClass` 转换为 `Class`。
> 当前 `Class` 是否有继承关系,父类是 `Any` 将被认为没有继承关系
### classOf [method]

View File

@@ -50,7 +50,21 @@ fun IYukiHookXposedInit.encase(vararg hooker: YukiBaseHooker)
**功能描述**
> 在 `IYukiHookXposedInit` 中装载 `YukiHookAPI`。
> 在 `IYukiHookXposedInit` 中调用 `YukiHookAPI`。
### resources [method]
```kotlin
fun IYukiHookXposedInit.resources(initiate: ResourcesParam.() -> Unit)
```
**变更记录**
`v1.0.80` `新增`
**功能描述**
> 在 `IYukiHookXposedInit` 中调用 `YukiHookAPI.resources`。
### modulePrefs [field]
@@ -94,6 +108,20 @@ val Context.processName: String
> 获取当前进程名称。
### isSupportResourcesHook [field]
```kotlin
val Any?.isSupportResourcesHook: Boolean
```
**变更记录**
`v1.0.80` `新增`
**功能描述**
> 判断当前 Hook Framework 是否支持资源钩子(Resources Hook)。
### isModuleActive [field]
```kotlin

View File

@@ -1,7 +1,7 @@
## YukiHookCreater [class]
## YukiMemberHookCreater [class]
```kotlin
class YukiHookCreater(private val packageParam: PackageParam, internal val hookClass: HookClass)
class YukiMemberHookCreater(private val packageParam: PackageParam, internal val hookClass: HookClass)
```
**变更记录**
@@ -14,7 +14,49 @@ class YukiHookCreater(private val packageParam: PackageParam, internal val hookC
**功能描述**
> `YukiHookAPI` 核心 Hook 实现类。
> `YukiHookAPI``Member` 核心 Hook 实现类。
### PRIORITY_DEFAULT [field]
```kotlin
val PRIORITY_DEFAULT: Int
```
**变更记录**
`v1.0.80` `新增`
**功能描述**
> 默认 Hook 回调优先级。
### PRIORITY_LOWEST [field]
```kotlin
val PRIORITY_LOWEST: Int
```
**变更记录**
`v1.0.80` `新增`
**功能描述**
> 延迟回调 Hook 方法结果。
### PRIORITY_HIGHEST [field]
```kotlin
val PRIORITY_HIGHEST: Int
```
**变更记录**
`v1.0.80` `新增`
**功能描述**
> 更快回调 Hook 方法结果。
### instanceClass [field]
@@ -39,7 +81,7 @@ val instanceClass: Class<*>
### injectMember [method]
```kotlin
inline fun injectMember(tag: String, initiate: MemberHookCreater.() -> Unit): MemberHookCreater.Result
inline fun injectMember(priority: Int, tag: String, initiate: MemberHookCreater.() -> Unit): MemberHookCreater.Result
```
**变更记录**
@@ -50,6 +92,8 @@ inline fun injectMember(tag: String, initiate: MemberHookCreater.() -> Unit): Me
将方法体进行 inline
增加 `priority` Hook 优先级
**功能描述**
> 注入要 Hook 的方法、构造类。
@@ -76,16 +120,30 @@ injectMember(tag = "KuriharaYuki") {
}
```
你还可以自定义 `priority`,以控制当前 Hook 对象并列执行的优先级速度。
> 示例如下
```kotlin
injectMember(priority = PRIORITY_HIGHEST) {
// Your code here.
}
```
### MemberHookCreater [class]
```kotlin
inner class MemberHookCreater(var tag: String)
inner class MemberHookCreater(private val priority: Int, internal val tag: String)
```
**变更记录**
`v1.0` `添加`
`v1.0.80` `修改`
增加 `priority` Hook 优先级
**功能描述**
> Hook 核心功能实现类,查找和处理需要 Hook 的方法、构造类。

View File

@@ -0,0 +1,29 @@
## YukiModuleResources [class]
```kotlin
class YukiModuleResources(private val baseInstance: XModuleResources) : Resources
```
**变更记录**
`v1.0.80` `新增`
**功能描述**
> 对接 `XModuleResources` 的中间层实例。
### fwd [method]
```kotlin
fun fwd(resId: Int): YukiResForwarder
```
**变更记录**
`v1.0.80` `新增`
**功能描述**
> 对接 `XModuleResources.fwd` 方法。
创建 `YukiResForwarder``XResForwarder` 实例。

View File

@@ -0,0 +1,55 @@
## YukiResForwarder [class]
```kotlin
class YukiResForwarder(private val baseInstance: XResForwarder)
```
**变更记录**
`v1.0.80` `新增`
**功能描述**
> 对接 `XResForwarder` 的中间层实例。
### instance [field]
```kotlin
val instance: XResForwarder
```
**变更记录**
`v1.0.80` `新增`
**功能描述**
> 获得 `XResForwarder` 实例。
### id [field]
```kotlin
val id: Int
```
**变更记录**
`v1.0.80` `新增`
**功能描述**
> 获得当前 APP 的 Resources Id。
### resources [field]
```kotlin
val resources: Resources
```
**变更记录**
`v1.0.80` `新增`
**功能描述**
> 获得当前 APP 的 Resources。

View File

@@ -0,0 +1,77 @@
## YukiResources [class]
```kotlin
class YukiResources(private val baseInstance: XResources) : Resources
```
**变更记录**
`v1.0.80` `新增`
**功能描述**
> 对接 `XResources` 的中间层实例。
### LayoutInflatedParam [class]
```kotlin
class LayoutInflatedParam(internal val baseParam: XC_LayoutInflated.LayoutInflatedParam)
```
**变更记录**
`v1.0.80` `新增`
**功能描述**
> 装载 Hook APP 的目标布局 Resources 实现类。
#### variantName [field]
```kotlin
val variantName: String
```
**变更记录**
`v1.0.80` `新增`
**功能描述**
> 获取当前被 Hook 的布局装载目录名称。
例如:`layout``layout-land``layout-sw600dp`
#### currentView [field]
```kotlin
val currentView: View
```
**变更记录**
`v1.0.80` `新增`
**功能描述**
> 获取当前被 Hook 的布局实例。
#### findViewByIdentifier [method]
```kotlin
inline fun <reified T : View> View.findViewByIdentifier(name: String): T?
```
```kotlin
inline fun <reified T : View> findViewByIdentifier(name: String): T?
```
**变更记录**
`v1.0.80` `新增`
**功能描述**
> 使用 Identifier 查找 Hook APP 指定 Id 的 `View`。
扩展方法可以使用 Identifier 查找 Hook APP 当前装载布局中指定 Id 的 `View`

View File

@@ -0,0 +1,569 @@
## YukiResourcesHookCreater [class]
```kotlin
class YukiResourcesHookCreater(private val packageParam: PackageParam, internal val hookResources: HookResources)
```
**变更记录**
`v1.0.80` `新增`
**功能描述**
> `YukiHookAPI` 的 `Resources` 核心 Hook 实现类。
### injectResource [method]
```kotlin
inline fun injectResource(tag: String, initiate: ResourceHookCreater.() -> Unit): ResourceHookCreater.Result
```
**变更记录**
`v1.0.80` `新增`
**功能描述**
> 注入要 Hook 的 Resources。
**功能示例**
你可以注入任意 Resources使用 `injectResource` 即可创建一个 `Hook` 对象。
> 示例如下
```kotlin
injectResource {
// Your code here.
}
```
你还可以自定义 `tag`,方便你在调试的时候能够区分你的 `Hook` 对象。
> 示例如下
```kotlin
injectResource(tag = "KuriharaYuki") {
// Your code here.
}
```
### ResourcesHookCreater [class]
```kotlin
inner class ResourcesHookCreater(private val tag: String)
```
**变更记录**
`v1.0.80` `新增`
**功能描述**
> Hook 核心功能实现类。
查找和处理需要 Hook 的 Resources。
#### resourceId [field]
```kotlin
var resourceId: Int
```
**变更记录**
`v1.0.80` `新增`
**功能描述**
> 直接设置需要替换的 Resources Id。
!> 不建议使用此方法设置目标需要 Hook 的 Resources Id你可以使用 `conditions` 方法。
**功能示例**
你可以直接设置并指定目标 Hook APP 的 Resources Id。
> 示例如下
```kotlin
injectResource {
resourceId = 0x7f060001.toInt()
replaceTo(...)
}
```
#### conditions [method]
```kotlin
inline fun conditions(initiate: ConditionFinder.() -> Unit)
```
**变更记录**
`v1.0.80` `新增`
**功能描述**
> 设置 Resources 查找条件。
若你设置了 `resourceId` 则此方法将不会被使用。
**功能示例**
你可参考 [ConditionFinder](#conditionfinder-class) 查看详细用法。
> 示例如下
```kotlin
injectResource {
conditions {
name = "test_string"
string()
}
replaceTo(...)
}
```
#### replaceTo [method]
```kotlin
fun replaceTo(any: Any)
```
**变更记录**
`v1.0.80` `新增`
**功能描述**
> 替换指定 Resources 为指定的值。
**功能示例**
你可以替换找到的 Resources 为你想要的值,可以是 `String``Drawable` 等。
比如我们要替换一个找到的字符串 Resources。
> 示例如下
```kotlin
injectResource {
conditions {
name = "test_string"
string()
}
replaceTo("replace string")
}
```
或是替换为一个 `Drawable`,你无需对目标 Resources 实现 `fwd` 方法或 `DrawableLoader`
> 示例如下
```kotlin
injectResource {
conditions {
name = "test_drawable"
drawable()
}
replaceTo(ColorDrawable(Color.RED))
}
```
#### replaceToTrue [method]
```kotlin
fun replaceToTrue()
```
**变更记录**
`v1.0.80` `新增`
**功能描述**
> 替换指定 Resources 为 `true`。
!> 确保目标替换 Resources 的类型为 `Boolean`
#### replaceToFalse [method]
```kotlin
fun replaceToFalse()
```
**变更记录**
`v1.0.80` `新增`
**功能描述**
> 替换指定 Resources 为 `false`。
!> 确保目标替换 Resources 的类型为 `Boolean`
#### replaceToModuleResource [method]
```kotlin
fun replaceToModuleResource(resId: Int)
```
**变更记录**
`v1.0.80` `新增`
**功能描述**
> 替换为当前 Xposed 模块的 Resources。
你可以直接使用模块的 `R.string.xxx``R.mipmap.xxx``R.drawable.xxx` 替换 Hook APP 的 Resources。
**功能示例**
使用此方法可非常方便地使用当前模块的 Resources 去替换目标 Hook APP 的 Resources。
这个过程你无需对目标 Resources 实现 `fwd` 方法。
比如我们要替换一个字符串。
> 示例如下
```kotlin
injectResource {
conditions {
name = "test_string"
string()
}
replaceToModuleResource(R.id.module_string)
}
```
还可以替换一些复杂的 Resources比如 `xml` 创建的 `drawable`
> 示例如下
```kotlin
injectResource {
conditions {
name = "test_drawable"
drawable()
}
replaceToModuleResource(R.drawable.module_drawable)
}
```
#### injectAsLayout [method]
```kotlin
fun injectAsLayout(initiate: YukiResources.LayoutInflatedParam.() -> Unit)
```
**变更记录**
`v1.0.80` `新增`
**功能描述**
> 作为装载的布局注入。
**功能示例**
你可以直接注入一个布局监听并修改它的内部 `View`
> 示例如下
```kotlin
injectResource {
conditions {
name = "activity_main"
layout()
}
injectAsLayout {
findViewByIdentifier<View>(name = "test_view")?.isVisible = false
findViewByIdentifier<TextView>(name = "test_text_view")?.text = "Hook this"
}
}
```
你还可以通过 `currentView` 拿到 `Context`
> 示例如下
```kotlin
injectResource {
conditions {
name = "activity_main"
layout()
}
injectAsLayout {
Toast.makeText(currentView.context, "Hook this", Toast.LENGTH_SHORT).show()
}
}
```
#### ConditionFinder [class]
```kotlin
inner class ConditionFinder
```
**变更记录**
`v1.0.80` `新增`
**功能描述**
> Resources 查找条件实现类。
##### name [field]
```kotlin
var name: String
```
**变更记录**
`v1.0.80` `新增`
**功能描述**
> 设置 Resources 名称。
##### anim [method]
```kotlin
fun anim()
```
**变更记录**
`v1.0.80` `新增`
**功能描述**
> 设置 Resources 类型为动画。
##### animator [method]
```kotlin
fun animator()
```
**变更记录**
`v1.0.80` `新增`
**功能描述**
> 设置 Resources 类型为属性动画。
##### bool [method]
```kotlin
fun bool()
```
**变更记录**
`v1.0.80` `新增`
**功能描述**
> 设置 Resources 类型为布朗(Boolean)。
##### color [method]
```kotlin
fun color()
```
**变更记录**
`v1.0.80` `新增`
**功能描述**
> 设置 Resources 类型为颜色(Color)。
##### dimen [method]
```kotlin
fun dimen()
```
**变更记录**
`v1.0.80` `新增`
**功能描述**
> 设置 Resources 类型为尺寸(Dimention)。
##### drawable [method]
```kotlin
fun drawable()
```
**变更记录**
`v1.0.80` `新增`
**功能描述**
> 设置 Resources 类型为 Drawable。
##### integer [method]
```kotlin
fun integer()
```
**变更记录**
`v1.0.80` `新增`
**功能描述**
> 设置 Resources 类型为整型(Integer)。
##### layout [method]
```kotlin
fun layout()
```
**变更记录**
`v1.0.80` `新增`
**功能描述**
> 设置 Resources 类型为布局(Layout)。
##### plurals [method]
```kotlin
fun plurals()
```
**变更记录**
`v1.0.80` `新增`
**功能描述**
> 设置 Resources 类型为 Plurals。
##### string [method]
```kotlin
fun string()
```
**变更记录**
`v1.0.80` `新增`
**功能描述**
> 设置 Resources 类型为字符串(String)。
##### xml [method]
```kotlin
fun xml()
```
**变更记录**
`v1.0.80` `新增`
**功能描述**
> 设置 Resources 类型为 Xml。
##### mipmap [method]
```kotlin
fun mipmap()
```
**变更记录**
`v1.0.80` `新增`
**功能描述**
> 设置 Resources 类型为位图(Mipmap)。
#### Result [class]
```kotlin
inner class Result
```
**变更记录**
`v1.0.80` `新增`
**功能描述**
> 监听全部 Hook 结果实现类,可在这里处理失败事件监听。
##### result [method]
```kotlin
inline fun result(initiate: Result.() -> Unit): Result
```
**变更记录**
`v1.0.80` `新增`
**功能描述**
> 创建监听事件方法体。
##### by [method]
```kotlin
inline fun by(initiate: () -> Boolean): Result
```
**变更记录**
`v1.0.80` `新增`
**功能描述**
> 添加执行 Hook 需要满足的条件,不满足条件将直接停止 Hook。
#### onHookingFailure [method]
```kotlin
fun onHookingFailure(initiate: (Throwable) -> Unit): Result
```
**变更记录**
`v1.0.80` `新增`
**功能描述**
> 监听 Hook 过程发生错误的回调方法。
#### ignoredHookingFailure [method]
```kotlin
fun ignoredHookingFailure(): Result
```
**变更记录**
`v1.0.80` `新增`
**功能描述**
> 忽略 Hook 过程出现的错误。

View File

@@ -0,0 +1,69 @@
## YukiXposedEvent [object]
```kotlin
object YukiXposedEvent
```
**变更记录**
`v1.0.80` `添加`
**功能描述**
> 实现对原生 Xposed API 的装载事件监听。
### events [method]
```kotlin
inline fun events(initiate: YukiXposedEvent.() -> Unit)
```
**变更记录**
`v1.0.80` `新增`
**功能描述**
> 对 `YukiXposedEvent` 创建一个方法体。
### onInitZygote [method]
```kotlin
fun onInitZygote(initiate: (StartupParam) -> Unit)
```
**变更记录**
`v1.0.80` `新增`
**功能描述**
> 设置 initZygote 事件监听。
### onHandleLoadPackage [method]
```kotlin
fun onHandleLoadPackage(initiate: (LoadPackageParam) -> Unit)
```
**变更记录**
`v1.0.80` `新增`
**功能描述**
> 设置 handleLoadPackage 事件监听。
### onHandleInitPackageResources [method]
```kotlin
fun onHandleInitPackageResources(initiate: (InitPackageResourcesParam) -> Unit)
```
**变更记录**
`v1.0.80` `新增`
**功能描述**
> 设置 handleInitPackageResources 事件监听。