mirror of
https://github.com/HighCapable/YukiHookAPI.git
synced 2025-09-04 09:45:19 +08:00
Added API Document English version (Not yet translated)
This commit is contained in:
@@ -0,0 +1,595 @@
|
||||
---
|
||||
pageClass: code-page
|
||||
---
|
||||
|
||||
::: warning
|
||||
|
||||
The English translation of this page has not been completed, you are welcome to contribute translations to us.
|
||||
|
||||
You can use the **Chrome Translation Plugin** to translate entire pages for reference.
|
||||
|
||||
:::
|
||||
|
||||
# YukiHookAPI <span class="symbol">- object</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
object YukiHookAPI
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 这是 `YukiHookAPI` 的 API 调用总类,Hook 相关功能的开始、Hook 相关功能的配置都在这里。
|
||||
|
||||
## API_VERSION_NAME <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
const val API_VERSION_NAME: String
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.4` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获取当前 `YukiHookAPI` 的版本。
|
||||
|
||||
## API_VERSION_CODE <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
const val API_VERSION_CODE: Int
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.4` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获取当前 `YukiHookAPI` 的版本号。
|
||||
|
||||
<h2 class="deprecated">executorName - field</h2>
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.5` `added`
|
||||
|
||||
`v1.0.91` `removed`
|
||||
|
||||
请转移到 `Status.executorName`
|
||||
|
||||
<h2 class="deprecated">executorVersion - field</h2>
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.5` `added`
|
||||
|
||||
`v1.0.91` `removed`
|
||||
|
||||
请转移到 `Status.executorVersion`
|
||||
|
||||
## Status <span class="symbol">- object</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
object Status
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.91` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 当前 `YukiHookAPI` 的状态。
|
||||
|
||||
### compiledTimestamp <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
val compiledTimestamp: Long
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获取项目编译完成的时间戳 (当前本地时间)。
|
||||
|
||||
### isXposedEnvironment <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
val isXposedEnvironment: Boolean
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获取当前是否为 (Xposed) 宿主环境。
|
||||
|
||||
### executorName <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
val executorName: String
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.91` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获取当前 Hook 框架的名称。
|
||||
|
||||
无法获取会返回 `unknown`,`XposedBridge` 不存在会返回 `invalid`。
|
||||
|
||||
::: warning
|
||||
|
||||
在模块环境中需要启用 **Configs.isEnableHookModuleStatus**。
|
||||
|
||||
:::
|
||||
|
||||
### executorVersion <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
val executorVersion: Int
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.91` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获取当前 Hook 框架的版本。
|
||||
|
||||
无法获取会返回 `-1`。
|
||||
|
||||
::: warning
|
||||
|
||||
在模块环境中需要启用 **Configs.isEnableHookModuleStatus**。
|
||||
|
||||
:::
|
||||
|
||||
### isModuleActive <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
val isModuleActive: Boolean
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.91` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 判断模块是否在 Xposed 或太极、无极中激活。
|
||||
|
||||
::: warning
|
||||
|
||||
在模块环境中你需要将 **Application** 继承于 **ModuleApplication**。
|
||||
|
||||
在模块环境中需要启用 **Configs.isEnableHookModuleStatus**。
|
||||
|
||||
在 (Xposed) 宿主环境中仅返回非 **isTaiChiModuleActive** 的激活状态。
|
||||
|
||||
:::
|
||||
|
||||
### isXposedModuleActive <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
val isXposedModuleActive: Boolean
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.91` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 仅判断模块是否在 Xposed 中激活。
|
||||
|
||||
::: warning
|
||||
|
||||
在模块环境中需要启用 **Configs.isEnableHookModuleStatus**。
|
||||
|
||||
在 (Xposed) 宿主环境中始终返回 true。
|
||||
|
||||
:::
|
||||
|
||||
### isTaiChiModuleActive <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
val isTaiChiModuleActive: Boolean
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.91` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 仅判断模块是否在太极、无极中激活。
|
||||
|
||||
::: warning
|
||||
|
||||
在模块环境中你需要将 **Application** 继承于 **ModuleApplication**。
|
||||
|
||||
在 (Xposed) 宿主环境中始终返回 false。
|
||||
|
||||
:::
|
||||
|
||||
### isSupportResourcesHook <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
val isSupportResourcesHook: Boolean
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.91` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 判断当前 Hook Framework 是否支持资源钩子(Resources Hook)。
|
||||
|
||||
::: warning
|
||||
|
||||
在模块环境中需要启用 **Configs.isEnableHookModuleStatus**。
|
||||
|
||||
在 (Xposed) 宿主环境中可能会延迟等待事件回调后才会返回 true。
|
||||
|
||||
请注意你需要确保 **InjectYukiHookWithXposed.isUsingResourcesHook** 已启用,否则始终返回 false。
|
||||
|
||||
:::
|
||||
|
||||
## Configs <span class="symbol">- object</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
object Configs
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 对 API 相关功能的配置类。
|
||||
|
||||
### debugLog <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun debugLog(initiate: YukiHookLogger.Configs.() -> Unit)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 配置 `YukiHookLogger.Configs` 相关参数。
|
||||
|
||||
<h3 class="deprecated">debugTag - field</h3>
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
`v1.1.0` `deprecated`
|
||||
|
||||
请转移到 `YukiHookLogger.Configs.tag`
|
||||
|
||||
### isDebug <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
var isDebug: Boolean
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 是否启用 DEBUG 模式。
|
||||
|
||||
默认为开启状态,开启后模块将会向 `Logcat` 和 `XposedBridge.log` 打印详细的 Hook 日志,关闭后仅会打印 `E` 级别的日志。
|
||||
|
||||
<h3 class="deprecated">isAllowPrintingLogs - field</h3>
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.4` `added`
|
||||
|
||||
`v1.1.0` `deprecated`
|
||||
|
||||
请转移到 `YukiHookLogger.Configs.isEnable`
|
||||
|
||||
### isEnableModulePrefsCache <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
var isEnableModulePrefsCache: Boolean
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.5` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 是否启用 `YukiHookModulePrefs` 的键值缓存功能。
|
||||
|
||||
为防止内存复用过高问题,此功能默认启用。
|
||||
|
||||
你可以手动在 `YukiHookModulePrefs` 中自由开启和关闭缓存功能以及清除缓存。
|
||||
|
||||
### isEnableModuleAppResourcesCache <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
var isEnableModuleAppResourcesCache: Boolean
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.87` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 是否启用当前 Xposed 模块自身 `Resources` 缓存功能。
|
||||
|
||||
为防止内存复用过高问题,此功能默认启用。
|
||||
|
||||
你可以手动调用 `PackageParam.refreshModuleAppResources` 来刷新缓存。
|
||||
|
||||
::: warning
|
||||
|
||||
关闭后每次使用 **PackageParam.moduleAppResources** 都会重新创建,可能会造成运行缓慢。
|
||||
|
||||
:::
|
||||
|
||||
### isEnableHookModuleStatus <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
var isEnableHookModuleStatus: Boolean
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.88` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 是否启用 Hook Xposed 模块激活等状态功能.
|
||||
|
||||
为原生支持 Xposed 模块激活状态检测,此功能默认启用。
|
||||
|
||||
::: warning
|
||||
|
||||
关闭后你将不能再在模块环境中使用 **YukiHookAPI.Status** 中的激活状态判断功能。
|
||||
|
||||
:::
|
||||
|
||||
### isEnableHookSharedPreferences <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
var isEnableHookSharedPreferences: Boolean
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 是否启用 Hook `SharedPreferences`。
|
||||
|
||||
启用后将在模块启动时强制将 `SharedPreferences` 文件权限调整为 `Context.MODE_WORLD_READABLE` (0664)。
|
||||
|
||||
::: warning
|
||||
|
||||
这是一个可选的实验性功能,此功能默认不启用。
|
||||
|
||||
仅用于修复某些系统可能会出现在启用了 **New XSharedPreferences** 后依然出现文件权限错误问题,若你能正常使用 **YukiHookModulePrefs** 就不建议启用此功能。
|
||||
|
||||
:::
|
||||
|
||||
### isEnableDataChannel <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
var isEnableDataChannel: Boolean
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.88` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 是否启用当前 Xposed 模块与宿主交互的 `YukiHookDataChannel` 功能。
|
||||
|
||||
请确保 Xposed 模块的 `Application` 继承于 `ModuleApplication` 才能有效。
|
||||
|
||||
此功能默认启用,关闭后将不会在功能初始化的时候装载 `YukiHookDataChannel`。
|
||||
|
||||
### isEnableMemberCache <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
var isEnableMemberCache: Boolean
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.68` `added`
|
||||
|
||||
`v1.0.80` `modified`
|
||||
|
||||
将方法体进行 inline
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 是否启用 `Member` 缓存功能。
|
||||
|
||||
为防止 `Member` 复用过高造成的系统 GC 问题,此功能默认启用。
|
||||
|
||||
启用后会缓存已经找到的 `Method`、`Constructor`、`Field`。
|
||||
|
||||
缓存的 `Member` 都将处于 `MemberCacheStore` 的全局静态实例中。
|
||||
|
||||
推荐使用 `MethodFinder`、`ConstructorFinder`、`FieldFinder` 来获取 `Member`。
|
||||
|
||||
除非缓存的 `Member` 发生了混淆的问题,例如使用 R8 混淆后的 APP 的目标 `Member`,否则建议启用。
|
||||
|
||||
## configs <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun configs(initiate: Configs.() -> Unit)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 对 `Configs` 类实现了一个 `lambda` 方法体。
|
||||
|
||||
你可以轻松的调用它进行配置。
|
||||
|
||||
**Function Example**
|
||||
|
||||
你可以在 `HookEntryClass` 的 `onInit` 方法中调用 `configs` 方法和 `debugLog` 方法完成对 API 的功能配置,实时生效。
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
class HookEntryClass : IYukiHookXposedInit {
|
||||
|
||||
override fun onInit() {
|
||||
YukiHookAPI.configs {
|
||||
debugLog {
|
||||
tag = "YukiHookAPI"
|
||||
isEnable = true
|
||||
isRecord = false
|
||||
elements(TAG, PRIORITY, PACKAGE_NAME, USER_ID)
|
||||
}
|
||||
isDebug = BuildConfig.DEBUG
|
||||
isEnableModulePrefsCache = true
|
||||
isEnableModuleAppResourcesCache = true
|
||||
isEnableHookModuleStatus = true
|
||||
isEnableHookSharedPreferences = false
|
||||
isEnableDataChannel = true
|
||||
isEnableMemberCache = true
|
||||
}
|
||||
}
|
||||
|
||||
override fun onHook() {
|
||||
// Your code here.
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
若觉得上面的写法不美观,你还可以写得更加简洁。
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
class HookEntryClass : IYukiHookXposedInit {
|
||||
|
||||
override fun onInit() = configs {
|
||||
debugLog {
|
||||
tag = "YukiHookAPI"
|
||||
isEnable = true
|
||||
isRecord = false
|
||||
elements(TAG, PRIORITY, PACKAGE_NAME, USER_ID)
|
||||
}
|
||||
isDebug = BuildConfig.DEBUG
|
||||
isEnableModulePrefsCache = true
|
||||
isEnableModuleAppResourcesCache = true
|
||||
isEnableHookModuleStatus = true
|
||||
isEnableHookSharedPreferences = false
|
||||
isEnableDataChannel = true
|
||||
isEnableMemberCache = true
|
||||
}
|
||||
|
||||
override fun onHook() {
|
||||
// Your code here.
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
你也可以不通过 `configs` 和 `debugLog` 方法,直接进行配置。
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
class HookEntryClass : IYukiHookXposedInit {
|
||||
|
||||
override fun onInit() {
|
||||
YukiHookLogger.Configs.tag = "YukiHookAPI"
|
||||
YukiHookLogger.Configs.isEnable = true
|
||||
YukiHookLogger.Configs.isRecord = false
|
||||
YukiHookLogger.Configs.elements(
|
||||
YukiHookLogger.Configs.TAG,
|
||||
YukiHookLogger.Configs.PRIORITY,
|
||||
YukiHookLogger.Configs.PACKAGE_NAME,
|
||||
YukiHookLogger.Configs.USER_ID
|
||||
)
|
||||
YukiHookAPI.Configs.isDebug = BuildConfig.DEBUG
|
||||
YukiHookAPI.Configs.isEnableModulePrefsCache = true
|
||||
YukiHookAPI.Configs.isEnableModuleAppResourcesCache = true
|
||||
YukiHookAPI.Configs.isEnableHookModuleStatus = true
|
||||
YukiHookAPI.Configs.isEnableHookSharedPreferences = false
|
||||
YukiHookAPI.Configs.isEnableDataChannel = true
|
||||
YukiHookAPI.Configs.isEnableMemberCache = true
|
||||
}
|
||||
|
||||
override fun onHook() {
|
||||
// Your code here.
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## encase <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun encase(initiate: PackageParam.() -> Unit)
|
||||
```
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun encase(vararg hooker: YukiBaseHooker)
|
||||
```
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun encase(baseContext: Context?, initiate: PackageParam.() -> Unit)
|
||||
```
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun encase(baseContext: Context?, vararg hooker: YukiBaseHooker)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 装载 Hook 入口的核心方法。
|
||||
|
||||
**Function Example**
|
||||
|
||||
详情请参考
|
||||
|
||||
- [Created by lambda](../../../../../config/api-example#created-by-lambda)
|
||||
|
||||
- [Created by Custom Hooker](../../../../../config/api-example#created-by-custom-hooker)
|
||||
|
||||
- [Precautions when using as Hook API](../../../../../config/api-example#precautions-when-using-as-hook-api)
|
@@ -0,0 +1,42 @@
|
||||
---
|
||||
pageClass: code-page
|
||||
---
|
||||
|
||||
::: warning
|
||||
|
||||
The English translation of this page has not been completed, you are welcome to contribute translations to us.
|
||||
|
||||
You can use the **Chrome Translation Plugin** to translate entire pages for reference.
|
||||
|
||||
:::
|
||||
|
||||
# InjectYukiHookWithXposed <span class="symbol">- annotation</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
annotation class InjectYukiHookWithXposed(
|
||||
val sourcePath: String,
|
||||
val modulePackageName: String,
|
||||
val entryClassName: String,
|
||||
val isUsingResourcesHook: Boolean
|
||||
)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
`v1.0.80` `modified`
|
||||
|
||||
新增 `entryClassName` 参数
|
||||
|
||||
`v1.0.92` `modified`
|
||||
|
||||
新增 `isUsingResourcesHook` 参数
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 标识 `YukiHookAPI` 注入 Xposed 入口的类注解。
|
||||
|
||||
**Function Example**
|
||||
|
||||
详情请参考 [InjectYukiHookWithXposed Annotation](../../../../../../../config/xposed-using#injectyukihookwithxposed-annotation)。
|
@@ -0,0 +1,237 @@
|
||||
---
|
||||
pageClass: code-page
|
||||
---
|
||||
|
||||
::: warning
|
||||
|
||||
The English translation of this page has not been completed, you are welcome to contribute translations to us.
|
||||
|
||||
You can use the **Chrome Translation Plugin** to translate entire pages for reference.
|
||||
|
||||
:::
|
||||
|
||||
# CurrentClass <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
class CurrentClass internal constructor(internal val classSet: Class<*>, internal val instance: Any)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.70` `added`
|
||||
|
||||
`v1.1.0` `modified`
|
||||
|
||||
调整了构造方法的参数名称
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 当前实例的类操作对象。
|
||||
|
||||
## name <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
val name: String
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获得当前 `classSet` 的 `Class.getName`。
|
||||
|
||||
## simpleName <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
val simpleName: String
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获得当前 `classSet` 的 `Class.getSimpleName`。
|
||||
|
||||
## generic <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun generic(): GenericClass?
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获得当前实例中的泛型父类。
|
||||
|
||||
如果当前实例不存在泛型将返回 `null`。
|
||||
|
||||
## generic <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun generic(initiate: GenericClass.() -> Unit): GenericClass?
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获得当前实例中的泛型父类。
|
||||
|
||||
如果当前实例不存在泛型将返回 `null`。
|
||||
|
||||
## superClass <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun superClass(): SuperClass
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.80` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 调用父类实例。
|
||||
|
||||
## field <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun field(initiate: FieldConditions): FieldFinder.Result.Instance
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.70` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 调用当前实例中的变量。
|
||||
|
||||
## method <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun method(initiate: MethodConditions): MethodFinder.Result.Instance
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.70` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 调用当前实例中的方法。
|
||||
|
||||
## SuperClass <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inner class SuperClass internal constructor(internal val superClassSet: Class<*>)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.80` `added`
|
||||
|
||||
`v1.1.0` `modified`
|
||||
|
||||
新增 `superClassSet` 参数
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 当前类的父类实例的类操作对象。
|
||||
|
||||
### name <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
val name: String
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获得当前 `classSet` 中父类的 `Class.getName`。
|
||||
|
||||
### simpleName <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
val simpleName: String
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获得当前 `classSet` 中父类的 `Class.getSimpleName`。
|
||||
|
||||
### generic <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun generic(): GenericClass?
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获得当前实例父类中的泛型父类。
|
||||
|
||||
如果当前实例不存在泛型将返回 `null`。
|
||||
|
||||
### generic <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun generic(initiate: GenericClass.() -> Unit): GenericClass?
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获得当前实例父类中的泛型父类。
|
||||
|
||||
如果当前实例不存在泛型将返回 `null`。
|
||||
|
||||
### field <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun field(initiate: FieldConditions): FieldFinder.Result.Instance
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.80` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 调用父类实例中的变量。
|
||||
|
||||
### method <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun method(initiate: MethodConditions): MethodFinder.Result.Instance
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.80` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 调用父类实例中的方法。
|
@@ -0,0 +1,39 @@
|
||||
---
|
||||
pageClass: code-page
|
||||
---
|
||||
|
||||
::: warning
|
||||
|
||||
The English translation of this page has not been completed, you are welcome to contribute translations to us.
|
||||
|
||||
You can use the **Chrome Translation Plugin** to translate entire pages for reference.
|
||||
|
||||
:::
|
||||
|
||||
# GenericClass <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
class GenericClass internal constructor(private val type: ParameterizedType)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 当前 `Class` 的泛型父类操作对象。
|
||||
|
||||
## argument <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun argument(index: Int): Class<*>
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获得泛型参数数组下标的 `Class` 实例。
|
@@ -0,0 +1,31 @@
|
||||
---
|
||||
pageClass: code-page
|
||||
---
|
||||
|
||||
::: warning
|
||||
|
||||
The English translation of this page has not been completed, you are welcome to contribute translations to us.
|
||||
|
||||
You can use the **Chrome Translation Plugin** to translate entire pages for reference.
|
||||
|
||||
:::
|
||||
|
||||
# HookClass <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
class HookClass internal constructor(internal var instance: Class<*>?, internal var name: String, internal var throwable: Throwable?)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
`v1.1.0` `modified`
|
||||
|
||||
`HookClass` 相关功能不再对外开放
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 创建一个当前 Hook 的 `Class` 接管类。
|
||||
|
||||
`instance` 为实例,`name` 为实例完整包名,`throwable` 为找不到实例的时候抛出的异常。
|
@@ -0,0 +1,28 @@
|
||||
---
|
||||
next:
|
||||
text: 特色功能
|
||||
link: /zh-cn/api/special-features/reflection
|
||||
pageClass: code-page
|
||||
---
|
||||
|
||||
::: warning
|
||||
|
||||
The English translation of this page has not been completed, you are welcome to contribute translations to us.
|
||||
|
||||
You can use the **Chrome Translation Plugin** to translate entire pages for reference.
|
||||
|
||||
:::
|
||||
|
||||
# HookResources <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
class HookResources internal constructor(var instance: YukiResources?)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.80` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 创建一个当前 Hook 的 `YukiResources` 接管类。
|
@@ -0,0 +1,59 @@
|
||||
---
|
||||
pageClass: code-page
|
||||
---
|
||||
|
||||
::: warning
|
||||
|
||||
The English translation of this page has not been completed, you are welcome to contribute translations to us.
|
||||
|
||||
You can use the **Chrome Translation Plugin** to translate entire pages for reference.
|
||||
|
||||
:::
|
||||
|
||||
# VariousClass <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
class VariousClass(vararg var name: String)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 这是一个不确定性 `Class` 类名装载器,通过 `name` 装载 `Class` 名称数组。
|
||||
|
||||
## get <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun get(loader: ClassLoader? = null): Class<*>
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.70` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获取匹配的实体类。
|
||||
|
||||
使用当前 `loader` 装载目标 `Class`。
|
||||
|
||||
## getOrNull <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun getOrNull(loader: ClassLoader? = null): Class<*>?
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获取匹配的实体类。
|
||||
|
||||
使用当前 `loader` 装载目标 `Class`。
|
||||
|
||||
匹配不到 `Class` 会返回 `null`,不会抛出异常。
|
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,617 @@
|
||||
---
|
||||
pageClass: code-page
|
||||
---
|
||||
|
||||
::: warning
|
||||
|
||||
The English translation of this page has not been completed, you are welcome to contribute translations to us.
|
||||
|
||||
You can use the **Chrome Translation Plugin** to translate entire pages for reference.
|
||||
|
||||
:::
|
||||
|
||||
# YukiResourcesHookCreator <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
class YukiResourcesHookCreator(internal val packageParam: PackageParam, internal val hookResources: HookResources)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.80` `added`
|
||||
|
||||
`v1.1.0` `modified`
|
||||
|
||||
修正拼写错误的 **Creater** 命名到 **Creator**
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> `YukiHookAPI` 的 `Resources` 核心 Hook 实现类。
|
||||
|
||||
## injectResource <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun injectResource(tag: String, initiate: ResourceHookCreator.() -> Unit): ResourceHookCreator.Result
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.80` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 注入要 Hook 的 Resources。
|
||||
|
||||
**Function Example**
|
||||
|
||||
你可以注入任意 Resources,使用 `injectResource` 即可创建一个 `Hook` 对象。
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
injectResource {
|
||||
// Your code here.
|
||||
}
|
||||
```
|
||||
|
||||
你还可以自定义 `tag`,方便你在调试的时候能够区分你的 `Hook` 对象。
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
injectResource(tag = "KuriharaYuki") {
|
||||
// Your code here.
|
||||
}
|
||||
```
|
||||
|
||||
## ResourcesHookCreator <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inner class ResourcesHookCreator internal constructor(private val tag: String)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.80` `added`
|
||||
|
||||
`v1.1.0` `modified`
|
||||
|
||||
移除 `packageName`
|
||||
|
||||
修正拼写错误的 **Creater** 命名到 **Creator**
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> Hook 核心功能实现类。
|
||||
|
||||
查找和处理需要 Hook 的 Resources。
|
||||
|
||||
### resourceId <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
var resourceId: Int
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.80` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 直接设置需要替换的 Resources Id。
|
||||
|
||||
::: warning
|
||||
|
||||
不建议使用此方法设置目标需要 Hook 的 Resources Id,你可以使用 **conditions** 方法。
|
||||
|
||||
:::
|
||||
|
||||
**Function Example**
|
||||
|
||||
你可以直接设置并指定目标 Hook APP 的 Resources Id。
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
injectResource {
|
||||
resourceId = 0x7f060001.toInt()
|
||||
replaceTo(...)
|
||||
}
|
||||
```
|
||||
|
||||
### conditions <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun conditions(initiate: ConditionFinder.() -> Unit)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.80` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置 Resources 查找条件。
|
||||
|
||||
若你设置了 `resourceId` 则此方法将不会被使用。
|
||||
|
||||
**Function Example**
|
||||
|
||||
你可参考 [ConditionFinder](#conditionfinder-class) 查看详细用法。
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
injectResource {
|
||||
conditions {
|
||||
name = "test_string"
|
||||
string()
|
||||
}
|
||||
replaceTo(...)
|
||||
}
|
||||
```
|
||||
|
||||
### replaceTo <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun replaceTo(any: Any)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.80` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 替换指定 Resources 为指定的值。
|
||||
|
||||
**Function Example**
|
||||
|
||||
你可以替换找到的 Resources 为你想要的值,可以是 `String`、`Drawable` 等。
|
||||
|
||||
比如我们要替换一个找到的字符串 Resources。
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
injectResource {
|
||||
conditions {
|
||||
name = "test_string"
|
||||
string()
|
||||
}
|
||||
replaceTo("replace string")
|
||||
}
|
||||
```
|
||||
|
||||
或是替换为一个 `Drawable`,你无需对目标 Resources 实现 `fwd` 方法或 `DrawableLoader`。
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
injectResource {
|
||||
conditions {
|
||||
name = "test_drawable"
|
||||
drawable()
|
||||
}
|
||||
replaceTo(ColorDrawable(Color.RED))
|
||||
}
|
||||
```
|
||||
|
||||
### replaceToTrue <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun replaceToTrue()
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.80` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 替换指定 Resources 为 `true`。
|
||||
|
||||
::: danger
|
||||
|
||||
确保目标替换 Resources 的类型为 **Boolean**。
|
||||
|
||||
:::
|
||||
|
||||
### replaceToFalse <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun replaceToFalse()
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.80` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 替换指定 Resources 为 `false`。
|
||||
|
||||
::: danger
|
||||
|
||||
确保目标替换 Resources 的类型为 **Boolean**。
|
||||
|
||||
:::
|
||||
|
||||
### replaceToModuleResource <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun replaceToModuleResource(resId: Int)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.80` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 替换为当前 Xposed 模块的 Resources。
|
||||
|
||||
你可以直接使用模块的 `R.string.xxx`、`R.mipmap.xxx`、`R.drawable.xxx` 替换 Hook APP 的 Resources。
|
||||
|
||||
**Function Example**
|
||||
|
||||
使用此方法可非常方便地使用当前模块的 Resources 去替换目标 Hook APP 的 Resources。
|
||||
|
||||
这个过程你无需对目标 Resources 实现 `fwd` 方法。
|
||||
|
||||
比如我们要替换一个字符串。
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
injectResource {
|
||||
conditions {
|
||||
name = "test_string"
|
||||
string()
|
||||
}
|
||||
replaceToModuleResource(R.string.module_string)
|
||||
}
|
||||
```
|
||||
|
||||
还可以替换一些复杂的 Resources,比如 `xml` 创建的 `drawable`。
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
injectResource {
|
||||
conditions {
|
||||
name = "test_drawable"
|
||||
drawable()
|
||||
}
|
||||
replaceToModuleResource(R.drawable.module_drawable)
|
||||
}
|
||||
```
|
||||
|
||||
### injectAsLayout <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun injectAsLayout(initiate: YukiResources.LayoutInflatedParam.() -> Unit)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.80` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 作为装载的布局注入。
|
||||
|
||||
**Function Example**
|
||||
|
||||
你可以直接注入一个布局监听并修改它的内部 `View`。
|
||||
|
||||
> The following example
|
||||
|
||||
```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`。
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
injectResource {
|
||||
conditions {
|
||||
name = "activity_main"
|
||||
layout()
|
||||
}
|
||||
injectAsLayout {
|
||||
Toast.makeText(currentView.context, "Hook this", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### ConditionFinder <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inner class ConditionFinder internal constructor()
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.80` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> Resources 查找条件实现类。
|
||||
|
||||
#### name <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
var name: String
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.80` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置 Resources 名称。
|
||||
|
||||
#### anim <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun anim()
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.80` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置 Resources 类型为动画。
|
||||
|
||||
#### animator <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun animator()
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.80` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置 Resources 类型为属性动画。
|
||||
|
||||
#### bool <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun bool()
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.80` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置 Resources 类型为布朗(Boolean)。
|
||||
|
||||
#### color <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun color()
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.80` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置 Resources 类型为颜色(Color)。
|
||||
|
||||
#### dimen <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun dimen()
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.80` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置 Resources 类型为尺寸(Dimention)。
|
||||
|
||||
#### drawable <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun drawable()
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.80` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置 Resources 类型为 Drawable。
|
||||
|
||||
#### integer <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun integer()
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.80` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置 Resources 类型为整型(Integer)。
|
||||
|
||||
#### layout <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun layout()
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.80` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置 Resources 类型为布局(Layout)。
|
||||
|
||||
#### plurals <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun plurals()
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.80` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置 Resources 类型为 Plurals。
|
||||
|
||||
#### string <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun string()
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.80` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置 Resources 类型为字符串(String)。
|
||||
|
||||
#### xml <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun xml()
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.80` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置 Resources 类型为 Xml。
|
||||
|
||||
#### mipmap <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun mipmap()
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.80` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置 Resources 类型为位图(Mipmap)。
|
||||
|
||||
#### array <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun array()
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置 Resources 类型为数组(Array)。
|
||||
|
||||
### Result <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inner class Result internal constructor()
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.80` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 监听全部 Hook 结果实现类,可在这里处理失败事件监听。
|
||||
|
||||
#### result <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun result(initiate: Result.() -> Unit): Result
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.80` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 创建监听事件方法体。
|
||||
|
||||
#### by <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun by(condition: () -> Boolean): Result
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.80` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 添加执行 Hook 需要满足的条件,不满足条件将直接停止 Hook。
|
||||
|
||||
### onHookingFailure <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun onHookingFailure(result: (Throwable) -> Unit): Result
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.80` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 监听 Hook 过程发生错误的回调方法。
|
||||
|
||||
### ignoredHookingFailure <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun ignoredHookingFailure(): Result
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.80` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 忽略 Hook 过程出现的错误。
|
@@ -0,0 +1,131 @@
|
||||
---
|
||||
pageClass: code-page
|
||||
---
|
||||
|
||||
::: warning
|
||||
|
||||
The English translation of this page has not been completed, you are welcome to contribute translations to us.
|
||||
|
||||
You can use the **Chrome Translation Plugin** to translate entire pages for reference.
|
||||
|
||||
:::
|
||||
|
||||
# BaseFinder <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
abstract class BaseFinder
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.70` `added`
|
||||
|
||||
`v1.1.0` `modified`
|
||||
|
||||
分离原始命名 `BaseFinder` 中的部分方法与参数到 `MemberBaseFinder`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 这是 `Class` 与 `Member` 查找类功能的基本类实现。
|
||||
|
||||
## BaseFinder.IndexTypeCondition <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inner class IndexTypeCondition internal constructor(private val type: IndexConfigType)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.70` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 字节码下标筛选实现类。
|
||||
|
||||
### index <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun index(num: Int)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.70` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置下标。
|
||||
|
||||
若 `index` 小于零则为倒序,此时可以使用 `IndexTypeConditionSort.reverse` 方法实现。
|
||||
|
||||
可使用 `IndexTypeConditionSort.first` 和 `IndexTypeConditionSort.last` 设置首位和末位筛选条件。
|
||||
|
||||
### index <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun index(): IndexTypeConditionSort
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.70` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 得到下标。
|
||||
|
||||
### IndexTypeConditionSort <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inner class IndexTypeConditionSort internal constructor()
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.70` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 字节码下标排序实现类。
|
||||
|
||||
#### first <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun first()
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.70` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置满足条件的第一个。
|
||||
|
||||
#### last <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun last()
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.70` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置满足条件的最后一个。
|
||||
|
||||
#### reverse <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun reverse(num: Int)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.70` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置倒序下标。
|
@@ -0,0 +1,83 @@
|
||||
---
|
||||
pageClass: code-page
|
||||
---
|
||||
|
||||
::: warning
|
||||
|
||||
The English translation of this page has not been completed, you are welcome to contribute translations to us.
|
||||
|
||||
You can use the **Chrome Translation Plugin** to translate entire pages for reference.
|
||||
|
||||
:::
|
||||
|
||||
# CountRules <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
class CountRules private constructor()
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 这是一个模糊 `Class`、`Member` 数组 (下标) 个数条件实现类。
|
||||
|
||||
可对 R8 混淆后的 `Class`、`Member` 进行更加详细的定位。
|
||||
|
||||
## Int.isZero <span class="symbol">- i-ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun Int.isZero(): Boolean
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 是否为 0。
|
||||
|
||||
## Int.moreThan <span class="symbol">- i-ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun Int.moreThan(count: Int): Boolean
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 大于 `count`。
|
||||
|
||||
## Int.lessThan <span class="symbol">- i-ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun Int.lessThan(count: Int): Boolean
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 小于 `count`。
|
||||
|
||||
## Int.inInterval <span class="symbol">- i-ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun Int.inInterval(countRange: IntRange): Boolean
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 在 `countRange` 区间 A ≤ this ≤ B。
|
@@ -0,0 +1,271 @@
|
||||
---
|
||||
pageClass: code-page
|
||||
---
|
||||
|
||||
::: warning
|
||||
|
||||
The English translation of this page has not been completed, you are welcome to contribute translations to us.
|
||||
|
||||
You can use the **Chrome Translation Plugin** to translate entire pages for reference.
|
||||
|
||||
:::
|
||||
|
||||
# ModifierRules <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
class ModifierRules private constructor()
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.67` `added`
|
||||
|
||||
`v1.1.0` `modified`
|
||||
|
||||
新增 `Class` 的描述符判断
|
||||
|
||||
作为 lambda 整体判断条件使用
|
||||
|
||||
移动到 base 包名
|
||||
|
||||
私有化构造方法
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 这是一个 `Class`、`Member` 描述符条件实现类。
|
||||
|
||||
可对 R8 混淆后的 `Class`、`Member` 进行更加详细的定位。
|
||||
|
||||
## isPublic <span class="symbol">- i-ext-field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
val isPublic: Boolean
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.67` `added`
|
||||
|
||||
`v1.1.0` `modified`
|
||||
|
||||
统一合并到扩展方法并改名
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> `Class`、`Member` 类型是否包含 `public`。
|
||||
|
||||
## isPrivate <span class="symbol">- i-ext-field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
val isPrivate: Boolean
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.67` `added`
|
||||
|
||||
`v1.1.0` `modified`
|
||||
|
||||
统一合并到扩展方法并改名
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> `Class`、`Member` 类型是否包含 `private`。
|
||||
|
||||
## isProtected <span class="symbol">- i-ext-field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
val isProtected: Boolean
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.67` `added`
|
||||
|
||||
`v1.1.0` `modified`
|
||||
|
||||
统一合并到扩展方法并改名
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> `Class`、`Member` 类型是否包含 `protected`。
|
||||
|
||||
## isStatic <span class="symbol">- i-ext-field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
val isStatic: Boolean
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.67` `added`
|
||||
|
||||
`v1.1.0` `modified`
|
||||
|
||||
统一合并到扩展方法并改名
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> `Class`、`Member` 类型是否包含 `static`。
|
||||
|
||||
对于任意的静态 `Class`、`Member` 可添加此描述进行确定。
|
||||
|
||||
::: warning
|
||||
|
||||
Kotlin → Jvm 后的 **object** 类中的方法并不是静态的。
|
||||
|
||||
:::
|
||||
|
||||
## isFinal <span class="symbol">- i-ext-field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
val isFinal: Boolean
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.67` `added`
|
||||
|
||||
`v1.1.0` `modified`
|
||||
|
||||
统一合并到扩展方法并改名
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> `Class`、`Member` 类型是否包含 `final`。
|
||||
|
||||
::: warning
|
||||
|
||||
Kotlin → Jvm 后没有 **open** 符号标识的 **Class**、**Member** 和没有任何关联的 **Class**、**Member** 都将为 **final**。
|
||||
|
||||
:::
|
||||
|
||||
## isSynchronized <span class="symbol">- i-ext-field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
val isSynchronized: Boolean
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.67` `added`
|
||||
|
||||
`v1.1.0` `modified`
|
||||
|
||||
统一合并到扩展方法并改名
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> `Class`、`Member` 类型是否包含 `synchronized`。
|
||||
|
||||
## isVolatile <span class="symbol">- i-ext-field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
val isVolatile: Boolean
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.67` `added`
|
||||
|
||||
`v1.1.0` `modified`
|
||||
|
||||
统一合并到扩展方法并改名
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> `Field` 类型是否包含 `volatile`。
|
||||
|
||||
## isTransient <span class="symbol">- i-ext-field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
val isTransient: Boolean
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.67` `added`
|
||||
|
||||
`v1.1.0` `modified`
|
||||
|
||||
统一合并到扩展方法并改名
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> `Field` 类型是否包含 `transient`。
|
||||
|
||||
## isNative <span class="symbol">- i-ext-field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
val isNative: Boolean
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.67` `added`
|
||||
|
||||
`v1.1.0` `modified`
|
||||
|
||||
统一合并到扩展方法并改名
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> `Method` 类型是否包含 `native`。
|
||||
|
||||
对于任意 JNI 对接的 `Method` 可添加此描述进行确定。
|
||||
|
||||
## isInterface <span class="symbol">- i-ext-field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
val isInterface: Boolean
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.67` `added`
|
||||
|
||||
`v1.1.0` `modified`
|
||||
|
||||
统一合并到扩展方法并改名
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> `Class` 类型是否包含 `interface`。
|
||||
|
||||
## isAbstract <span class="symbol">- i-ext-field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
val isAbstract: Boolean
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.67` `added`
|
||||
|
||||
`v1.1.0` `modified`
|
||||
|
||||
统一合并到扩展方法并改名
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> `Class`、`Member` 类型是否包含 `abstract`。
|
||||
|
||||
对于任意的抽象 `Class`、`Member` 可添加此描述进行确定。
|
||||
|
||||
## isStrict <span class="symbol">- i-ext-field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
val isStrict: Boolean
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.67` `added`
|
||||
|
||||
`v1.1.0` `modified`
|
||||
|
||||
统一合并到扩展方法并改名
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> `Class`、`Member` 类型是否包含 `strictfp`。
|
@@ -0,0 +1,167 @@
|
||||
---
|
||||
pageClass: code-page
|
||||
---
|
||||
|
||||
::: warning
|
||||
|
||||
The English translation of this page has not been completed, you are welcome to contribute translations to us.
|
||||
|
||||
You can use the **Chrome Translation Plugin** to translate entire pages for reference.
|
||||
|
||||
:::
|
||||
|
||||
# NameRules <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
class NameRules private constructor()
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.88` `added`
|
||||
|
||||
`v1.1.0` `modified`
|
||||
|
||||
`NameConditions` 更名为 `NameRules`
|
||||
|
||||
作为 lambda 整体判断条件使用
|
||||
|
||||
移动到 base 包名
|
||||
|
||||
私有化构造方法
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 这是一个模糊 `Class`、`Member` 名称条件实现类。
|
||||
|
||||
可对 R8 混淆后的 `Class`、`Member` 进行更加详细的定位。
|
||||
|
||||
## String.isSynthetic <span class="symbol">- i-ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun String.isSynthetic(index: Int): Boolean
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.88` `added`
|
||||
|
||||
`v1.1.0` `modified`
|
||||
|
||||
统一合并到扩展方法并改名
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 是否为匿名类的主类调用对象。
|
||||
|
||||
## String.isOnlySymbols <span class="symbol">- i-ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun String.isOnlySymbols(): Boolean
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.88` `added`
|
||||
|
||||
`v1.1.0` `modified`
|
||||
|
||||
统一合并到扩展方法并改名
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 是否只有符号。
|
||||
|
||||
## String.isOnlyLetters <span class="symbol">- i-ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun String.isOnlyLetters(): Boolean
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.88` `added`
|
||||
|
||||
`v1.1.0` `modified`
|
||||
|
||||
统一合并到扩展方法并改名
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 是否只有字母。
|
||||
|
||||
## String.isOnlyNumbers <span class="symbol">- i-ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun String.isOnlyNumbers(): Boolean
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.88` `added`
|
||||
|
||||
`v1.1.0` `modified`
|
||||
|
||||
统一合并到扩展方法并改名
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 是否只有数字。
|
||||
|
||||
## String.isOnlyLettersNumbers <span class="symbol">- i-ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun String.isOnlyLettersNumbers(): Boolean
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.88` `added`
|
||||
|
||||
`v1.1.0` `modified`
|
||||
|
||||
统一合并到扩展方法并改名
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 是否只有字母或数字。
|
||||
|
||||
## String.isOnlyLowercase <span class="symbol">- i-ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun String.isOnlyLowercase(): Boolean
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.88` `added`
|
||||
|
||||
`v1.1.0` `modified`
|
||||
|
||||
统一合并到扩展方法并改名
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 是否只有小写字母。
|
||||
|
||||
在没有其它条件的情况下设置此条件允许判断对象存在字母以外的字符。
|
||||
|
||||
## String.isOnlyUppercase <span class="symbol">- i-ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun String.isOnlyUppercase(): Boolean
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.88` `added`
|
||||
|
||||
`v1.1.0` `modified`
|
||||
|
||||
统一合并到扩展方法并改名
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 是否只有大写字母。
|
||||
|
||||
在没有其它条件的情况下设置此条件允许判断对象存在字母以外的字符。
|
@@ -0,0 +1,733 @@
|
||||
---
|
||||
pageClass: code-page
|
||||
---
|
||||
|
||||
::: warning
|
||||
|
||||
The English translation of this page has not been completed, you are welcome to contribute translations to us.
|
||||
|
||||
You can use the **Chrome Translation Plugin** to translate entire pages for reference.
|
||||
|
||||
:::
|
||||
|
||||
# DexClassFinder <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
class DexClassFinder internal constructor(
|
||||
internal var name: String,
|
||||
internal var async: Boolean,
|
||||
override val loaderSet: ClassLoader?
|
||||
) : ClassBaseFinder
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> `Class` 查找类。
|
||||
|
||||
可使用 `BaseDexClassLoader` 通过指定条件查找指定 `Class` 或一组 `Class`。
|
||||
|
||||
::: warning
|
||||
|
||||
此功能尚在试验阶段,性能与稳定性可能仍然存在问题,使用过程遇到问题请向我们报告并帮助我们改进。
|
||||
|
||||
:::
|
||||
|
||||
## companion object <span class="symbol">- object</span>
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
### clearCache <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun clearCache(context: Context?, versionName: String?, versionCode: Long?)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 清除当前 `DexClassFinder` 的 `Class` 缓存。
|
||||
|
||||
适用于全部通过 [ClassLoader.searchClass](../../../factory/ReflectionFactory#classloader-searchclass-ext-method) 或 [PackageParam.searchClass](../../../param/PackageParam#searchclass-method) 获取的 `DexClassFinder`。
|
||||
|
||||
## fullName <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
var fullName: String
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置 `Class` 完整名称。
|
||||
|
||||
只会查找匹配到的 `Class.getName`。
|
||||
|
||||
例如 `com.demo.Test` 需要填写 `com.demo.Test`。
|
||||
|
||||
## simpleName <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
var simpleName: String
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置 `Class` 简单名称。
|
||||
|
||||
只会查找匹配到的 `Class.getSimpleName`。
|
||||
|
||||
例如 `com.demo.Test` 只需要填写 `Test`。
|
||||
|
||||
对于匿名类例如 `com.demo.Test$InnerTest` 会为空,此时你可以使用 [singleName](#singlename-field)。
|
||||
|
||||
## singleName <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
var singleName: String
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置 `Class` 独立名称。
|
||||
|
||||
设置后将首先使用 `Class.getSimpleName`,若为空则会使用 `Class.getName` 进行处理。
|
||||
|
||||
例如 `com.demo.Test` 只需要填写 `Test`。
|
||||
|
||||
对于匿名类例如 `com.demo.Test$InnerTest` 只需要填写 `Test$InnerTest`。
|
||||
|
||||
## from <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun from(vararg name: String): FromPackageRules
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置在指定包名范围查找当前 `Class`。
|
||||
|
||||
设置后仅会在当前 `name` 开头匹配的包名路径下进行查找,可提升查找速度。
|
||||
|
||||
例如 ↓
|
||||
|
||||
`com.demo.test`
|
||||
|
||||
`com.demo.test.demo`
|
||||
|
||||
::: warning
|
||||
|
||||
建议设置此参数指定查找范围,否则 **Class** 过多时将会非常慢。
|
||||
|
||||
:::
|
||||
|
||||
## modifiers <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun modifiers(conditions: ModifierConditions)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置 `Class` 标识符筛选条件。
|
||||
|
||||
可不设置筛选条件。
|
||||
|
||||
## fullName <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun fullName(value: String): ClassNameRules
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置 `Class` 完整名称。
|
||||
|
||||
只会查找匹配到的 `Class.getName`。
|
||||
|
||||
例如 `com.demo.Test` 需要填写 `com.demo.Test`。
|
||||
|
||||
## simpleName <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun simpleName(value: String): ClassNameRules
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置 `Class` 简单名称。
|
||||
|
||||
只会查找匹配到的 `Class.getSimpleName`。
|
||||
|
||||
例如 `com.demo.Test` 只需要填写 `Test`。
|
||||
|
||||
对于匿名类例如 `com.demo.Test$InnerTest 会为空`,此时你可以使用 [singleName](#singlename-method)。
|
||||
|
||||
## singleName <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun singleName(value: String): ClassNameRules
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置 `Class` 独立名称。
|
||||
|
||||
设置后将首先使用 `Class.getSimpleName`,若为空则会使用 `Class.getName` 进行处理。
|
||||
|
||||
例如 `com.demo.Test` 只需要填写 `Test`。
|
||||
|
||||
对于匿名类例如 `com.demo.Test$InnerTest` 只需要填写 `Test$InnerTest`。
|
||||
|
||||
## fullName <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun fullName(conditions: NameConditions)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置 `Class` 完整名称条件。
|
||||
|
||||
只会查找匹配到的 `Class.getName`。
|
||||
|
||||
## simpleName <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun simpleName(conditions: NameConditions)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置 `Class` 简单名称条件。
|
||||
|
||||
只会查找匹配到的 `Class.getSimpleName`。
|
||||
|
||||
## singleName <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun singleName(conditions: NameConditions)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置 `Class` 独立名称条件。
|
||||
|
||||
设置后将首先使用 `Class.getSimpleName`,若为空则会使用 `Class.getName` 进行处理。
|
||||
|
||||
## extends <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun <reified T> extends()
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置 `Class` 继承的父类。
|
||||
|
||||
## extends <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun extends(vararg name: String)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置 `Class` 继承的父类。
|
||||
|
||||
会同时查找 `name` 中所有匹配的父类。
|
||||
|
||||
## implements <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun <reified T> implements()
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置 `Class` 实现的接口类。
|
||||
|
||||
## implements <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun implements(vararg name: String)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置 `Class` 实现的接口类。
|
||||
|
||||
会同时查找 `name` 中所有匹配的接口类。
|
||||
|
||||
## anonymous <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun anonymous()
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 标识 `Class` 为匿名类。
|
||||
|
||||
例如 `com.demo.Test$1` 或 `com.demo.Test$InnerTest`。
|
||||
|
||||
标识后你可以使用 [enclosing](#enclosing-method) 来进一步指定匿名类的 (封闭类) 主类。
|
||||
|
||||
## noExtends <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun noExtends()
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置 `Class` 没有任何继承。
|
||||
|
||||
此时 `Class` 只应该继承于 `Any`。
|
||||
|
||||
::: warning
|
||||
|
||||
设置此条件后 [extends](#extends-method) 将失效。
|
||||
|
||||
:::
|
||||
|
||||
## noImplements <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun noImplements()
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置 `Class` 没有任何接口。
|
||||
|
||||
::: warning
|
||||
|
||||
设置此条件后 [implements](#implements-method) 将失效。
|
||||
|
||||
:::
|
||||
|
||||
## noSuper <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun noSuper()
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置 `Class` 没有任何继承与接口。
|
||||
|
||||
此时 `Class` 只应该继承于 `Any`。
|
||||
|
||||
::: warning
|
||||
|
||||
设置此条件后 [extends](#extends-method) 与 [implements](#implements-method) 将失效。
|
||||
|
||||
:::
|
||||
|
||||
## enclosing <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun <reified T> enclosing()
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置 `Class` 匿名类的 (封闭类) 主类。
|
||||
|
||||
## enclosing <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun enclosing(vararg name: String)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置 `Class` 匿名类的 (封闭类) 主类。
|
||||
|
||||
会同时查找 `name` 中所有匹配的 (封闭类) 主类。
|
||||
|
||||
## FromPackageRules <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inner class FromPackageRules internal constructor(private val packages: ArrayList<ClassRulesData.PackageRulesData>)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 包名范围名称过滤匹配条件实现类。
|
||||
|
||||
### absolute <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun absolute()
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置包名绝对匹配。
|
||||
|
||||
例如有如下包名 ↓
|
||||
|
||||
`com.demo.test.a`
|
||||
|
||||
`com.demo.test.a.b`
|
||||
|
||||
`com.demo.test.active`
|
||||
|
||||
若包名条件为 `com.demo.test.a` 则绝对匹配仅能匹配到第一个。
|
||||
|
||||
相反地,不设置以上示例会全部匹配。
|
||||
|
||||
## ClassNameRules <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inner class ClassNameRules internal constructor(private val name: ClassRulesData.NameRulesData)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 类名匹配条件实现类。
|
||||
|
||||
### optional <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun optional()
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置类名可选。
|
||||
|
||||
例如有如下类名 ↓
|
||||
|
||||
`com.demo.Test` **fullName** / `Test` **simpleName**
|
||||
|
||||
`defpackage.a` **fullName** / `a` **simpleName**
|
||||
|
||||
这两个类名都是同一个类,但是在有些版本中被混淆有些版本没有。
|
||||
|
||||
此时可设置类名为 `com.demo.Test` **fullName** / `Test` **simpleName**。
|
||||
|
||||
这样就可在完全匹配类名情况下使用类名而忽略其它查找条件,否则忽略此条件继续使用其它查找条件。
|
||||
|
||||
## member <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun member(initiate: MemberRules.() -> Unit): MemberRulesResult
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置 `Class` 满足的 `Member` 条件。
|
||||
|
||||
## field <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun field(initiate: FieldRules.() -> Unit): MemberRulesResult
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置 `Class` 满足的 `Field` 条件。
|
||||
|
||||
## method <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun method(initiate: MethodRules.() -> Unit): MemberRulesResult
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置 `Class` 满足的 `Method` 条件。
|
||||
|
||||
## constructor <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun constructor(initiate: ConstructorRules.() -> Unit): MemberRulesResult
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置 `Class` 满足的 `Constructor` 条件。
|
||||
|
||||
## Result <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inner class Result internal constructor(internal var isNotFound: Boolean, internal var throwable: Throwable?) : BaseResult
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> `Class` 查找结果实现类。
|
||||
|
||||
### result <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun result(initiate: Result.() -> Unit): Result
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 创建监听结果事件方法体。
|
||||
|
||||
### get <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun get(): Class<*>?
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 得到 `Class` 本身。
|
||||
|
||||
若有多个 `Class` 结果只会返回第一个。
|
||||
|
||||
在查找条件找不到任何结果的时候将返回 `null`。
|
||||
|
||||
若你设置了 `async` 请使用 [wait](#wait-method) 方法。
|
||||
|
||||
### all <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun all(): HashSet<Class<*>>
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 得到 `Class` 本身数组。
|
||||
|
||||
返回全部查找条件匹配的多个 `Class` 实例。
|
||||
|
||||
在查找条件找不到任何结果的时候将返回空的 `HashSet`。
|
||||
|
||||
若你设置了 `async` 请使用 [waitAll](#waitall-method) 方法。
|
||||
|
||||
### all <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun all(result: (Class<*>) -> Unit): Result
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 得到 `Class` 本身数组 (依次遍历)。
|
||||
|
||||
回调全部查找条件匹配的多个 `Class` 实例。
|
||||
|
||||
在查找条件找不到任何结果的时候将不会执行。
|
||||
|
||||
若你设置了 `async` 请使用 [waitAll](#waitall-method) 方法。
|
||||
|
||||
### wait <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun wait(result: (Class<*>?) -> Unit): Result
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 得到 `Class` 本身 (异步)。
|
||||
|
||||
若有多个 `Class` 结果只会回调第一个。
|
||||
|
||||
在查找条件找不到任何结果的时候将回调 null。
|
||||
|
||||
你需要设置 `async` 后此方法才会被回调,否则请使用 [get](#get-method) 方法。
|
||||
|
||||
### waitAll <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun waitAll(result: (HashSet<Class<*>>) -> Unit): Result
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 得到 `Class` 本身数组 (异步)。
|
||||
|
||||
回调全部查找条件匹配的多个 `Class` 实例。
|
||||
|
||||
在查找条件找不到任何结果的时候将回调空的 `HashSet`。
|
||||
|
||||
你需要设置 `async` 后此方法才会被回调,否则请使用 [all](#all-method) 方法。
|
||||
|
||||
### onNoClassDefFoundError <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun onNoClassDefFoundError(result: (Throwable) -> Unit): Result
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 监听找不到 `Class` 时。
|
||||
|
||||
### ignored <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun ignored(): Result
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 忽略异常并停止打印任何错误日志。
|
||||
|
||||
此时若要监听异常结果,你需要手动实现 [onNoClassDefFoundError](#onnoclassdeffounderror-method) 方法。
|
@@ -0,0 +1,131 @@
|
||||
---
|
||||
pageClass: code-page
|
||||
---
|
||||
|
||||
::: warning
|
||||
|
||||
The English translation of this page has not been completed, you are welcome to contribute translations to us.
|
||||
|
||||
You can use the **Chrome Translation Plugin** to translate entire pages for reference.
|
||||
|
||||
:::
|
||||
|
||||
# ConstructorRules <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
class ConstructorRules internal constructor(internal val rulesData: ConstructorRulesData) : BaseRules
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> `Constructor` 查找条件实现类。
|
||||
|
||||
## paramCount <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
var paramCount: Int
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置 `Constructor` 参数个数。
|
||||
|
||||
你可以不使用 `param` 指定参数类型而是仅使用此变量指定参数个数。
|
||||
|
||||
若参数个数小于零则忽略并使用 `param`。
|
||||
|
||||
## modifiers <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun modifiers(conditions: ModifierConditions)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置 `Constructor` 标识符筛选条件。
|
||||
|
||||
可不设置筛选条件。
|
||||
|
||||
## emptyParam <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun emptyParam()
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置 `Constructor` 空参数、无参数。
|
||||
|
||||
## param <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun param(vararg paramType: Any)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置 `Constructor` 参数。
|
||||
|
||||
如果同时使用了 `paramCount` 则 `paramType` 的数量必须与 `paramCount` 完全匹配。
|
||||
|
||||
如果 `Constructor` 中存在一些无意义又很长的类型,你可以使用 `VagueType` 来替代它。
|
||||
|
||||
::: danger
|
||||
|
||||
无参 **Constructor** 请使用 **emptyParam** 设置查找条件。
|
||||
|
||||
有参 **Constructor** 必须使用此方法设定参数或使用 **paramCount** 指定个数。
|
||||
|
||||
:::
|
||||
|
||||
## paramCount <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun paramCount(numRange: IntRange)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置 `Constructor` 参数个数范围。
|
||||
|
||||
你可以不使用 `param` 指定参数类型而是仅使用此方法指定参数个数范围。
|
||||
|
||||
## paramCount <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun paramCount(conditions: CountConditions)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置 `Constructor` 参数个数条件。
|
||||
|
||||
你可以不使用 `param` 指定参数类型而是仅使用此方法指定参数个数条件。
|
@@ -0,0 +1,85 @@
|
||||
---
|
||||
pageClass: code-page
|
||||
---
|
||||
|
||||
::: warning
|
||||
|
||||
The English translation of this page has not been completed, you are welcome to contribute translations to us.
|
||||
|
||||
You can use the **Chrome Translation Plugin** to translate entire pages for reference.
|
||||
|
||||
:::
|
||||
|
||||
# FieldRules <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
class FieldRules internal constructor(internal val rulesData: FieldRulesData) : BaseRules
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> `Field` 查找条件实现类。
|
||||
|
||||
## name <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
var name: String
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置 `Field` 名称。
|
||||
|
||||
## type <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
var type: Any?
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置 `Field` 类型。
|
||||
|
||||
可不填写类型。
|
||||
|
||||
## modifiers <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun modifiers(conditions: ModifierConditions)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置 `Field` 标识符筛选条件。
|
||||
|
||||
可不设置筛选条件。
|
||||
|
||||
## name <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun name(conditions: NameConditions)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置 `Field` 名称条件。
|
@@ -0,0 +1,41 @@
|
||||
---
|
||||
pageClass: code-page
|
||||
---
|
||||
|
||||
::: warning
|
||||
|
||||
The English translation of this page has not been completed, you are welcome to contribute translations to us.
|
||||
|
||||
You can use the **Chrome Translation Plugin** to translate entire pages for reference.
|
||||
|
||||
:::
|
||||
|
||||
# MemberRules <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
class MemberRules internal constructor(internal val rulesData: MemberRulesData) : BaseRules
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> `Member` 查找条件实现类。
|
||||
|
||||
## modifiers <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun modifiers(conditions: ModifierConditions)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置 `Member` 标识符筛选条件。
|
||||
|
||||
可不设置筛选条件。
|
@@ -0,0 +1,175 @@
|
||||
---
|
||||
pageClass: code-page
|
||||
---
|
||||
|
||||
::: warning
|
||||
|
||||
The English translation of this page has not been completed, you are welcome to contribute translations to us.
|
||||
|
||||
You can use the **Chrome Translation Plugin** to translate entire pages for reference.
|
||||
|
||||
:::
|
||||
|
||||
# MethodRules <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
class MethodRules internal constructor(internal val rulesData: MethodRulesData) : BaseRules
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> `Method` 查找条件实现类。
|
||||
|
||||
## name <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
var name: String
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置 `Method` 名称。
|
||||
|
||||
## paramCount <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
var paramCount: Int
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置 `Method` 参数个数。
|
||||
|
||||
你可以不使用 `param` 指定参数类型而是仅使用此变量指定参数个数。
|
||||
|
||||
若参数个数小于零则忽略并使用 `param`。
|
||||
|
||||
## returnType <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
var returnType: Any?
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置 `Method` 返回值。
|
||||
|
||||
可不填写返回值。
|
||||
|
||||
## modifiers <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun modifiers(conditions: ModifierConditions)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置 `Method` 标识符筛选条件。
|
||||
|
||||
可不设置筛选条件。
|
||||
|
||||
## emptyParam <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun emptyParam()
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置 `Method` 空参数、无参数。
|
||||
|
||||
## param <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun param(vararg paramType: Any)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置 `Method` 参数。
|
||||
|
||||
如果同时使用了 `paramCount` 则 `paramType` 的数量必须与 `paramCount` 完全匹配。
|
||||
|
||||
如果 `Method` 中存在一些无意义又很长的类型,你可以使用 `VagueType` 来替代它。
|
||||
|
||||
::: danger
|
||||
|
||||
无参 **Method** 请使用 **emptyParam** 设置查找条件。
|
||||
|
||||
有参 **Method** 必须使用此方法设定参数或使用 **paramCount** 指定个数。
|
||||
|
||||
:::
|
||||
|
||||
## name <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun name(conditions: NameConditions)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置 `Method` 名称条件。
|
||||
|
||||
## paramCount <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun paramCount(numRange: IntRange)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置 `Method` 参数个数范围。
|
||||
|
||||
你可以不使用 `param` 指定参数类型而是仅使用此方法指定参数个数范围。
|
||||
|
||||
## paramCount <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun paramCount(conditions: CountConditions)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置 `Method` 参数个数条件。
|
||||
|
||||
你可以不使用 `param` 指定参数类型而是仅使用此方法指定参数个数条件。
|
@@ -0,0 +1,81 @@
|
||||
---
|
||||
pageClass: code-page
|
||||
---
|
||||
|
||||
::: warning
|
||||
|
||||
The English translation of this page has not been completed, you are welcome to contribute translations to us.
|
||||
|
||||
You can use the **Chrome Translation Plugin** to translate entire pages for reference.
|
||||
|
||||
:::
|
||||
|
||||
# MemberRulesResult <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
class MemberRulesResult internal constructor(private val rulesData: MemberRulesData)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 当前 `Member` 查找条件结果实现类。
|
||||
|
||||
## none <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun none(): MemberRulesResult
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置当前 `Member` 在查找条件中个数为 `0`。
|
||||
|
||||
## count <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun count(num: Int): MemberRulesResult
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置当前 `Member` 在查找条件中需要全部匹配的个数。
|
||||
|
||||
## count <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun count(numRange: IntRange): MemberRulesResult
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置当前 `Member` 在查找条件中需要全部匹配的个数范围。
|
||||
|
||||
## count <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun count(conditions: CountConditions): MemberRulesResult
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置当前 `Member` 在查找条件中需要全部匹配的个数条件。
|
@@ -0,0 +1,764 @@
|
||||
---
|
||||
pageClass: code-page
|
||||
---
|
||||
|
||||
::: warning
|
||||
|
||||
The English translation of this page has not been completed, you are welcome to contribute translations to us.
|
||||
|
||||
You can use the **Chrome Translation Plugin** to translate entire pages for reference.
|
||||
|
||||
:::
|
||||
|
||||
# ConstructorFinder <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
class ConstructorFinder internal constructor(override val hookInstance: YukiMemberHookCreator.MemberHookCreator?, override val classSet: Class<*>) : MemberBaseFinder
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
`v1.0.2` `modified`
|
||||
|
||||
合并到 `BaseFinder`
|
||||
|
||||
`v1.1.0` `modified`
|
||||
|
||||
合并到 `MemberBaseFinder`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> `Constructor` 查找类。
|
||||
|
||||
可通过指定类型查找指定 `Constructor` 或一组 `Constructor`。
|
||||
|
||||
## paramCount <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
var paramCount: Int
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.67` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置 `Constructor` 参数个数。
|
||||
|
||||
你可以不使用 `param` 指定参数类型而是仅使用此变量指定参数个数。
|
||||
|
||||
若参数个数小于零则忽略并使用 `param`。
|
||||
|
||||
## modifiers <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun modifiers(conditions: ModifierConditions): IndexTypeCondition
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.67` `added`
|
||||
|
||||
`v1.0.80` `modified`
|
||||
|
||||
将方法体进行 inline
|
||||
|
||||
`v1.1.0` `modified`
|
||||
|
||||
合并到 `ModifierConditions`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置 `Constructor` 标识符筛选条件。
|
||||
|
||||
可不设置筛选条件,默认模糊查找并取第一个匹配的 `Constructor`。
|
||||
|
||||
::: danger
|
||||
|
||||
存在多个 **IndexTypeCondition** 时除了 **order** 只会生效最后一个。
|
||||
|
||||
:::
|
||||
|
||||
## emptyParam <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun emptyParam(): IndexTypeCondition
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.75` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置 `Constructor` 空参数、无参数。
|
||||
|
||||
## param <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun param(vararg paramType: Any): IndexTypeCondition
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置 `Constructor` 参数。
|
||||
|
||||
如果同时使用了 `paramCount` 则 `paramType` 的数量必须与 `paramCount` 完全匹配。
|
||||
|
||||
如果 `Constructor` 中存在一些无意义又很长的类型,你可以使用 [VagueType](../../../type/defined/DefinedTypeFactory#vaguetype-field) 来替代它。
|
||||
|
||||
::: danger
|
||||
|
||||
无参 **Constructor** 请使用 **emptyParam** 设置查找条件。
|
||||
|
||||
有参 **Constructor** 必须使用此方法设定参数或使用 **paramCount** 指定个数。
|
||||
|
||||
存在多个 **IndexTypeCondition** 时除了 **order** 只会生效最后一个。
|
||||
|
||||
:::
|
||||
|
||||
## paramCount <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun paramCount(num: Int): IndexTypeCondition
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.70` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置 `Constructor` 参数个数。
|
||||
|
||||
你可以不使用 `param` 指定参数类型而是仅使用此方法指定参数个数。
|
||||
|
||||
若参数个数小于零则忽略并使用 `param`。
|
||||
|
||||
::: danger
|
||||
|
||||
存在多个 **IndexTypeCondition** 时除了 **order** 只会生效最后一个。
|
||||
|
||||
:::
|
||||
|
||||
## paramCount <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun paramCount(numRange: IntRange): IndexTypeCondition
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置 `Constructor` 参数个数范围。
|
||||
|
||||
你可以不使用 `param` 指定参数类型而是仅使用此方法指定参数个数范围。
|
||||
|
||||
::: danger
|
||||
|
||||
存在多个 **IndexTypeCondition** 时除了 **order** 只会生效最后一个。
|
||||
|
||||
:::
|
||||
|
||||
## paramCount <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun paramCount(conditions: CountConditions): IndexTypeCondition
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置 `Constructor` 参数个数条件。
|
||||
|
||||
你可以不使用 `param` 指定参数类型而是仅使用此方法指定参数个数条件。
|
||||
|
||||
::: danger
|
||||
|
||||
存在多个 **IndexTypeCondition** 时除了 **order** 只会生效最后一个。
|
||||
|
||||
:::
|
||||
|
||||
## superClass <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun superClass(isOnlySuperClass: Boolean)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.80` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置在 `classSet` 的所有父类中查找当前 `Constructor`。
|
||||
|
||||
::: warning
|
||||
|
||||
若当前 **classSet** 的父类较多可能会耗时,API 会自动循环到父类继承是 **Any** 前的最后一个类。
|
||||
|
||||
:::
|
||||
|
||||
## RemedyPlan <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inner class RemedyPlan internal constructor()
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> `Constructor` 重查找实现类,可累计失败次数直到查找成功。
|
||||
|
||||
### constructor <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun constructor(initiate: ConstructorConditions)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
`v1.0.80` `modified`
|
||||
|
||||
将方法体进行 inline
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 创建需要重新查找的 `Constructor`。
|
||||
|
||||
你可以添加多个备选 `Constructor`,直到成功为止,若最后依然失败,将停止查找并输出错误日志。
|
||||
|
||||
### Result <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inner class Result internal constructor()
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.1` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> `RemedyPlan` 结果实现类。
|
||||
|
||||
#### onFind <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun onFind(initiate: HashSet<Constructor<*>>.() -> Unit)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.1` `added`
|
||||
|
||||
`v1.1.0` `modified`
|
||||
|
||||
`initiate` 参数 `Constructor` 变为 `HashSet<Constructor>`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 当在 `RemedyPlan` 中找到结果时。
|
||||
|
||||
**Function Example**
|
||||
|
||||
你可以方便地对重查找的 `Constructor` 实现 `onFind` 方法。
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
constructor {
|
||||
// Your code here.
|
||||
}.onFind {
|
||||
// Your code here.
|
||||
}
|
||||
```
|
||||
|
||||
## Process <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inner class Process internal constructor(internal val isNoSuch: Boolean, internal val throwable: Throwable?) : BaseResult
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> `Constructor` 查找结果处理类,为 `hookInstance` 提供。
|
||||
|
||||
### result <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun result(initiate: Process.() -> Unit): Process
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 创建监听结果事件方法体。
|
||||
|
||||
**Function Example**
|
||||
|
||||
你可以使用 `lambda` 形式创建 `Result` 类。
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
constructor {
|
||||
// Your code here.
|
||||
}.result {
|
||||
all()
|
||||
remedys {}
|
||||
onNoSuchConstructor {}
|
||||
}
|
||||
```
|
||||
|
||||
### all <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun all(): Process
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置全部查找条件匹配的多个 `Constructor` 实例结果到 `hookInstance`。
|
||||
|
||||
### remedys <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun remedys(initiate: RemedyPlan.() -> Unit): Result
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 创建 `Constructor` 重查找功能。
|
||||
|
||||
**Function Example**
|
||||
|
||||
当你遇到一种 `Constructor` 可能存在不同形式的存在时,可以使用 `RemedyPlan` 重新查找它,而没有必要使用 `onNoSuchConstructor` 捕获异常二次查找 `Constructor`。
|
||||
|
||||
若第一次查找失败了,你还可以在这里继续添加此方法体直到成功为止。
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
constructor {
|
||||
// Your code here.
|
||||
}.remedys {
|
||||
constructor {
|
||||
// Your code here.
|
||||
}
|
||||
constructor {
|
||||
// Your code here.
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### onNoSuchConstructor <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun onNoSuchConstructor(result: (Throwable) -> Unit): Result
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 监听找不到 `Constructor` 时。
|
||||
|
||||
只会返回第一次的错误信息,不会返回 `RemedyPlan` 的错误信息。
|
||||
|
||||
## Result <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inner class Result internal constructor(internal val isNoSuch: Boolean, internal val throwable: Throwable?) : BaseResult
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
`v1.1.0` `modified`
|
||||
|
||||
继承到接口 `BaseResult`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> `Constructor` 查找结果实现类。
|
||||
|
||||
### result <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun result(initiate: Result.() -> Unit): Result
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
`v1.0.80` `modified`
|
||||
|
||||
将方法体进行 inline
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 创建监听结果事件方法体。
|
||||
|
||||
**Function Example**
|
||||
|
||||
你可以使用 `lambda` 形式创建 `Result` 类。
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
constructor {
|
||||
// Your code here.
|
||||
}.result {
|
||||
get().call()
|
||||
all()
|
||||
remedys {}
|
||||
onNoSuchConstructor {}
|
||||
}
|
||||
```
|
||||
|
||||
### get <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun get(): Instance
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.2` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获得 `Constructor` 实例处理类。
|
||||
|
||||
若有多个 `Constructor` 结果只会返回第一个。
|
||||
|
||||
::: danger
|
||||
|
||||
若你设置了 **remedys** 请使用 **wait** 回调结果方法。
|
||||
|
||||
:::
|
||||
|
||||
**Function Example**
|
||||
|
||||
你可以通过获得方法所在实例来执行构造方法创建新的实例对象。
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
constructor {
|
||||
// Your code here.
|
||||
}.get().call()
|
||||
```
|
||||
|
||||
你可以 `cast` 构造方法为指定类型的实例对象。
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
constructor {
|
||||
// Your code here.
|
||||
}.get().newInstance<TestClass>()
|
||||
```
|
||||
|
||||
::: danger
|
||||
|
||||
若构造方法含有参数则后方参数必填。
|
||||
|
||||
:::
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
constructor {
|
||||
// Your code here.
|
||||
}.get().newInstance<TestClass>("param1", "param2")
|
||||
```
|
||||
|
||||
### all <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun all(): ArrayList<Instance>
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获得 `Constructor` 实例处理类数组。
|
||||
|
||||
返回全部查找条件匹配的多个 `Constructor` 实例结果。
|
||||
|
||||
**Function Example**
|
||||
|
||||
你可以通过此方法来获得当前条件结果中匹配的全部 `Constructor`。
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
constructor {
|
||||
// Your code here.
|
||||
}.all().forEach { instance ->
|
||||
instance.call(...)
|
||||
}
|
||||
```
|
||||
|
||||
### give <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun give(): Constructor<*>?
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.67` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 得到 `Constructor` 本身。
|
||||
|
||||
若有多个 `Constructor` 结果只会返回第一个。
|
||||
|
||||
在查找条件找不到任何结果的时候将返回 `null`。
|
||||
|
||||
### giveAll <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun giveAll(): HashSet<Constructor<*>>
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 得到 `Constructor` 本身数组。
|
||||
|
||||
返回全部查找条件匹配的多个 `Constructor` 实例。
|
||||
|
||||
在查找条件找不到任何结果的时候将返回空的 `HashSet`。
|
||||
|
||||
### wait <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun wait(initiate: Instance.() -> Unit)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.2` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获得 `Constructor` 实例处理类,配合 `RemedyPlan` 使用。
|
||||
|
||||
若有多个 `Constructor` 结果只会返回第一个。
|
||||
|
||||
::: danger
|
||||
|
||||
若你设置了 **remedys** 必须使用此方法才能获得结果。
|
||||
|
||||
若你没有设置 **remedys** 此方法将不会被回调。
|
||||
|
||||
:::
|
||||
|
||||
### waitAll <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun waitAll(initiate: ArrayList<Instance>.() -> Unit)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获得 `Constructor` 实例处理类数组,配合 `RemedyPlan` 使用。
|
||||
|
||||
返回全部查找条件匹配的多个 `Constructor` 实例结果。
|
||||
|
||||
::: danger
|
||||
|
||||
若你设置了 **remedys** 必须使用此方法才能获得结果。
|
||||
|
||||
若你没有设置 **remedys** 此方法将不会被回调。
|
||||
|
||||
:::
|
||||
|
||||
### remedys <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun remedys(initiate: RemedyPlan.() -> Unit): Result
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
`v1.0.80` `modified`
|
||||
|
||||
将方法体进行 inline
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 创建 `Constructor` 重查找功能。
|
||||
|
||||
**Function Example**
|
||||
|
||||
当你遇到一种 `Constructor` 可能存在不同形式的存在时,可以使用 `RemedyPlan` 重新查找它,而没有必要使用 `onNoSuchConstructor` 捕获异常二次查找 `Constructor`。
|
||||
|
||||
若第一次查找失败了,你还可以在这里继续添加此方法体直到成功为止。
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
constructor {
|
||||
// Your code here.
|
||||
}.remedys {
|
||||
constructor {
|
||||
// Your code here.
|
||||
}
|
||||
constructor {
|
||||
// Your code here.
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### onNoSuchConstructor <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun onNoSuchConstructor(result: (Throwable) -> Unit): Result
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
`v1.0.80` `modified`
|
||||
|
||||
将方法体进行 inline
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 监听找不到 `Constructor` 时。
|
||||
|
||||
只会返回第一次的错误信息,不会返回 `RemedyPlan` 的错误信息。
|
||||
|
||||
### ignored <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun ignored(): Result
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 忽略异常并停止打印任何错误日志。
|
||||
|
||||
若 `isNotIgnoredHookingFailure` 为 `false` 则自动忽略。
|
||||
|
||||
::: warning
|
||||
|
||||
此时若要监听异常结果,你需要手动实现 **onNoSuchConstructor** 方法。
|
||||
|
||||
:::
|
||||
|
||||
<h3 class="deprecated">ignoredError - method</h3>
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.3` `added`
|
||||
|
||||
`v1.1.0` `deprecated`
|
||||
|
||||
请转移到新方法 `ignored()`
|
||||
|
||||
### Instance <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inner class Instance internal constructor(private val constructor: Constructor<*>?)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.2` `added`
|
||||
|
||||
`v1.1.0` `modified`
|
||||
|
||||
新增 `constructor` 参数
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> `Constructor` 实例处理类。
|
||||
|
||||
#### call <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun call(vararg param: Any?): Any?
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.2` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 执行 `Constructor` 创建目标实例,不指定目标实例类型。
|
||||
|
||||
#### newInstance <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun <T> newInstance(vararg param: Any?): T?
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.2` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 执行 `Constructor` 创建目标实例 ,指定 `T` 目标实例类型。
|
@@ -0,0 +1,927 @@
|
||||
---
|
||||
pageClass: code-page
|
||||
---
|
||||
|
||||
::: warning
|
||||
|
||||
The English translation of this page has not been completed, you are welcome to contribute translations to us.
|
||||
|
||||
You can use the **Chrome Translation Plugin** to translate entire pages for reference.
|
||||
|
||||
:::
|
||||
|
||||
# FieldFinder <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
class FieldFinder internal constructor(override val hookInstance: YukiMemberHookCreator.MemberHookCreator?, override val classSet: Class<*>?) : MemberBaseFinder
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
`v1.0.2` `modified`
|
||||
|
||||
合并到 `BaseFinder`
|
||||
|
||||
`v1.1.0` `modified`
|
||||
|
||||
合并到 `MemberBaseFinder`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> `Field` 查找类。
|
||||
|
||||
可通过指定类型查找指定 `Field` 或一组 `Field`。
|
||||
|
||||
<h2 class="deprecated">classSet - field</h2>
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
`v1.0.2` `removed`
|
||||
|
||||
## name <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
var name: String
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
`v1.0.70` `modified`
|
||||
|
||||
允许不填写名称
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置 `Field` 名称。
|
||||
|
||||
::: danger
|
||||
|
||||
若不填写名称则必须存在一个其它条件。
|
||||
|
||||
:::
|
||||
|
||||
## type <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
var type: Any?
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置 `Field` 类型。
|
||||
|
||||
可不填写类型。
|
||||
|
||||
## modifiers <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun modifiers(conditions: ModifierConditions): IndexTypeCondition
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.67` `added`
|
||||
|
||||
`v1.0.80` `modified`
|
||||
|
||||
将方法体进行 inline
|
||||
|
||||
`v1.1.0` `modified`
|
||||
|
||||
合并到 `ModifierConditions`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置 `Field` 标识符筛选条件。
|
||||
|
||||
可不设置筛选条件。
|
||||
|
||||
::: danger
|
||||
|
||||
存在多个 **IndexTypeCondition** 时除了 **order** 只会生效最后一个。
|
||||
|
||||
:::
|
||||
|
||||
## order <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun order(): IndexTypeCondition
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.70` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 顺序筛选字节码的下标。
|
||||
|
||||
## name <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun name(value: String): IndexTypeCondition
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.70` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置 `Field` 名称。
|
||||
|
||||
::: danger
|
||||
|
||||
若不填写名称则必须存在一个其它条件。
|
||||
|
||||
存在多个 **IndexTypeCondition** 时除了 **order** 只会生效最后一个。
|
||||
|
||||
:::
|
||||
|
||||
## name <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun name(conditions: NameConditions): IndexTypeCondition
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.88` `added`
|
||||
|
||||
`v1.1.0` `modified`
|
||||
|
||||
合并到 `NameConditions`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置 `Field` 名称条件。
|
||||
|
||||
::: danger
|
||||
|
||||
若不填写名称则必须存在一个其它条件。
|
||||
|
||||
存在多个 **IndexTypeCondition** 时除了 **order** 只会生效最后一个。
|
||||
|
||||
:::
|
||||
|
||||
## type <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun type(value: Any): IndexTypeCondition
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.70` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置 `Field` 类型。
|
||||
|
||||
::: danger
|
||||
|
||||
可不填写类型。
|
||||
|
||||
存在多个 **IndexTypeCondition** 时除了 **order** 只会生效最后一个。
|
||||
|
||||
:::
|
||||
|
||||
## superClass <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun superClass(isOnlySuperClass: Boolean)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.80` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置在 `classSet` 的所有父类中查找当前 `Field`。
|
||||
|
||||
::: warning
|
||||
|
||||
若当前 **classSet** 的父类较多可能会耗时,API 会自动循环到父类继承是 **Any** 前的最后一个类。
|
||||
|
||||
:::
|
||||
|
||||
## RemedyPlan <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inner class RemedyPlan internal constructor()
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> `Field` 重查找实现类,可累计失败次数直到查找成功。
|
||||
|
||||
### field <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun field(initiate: FieldConditions): Result
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 创建需要重新查找的 `Field`。
|
||||
|
||||
你可以添加多个备选 `Field`,直到成功为止,若最后依然失败,将停止查找并输出错误日志。
|
||||
|
||||
### Result <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inner class Result internal constructor()
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> `RemedyPlan` 结果实现类。
|
||||
|
||||
#### onFind <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun onFind(initiate: HashSet<Field>.() -> Unit)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 当在 `RemedyPlan` 中找到结果时。
|
||||
|
||||
**Function Example**
|
||||
|
||||
你可以方便地对重查找的 `Field` 实现 `onFind` 方法。
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
field {
|
||||
// Your code here.
|
||||
}.onFind {
|
||||
// Your code here.
|
||||
}
|
||||
```
|
||||
|
||||
## Result <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inner class Result internal constructor(internal val isNoSuch: Boolean, private val throwable: Throwable?) : BaseResult
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
`v1.1.0` `modified`
|
||||
|
||||
继承到接口 `BaseResult`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> `Field` 查找结果实现类。
|
||||
|
||||
### result <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun result(initiate: Result.() -> Unit): Result
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
`v1.0.80` `modified`
|
||||
|
||||
将方法体进行 inline
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 创建监听结果事件方法体。
|
||||
|
||||
**Function Example**
|
||||
|
||||
你可以使用 `lambda` 形式创建 `Result` 类。
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
field {
|
||||
// Your code here.
|
||||
}.result {
|
||||
get(instance).set("something")
|
||||
get(instance).string()
|
||||
get(instance).cast<CustomClass>()
|
||||
get().boolean()
|
||||
all(instance)
|
||||
give()
|
||||
giveAll()
|
||||
onNoSuchField {}
|
||||
}
|
||||
```
|
||||
|
||||
### get <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun get(instance: Any?): Instance
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获得 `Field` 实例处理类。
|
||||
|
||||
若有多个 `Field` 结果只会返回第一个。
|
||||
|
||||
**Function Example**
|
||||
|
||||
你可以轻松地得到 `Field` 的实例以及使用它进行设置实例。
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
field {
|
||||
// Your code here.
|
||||
}.get(instance).set("something")
|
||||
```
|
||||
|
||||
如果你取到的是静态 `Field`,可以不需要设置实例。
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
field {
|
||||
// Your code here.
|
||||
}.get().set("something")
|
||||
```
|
||||
|
||||
### all <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun all(instance: Any?): ArrayList<Instance>
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获得 `Field` 实例处理类数组。
|
||||
|
||||
返回全部查找条件匹配的多个 `Field` 实例结果。
|
||||
|
||||
**Function Example**
|
||||
|
||||
你可以通过此方法来获得当前条件结果中匹配的全部 `Field`,其 `Field` 所在实例用法与 `get` 相同。
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
field {
|
||||
// Your code here.
|
||||
}.all(instance).forEach { instance ->
|
||||
instance.self
|
||||
}
|
||||
```
|
||||
|
||||
### give <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun give(): Field?
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 得到 `Field` 本身。
|
||||
|
||||
若有多个 Field 结果只会返回第一个。
|
||||
|
||||
在查找条件找不到任何结果的时候将返回 `null`。
|
||||
|
||||
### giveAll <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun giveAll(): HashSet<Field>
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 得到 `Field` 本身数组。
|
||||
|
||||
返回全部查找条件匹配的多个 `Field` 实例。
|
||||
|
||||
在查找条件找不到任何结果的时候将返回空的 `HashSet`。
|
||||
|
||||
### wait <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun wait(instance: Any?, initiate: Instance.() -> Unit)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获得 `Field` 实例处理类,配合 `RemedyPlan` 使用。
|
||||
|
||||
若有多个 `Field` 结果只会返回第一个。
|
||||
|
||||
::: danger
|
||||
|
||||
若你设置了 **remedys** 必须使用此方法才能获得结果。
|
||||
|
||||
若你没有设置 **remedys** 此方法将不会被回调。
|
||||
|
||||
:::
|
||||
|
||||
### waitAll <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun waitAll(instance: Any?, initiate: ArrayList<Instance>.() -> Unit)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获得 `Field` 实例处理类数组,配合 `RemedyPlan` 使用。
|
||||
|
||||
返回全部查找条件匹配的多个 `Field` 实例结果。
|
||||
|
||||
::: danger
|
||||
|
||||
若你设置了 **remedys** 必须使用此方法才能获得结果。
|
||||
|
||||
若你没有设置 **remedys** 此方法将不会被回调。
|
||||
|
||||
:::
|
||||
|
||||
### remedys <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun remedys(initiate: RemedyPlan.() -> Unit): Result
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 创建 `Field` 重查找功能。
|
||||
|
||||
**Function Example**
|
||||
|
||||
当你遇到一种 `Field` 可能存在不同形式的存在时,可以使用 `RemedyPlan` 重新查找它,而没有必要使用 `onNoSuchField` 捕获异常二次查找 `Field`。
|
||||
|
||||
若第一次查找失败了,你还可以在这里继续添加此方法体直到成功为止。
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
field {
|
||||
// Your code here.
|
||||
}.remedys {
|
||||
field {
|
||||
// Your code here.
|
||||
}
|
||||
field {
|
||||
// Your code here.
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### onNoSuchField <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun onNoSuchField(result: (Throwable) -> Unit): Result
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 监听找不到 `Field` 时。
|
||||
|
||||
### ignored <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun ignored(): Result
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 忽略异常并停止打印任何错误日志。
|
||||
|
||||
若 `isNotIgnoredHookingFailure` 为 `false` 则自动忽略。
|
||||
|
||||
::: warning
|
||||
|
||||
此时若要监听异常结果,你需要手动实现 **onNoSuchField** 方法。
|
||||
|
||||
:::
|
||||
|
||||
<h3 class="deprecated">ignoredError - method</h3>
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.3` `added`
|
||||
|
||||
`v1.1.0` `deprecated`
|
||||
|
||||
请转移到新方法 `ignored()`
|
||||
|
||||
### Instance <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inner class Instance internal constructor(private val instance: Any?, private val field: Field?)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
`v1.1.0` `modified`
|
||||
|
||||
新增 `field` 参数
|
||||
|
||||
不再对外公开 `self` 参数
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> `Field` 实例变量处理类。
|
||||
|
||||
<h4 class="deprecated">self - field</h4>
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
`v1.1.0` `removed`
|
||||
|
||||
请直接使用 `any` 方法得到 `Field` 自身的实例化对象
|
||||
|
||||
#### current <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun current(ignored: Boolean): CurrentClass?
|
||||
```
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun current(ignored: Boolean, initiate: CurrentClass.() -> Unit): Any?
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获得当前 `Field` 自身 `self` 实例的类操作对象 `CurrentClass`。
|
||||
|
||||
#### cast <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun <T> cast(): T?
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
`v1.0.68` `modified`
|
||||
|
||||
修改 ~~`of`~~ 为 `cast`
|
||||
|
||||
移动方法到 `Instance`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 得到当前 `Field` 实例。
|
||||
|
||||
#### byte <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun byte(): Byte?
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.68` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 得到当前 `Field` Byte 实例。
|
||||
|
||||
#### int <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun int(): Int
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.65` `added`
|
||||
|
||||
`v1.0.68` `modified`
|
||||
|
||||
修改 ~~`ofInt`~~ 为 `int`
|
||||
|
||||
移动方法到 `Instance`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 得到当前 `Field` Int 实例。
|
||||
|
||||
#### long <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun long(): Long
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.65` `added`
|
||||
|
||||
`v1.0.68` `modified`
|
||||
|
||||
修改 ~~`ofLong`~~ 为 `long`
|
||||
|
||||
移动方法到 `Instance`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 得到当前 `Field` Long 实例。
|
||||
|
||||
#### short <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun short(): Short
|
||||
```
|
||||
**Change Records**
|
||||
|
||||
`v1.0.65` `added`
|
||||
|
||||
`v1.0.68` `modified`
|
||||
|
||||
修改 ~~`ofShort`~~ 为 `short`
|
||||
|
||||
移动方法到 `Instance`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 得到当前 `Field` Short 实例。
|
||||
|
||||
#### double <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun double(): Double
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.65` `added`
|
||||
|
||||
`v1.0.68` `modified`
|
||||
|
||||
修改 ~~`ofDouble`~~ 为 `double`
|
||||
|
||||
移动方法到 `Instance`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 得到当前 `Field` Double 实例。
|
||||
|
||||
#### float <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun float(): Float
|
||||
```
|
||||
**Change Records**
|
||||
|
||||
`v1.0.65` `added`
|
||||
|
||||
`v1.0.68` `modified`
|
||||
|
||||
修改 ~~`ofFloat`~~ 为 `float`
|
||||
|
||||
移动方法到 `Instance`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 得到当前 `Field` Float 实例。
|
||||
|
||||
#### string <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun string(): String
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.65` `added`
|
||||
|
||||
`v1.0.68` `modified`
|
||||
|
||||
修改 ~~`ofString`~~ 为 `string`
|
||||
|
||||
移动方法到 `Instance`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 得到当前 `Field` String 实例。
|
||||
|
||||
#### char <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun char(): Char
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.68` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 得到当前 `Field` Char 实例。
|
||||
|
||||
#### boolean <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun boolean(): Boolean
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.65` `added`
|
||||
|
||||
`v1.0.68` `modified`
|
||||
|
||||
修改 ~~`ofBoolean`~~ 为 `boolean`
|
||||
|
||||
移动方法到 `Instance`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 得到当前 `Field` Boolean 实例。
|
||||
|
||||
#### any <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun any(): Any?
|
||||
```
|
||||
**Change Records**
|
||||
|
||||
`v1.0.65` `added`
|
||||
|
||||
`v1.0.68` `modified`
|
||||
|
||||
修改 ~~`ofAny`~~ 为 `any`
|
||||
|
||||
移动方法到 `Instance`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 得到当前 `Field` Any 实例。
|
||||
|
||||
#### array <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun <reified T> array(): Array<T>
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.68` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 得到当前 `Field` Array 实例。
|
||||
|
||||
#### list <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun <reified T> list(): List<T>
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.68` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 得到当前 `Field` List 实例。
|
||||
|
||||
#### set <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun set(any: Any?)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置当前 `Field` 实例。
|
||||
|
||||
#### setTrue <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun setTrue()
|
||||
```
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置当前 `Field` 实例为 `true`。
|
||||
|
||||
::: danger
|
||||
|
||||
请确保实例对象类型为 **Boolean**。
|
||||
|
||||
:::
|
||||
|
||||
#### setFalse <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun setFalse()
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置当前 `Field` 实例为 `false`。
|
||||
|
||||
::: danger
|
||||
|
||||
请确保实例对象类型为 **Boolean**。
|
||||
|
||||
:::
|
||||
|
||||
#### setNull <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun setNull()
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置当前 `Field` 实例为 `null`。
|
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,39 @@
|
||||
---
|
||||
pageClass: code-page
|
||||
---
|
||||
|
||||
::: warning
|
||||
|
||||
The English translation of this page has not been completed, you are welcome to contribute translations to us.
|
||||
|
||||
You can use the **Chrome Translation Plugin** to translate entire pages for reference.
|
||||
|
||||
:::
|
||||
|
||||
# YukiBaseHooker <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
abstract class YukiBaseHooker : PackageParam()
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> `YukiHookAPI` 的子类 Hooker 实现。
|
||||
|
||||
## onHook <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun onHook()
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 子类 Hook 开始。
|
@@ -0,0 +1,745 @@
|
||||
---
|
||||
pageClass: code-page
|
||||
---
|
||||
|
||||
::: warning
|
||||
|
||||
The English translation of this page has not been completed, you are welcome to contribute translations to us.
|
||||
|
||||
You can use the **Chrome Translation Plugin** to translate entire pages for reference.
|
||||
|
||||
:::
|
||||
|
||||
# ReflectionFactory <span class="symbol">- kt</span>
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 这是自定义 `Member` 和 `Class` 相关功能的查找匹配以及 `invoke` 的封装类。
|
||||
|
||||
## MembersType <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
enum class MembersType
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 定义一个 `Class` 中的 `Member` 类型
|
||||
|
||||
### ALL <span class="symbol">- enum</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
ALL
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 全部 `Method` 与 `Constructor`。
|
||||
|
||||
### METHOD <span class="symbol">- enum</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
METHOD
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 全部 `Method`。
|
||||
|
||||
### CONSTRUCTOR <span class="symbol">- enum</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
CONSTRUCTOR
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 全部 `Constructor`。
|
||||
|
||||
## ClassLoader.searchClass <span class="symbol">- ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun ClassLoader.searchClass(name: String, async: Boolean, initiate: ClassConditions): DexClassFinder.Result
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 通过当前 `ClassLoader` 按指定条件查找并得到 **Dex** 中的 `Class`。
|
||||
|
||||
::: danger
|
||||
|
||||
此方法在 **Class** 数量过多及查找条件复杂时会非常耗时。
|
||||
|
||||
建议启用 **async** 或设置 **name** 参数,**name** 参数将在 Hook APP (宿主) 不同版本中自动进行本地缓存以提升效率。
|
||||
|
||||
此功能尚在试验阶段,性能与稳定性可能仍然存在问题,使用过程遇到问题请向我们报告并帮助我们改进。
|
||||
|
||||
:::
|
||||
|
||||
## ClassLoader.onLoadClass <span class="symbol">- ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun ClassLoader.onLoadClass(result: (Class<*>) -> Unit)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 监听当前 `ClassLoader` 的 `ClassLoader.loadClass` 方法装载。
|
||||
|
||||
::: danger
|
||||
|
||||
只有当前 **ClassLoader** 有主动使用 **ClassLoader.loadClass** 事件时才能被捕获。
|
||||
|
||||
这是一个实验性功能,一般情况下不会用到此方法,不保证不会发生错误。
|
||||
|
||||
只能在 (Xposed) 宿主环境使用此功能,其它环境下使用将不生效且会打印警告信息。
|
||||
|
||||
:::
|
||||
|
||||
**Function Example**
|
||||
|
||||
针对一些使用特定 `ClassLoader` 装载 `Class` 的宿主应用,你可以使用此方法来监听 `Class` 加载情况。
|
||||
|
||||
::: warning
|
||||
|
||||
为了防止发生问题,你需要<u>**得到一个存在的 ClassLoader 实例**</u>来使用此功能。
|
||||
|
||||
:::
|
||||
|
||||
比如我们在 `PackageParam` 中使用 `appClassLoader`。
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
appClassLoader.onLoadClass { clazz ->
|
||||
// 得到 clazz 即加载对象
|
||||
clazz... // 这里进行你需要的操作
|
||||
}
|
||||
```
|
||||
|
||||
或使用你得到的存在的 `ClassLoader` 实例,可以通过 Hook 获取。
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
val customClassLoader: ClassLoader? = ... // 假设这个就是你的 ClassLoader
|
||||
customClassLoader?.onLoadClass { clazz ->
|
||||
// ...
|
||||
}
|
||||
```
|
||||
|
||||
在判断到这个 `Class` 被装载成功时,开始执行你的 Hook 功能。
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
val customClassLoader: ClassLoader? = ... // 假设这个就是你的 ClassLoader
|
||||
customClassLoader?.onLoadClass { clazz ->
|
||||
if(clazz.name == /** 你需要的 Class 名称 */) {
|
||||
clazz.hook {
|
||||
// ...
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
<h2 class="deprecated">hookClass - field</h2>
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
`v1.1.0` `removed`
|
||||
|
||||
`HookClass` 相关功能不再对外开放
|
||||
|
||||
<h2 class="deprecated">normalClass - field</h2>
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
`v1.1.0` `removed`
|
||||
|
||||
`HookClass` 相关功能不再对外开放
|
||||
|
||||
<h2 class="deprecated">hasClass - field</h2>
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
`v1.1.0` `removed`
|
||||
|
||||
请直接使用 `hasClass()` 无参方法
|
||||
|
||||
## Class.hasExtends <span class="symbol">- ext-field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
val Class<*>.hasExtends: Boolean
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.80` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 当前 `Class` 是否有继承关系,父类是 `Any` 将被认为没有继承关系。
|
||||
|
||||
<h2 class="deprecated">classOf - method</h2>
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
`v1.1.0` `deprecated`
|
||||
|
||||
请转到 `toClass(...)` 方法
|
||||
|
||||
## String.toClass <span class="symbol">- ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun String.toClass(loader: ClassLoader?): Class<*>
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 通过字符串类名转换为 `loader` 中的实体类。
|
||||
|
||||
**Function Example**
|
||||
|
||||
你可以直接填写你要查找的目标 `Class`,必须在默认 `ClassLoader` 下存在。
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
"com.example.demo.DemoClass".toClass()
|
||||
```
|
||||
|
||||
你还可以自定义 `Class` 所在的 `ClassLoader`。
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
val customClassLoader: ClassLoader? = ... // 假设这个就是你的 ClassLoader
|
||||
"com.example.demo.DemoClass".toClass(customClassLoader)
|
||||
```
|
||||
|
||||
## String.toClassOrNull <span class="symbol">- ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun String.toClassOrNull(loader: ClassLoader?): Class<*>?
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 通过字符串类名转换为 `loader` 中的实体类。
|
||||
|
||||
找不到 `Class` 会返回 `null`,不会抛出异常。
|
||||
|
||||
**Function Example**
|
||||
|
||||
用法请参考 [String.toClass](#string-toclass-ext-method) 方法。
|
||||
|
||||
## classOf <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun <reified T> classOf(loader: ClassLoader?): Class<*>
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 通过 `T` 得到其 `Class` 实例并转换为实体类。
|
||||
|
||||
**Function Example**
|
||||
|
||||
我们要获取一个 `Class` 在 `Kotlin` 下不通过反射时应该这样做。
|
||||
|
||||
> The following example
|
||||
>
|
||||
```kotlin
|
||||
DemoClass::class.java
|
||||
```
|
||||
|
||||
现在,你可以直接 `cast` 一个实例并获取它的 `Class` 对象,必须在当前 `ClassLoader` 下存在。
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
classOf<DemoClass>()
|
||||
```
|
||||
|
||||
若目标存在的 `Class` 为 `stub`,通过这种方式,你还可以自定义 `Class` 所在的 `ClassLoader`。
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
val customClassLoader: ClassLoader? = ... // 假设这个就是你的 ClassLoader
|
||||
classOf<DemoClass>(customClassLoader)
|
||||
```
|
||||
|
||||
## String.hasClass <span class="symbol">- ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun String.hasClass(loader: ClassLoader?): Boolean
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
`v1.1.0` `modified`
|
||||
|
||||
支持直接使用空参数方法使用默认 `ClassLoader` 进行判断
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 通过字符串类名使用指定的 `ClassLoader` 查找是否存在。
|
||||
|
||||
**Function Example**
|
||||
|
||||
你可以轻松的使用此方法判断字符串中的类是否存在,效果等同于直接使用 `Class.forName`。
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
if("com.example.demo.DemoClass".hasClass()) {
|
||||
// Your code here.
|
||||
}
|
||||
```
|
||||
|
||||
填入方法中的 `loader` 参数可判断指定的 `ClassLoader` 中的 `Class` 是否存在。
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
val customClassLoader: ClassLoader? = ... // 假设这个就是你的 ClassLoader
|
||||
if("com.example.demo.DemoClass".hasClass(customClassLoader)) {
|
||||
// Your code here.
|
||||
}
|
||||
```
|
||||
|
||||
## Class.hasField <span class="symbol">- ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun Class<*>.hasField(initiate: FieldConditions): Boolean
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.4` `added`
|
||||
|
||||
`v1.0.67` `modified`
|
||||
|
||||
合并到 `FieldFinder`
|
||||
|
||||
`v1.0.80` `modified`
|
||||
|
||||
将方法体进行 inline
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 查找变量是否存在。
|
||||
|
||||
## Class.hasMethod <span class="symbol">- ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun Class<*>.hasMethod(initiate: MethodConditions): Boolean
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
`v1.0.1` `modified`
|
||||
|
||||
新增 `returnType` 参数
|
||||
|
||||
`v1.0.67` `modified`
|
||||
|
||||
合并到 `MethodFinder`
|
||||
|
||||
`v1.0.80` `modified`
|
||||
|
||||
将方法体进行 inline
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 查找方法是否存在。
|
||||
|
||||
## Class.hasConstructor <span class="symbol">- ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun Class<*>.hasConstructor(initiate: ConstructorConditions): Boolean
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.2` `added`
|
||||
|
||||
`v1.0.67` `modified`
|
||||
|
||||
合并到 `ConstructorFinder`
|
||||
|
||||
`v1.0.80` `modified`
|
||||
|
||||
将方法体进行 inline
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 查找构造方法是否存在。
|
||||
|
||||
## Member.hasModifiers <span class="symbol">- ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun Member.hasModifiers(conditions: ModifierConditions): Boolean
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.67` `added`
|
||||
|
||||
`v1.0.80` `modified`
|
||||
|
||||
将方法体进行 inline
|
||||
|
||||
`v1.1.0` `modified`
|
||||
|
||||
合并到 `ModifierConditions`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 查找 `Member` 中匹配的描述符。
|
||||
|
||||
## Class.hasModifiers <span class="symbol">- ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun Class<*>.hasModifiers(conditions: ModifierConditions): Boolean
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 查找 `Class` 中匹配的描述符。
|
||||
|
||||
<h2 class="deprecated">obtainStaticFieldAny - method</h2>
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
`v1.0.1` `removed`
|
||||
|
||||
<h2 class="deprecated">obtainFieldAny - method</h2>
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
`v1.0.1` `removed`
|
||||
|
||||
<h2 class="deprecated">modifyStaticField - method</h2>
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
`v1.0.1` `removed`
|
||||
|
||||
<h2 class="deprecated">modifyField - method</h2>
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
`v1.0.1` `removed`
|
||||
|
||||
## Class.field <span class="symbol">- ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun Class<*>.field(initiate: FieldConditions): FieldFinder.Result
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.2` `added`
|
||||
|
||||
`v1.0.80` `modified`
|
||||
|
||||
将方法体进行 inline
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 查找并得到变量。
|
||||
|
||||
## Class.method <span class="symbol">- ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun Class<*>.method(initiate: MethodConditions): MethodFinder.Result
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
`v1.0.1` `modified`
|
||||
|
||||
~~`obtainMethod`~~ 更名为 `method`
|
||||
|
||||
新增 `returnType` 参数
|
||||
|
||||
`v1.0.2` `modified`
|
||||
|
||||
合并到 `MethodFinder` 方法体
|
||||
|
||||
`v1.0.80` `modified`
|
||||
|
||||
将方法体进行 inline
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 查找并得到方法。
|
||||
|
||||
## Class.constructor <span class="symbol">- ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun Class<*>.constructor(initiate: ConstructorConditions): ConstructorFinder.Result
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
`v1.0.1` `modified`
|
||||
|
||||
~~`obtainConstructor`~~ 更名为 `constructor`
|
||||
|
||||
`v1.0.2` `modified`
|
||||
|
||||
合并到 `ConstructorFinder` 方法体
|
||||
|
||||
`v1.0.80` `modified`
|
||||
|
||||
将方法体进行 inline
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 查找并得到构造方法。
|
||||
|
||||
<h2 class="deprecated">callStatic - method</h2>
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
`v1.0.1` `modified`
|
||||
|
||||
~~`invokeStatic`~~ 更名为 `callStatic`
|
||||
|
||||
`v1.0.2` `removed`
|
||||
|
||||
<h2 class="deprecated">call - method</h2>
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
`v1.0.1` `modified`
|
||||
|
||||
~~`invokeAny`~~ 更名为 `call`
|
||||
|
||||
`v1.0.2` `removed`
|
||||
|
||||
## Class.generic <span class="symbol">- ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun Class<*>.generic(): GenericClass?
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获得当前 `Class` 的泛型父类。
|
||||
|
||||
如果当前实例不存在泛型将返回 `null`。
|
||||
|
||||
## Class.generic <span class="symbol">- ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun Class<*>.generic(initiate: GenericClass.() -> Unit): GenericClass?
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获得当前 `Class` 的泛型父类。
|
||||
|
||||
如果当前实例不存在泛型将返回 `null`。
|
||||
|
||||
## Any.current <span class="symbol">- ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun <reified T : Any> T.current(ignored: Boolean): CurrentClass
|
||||
```
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun <reified T : Any> T.current(ignored: Boolean, initiate: CurrentClass.() -> Unit): T
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.70` `added`
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
新增 `ignored` 参数,可以忽略在 `CurrentClass` 中出现的异常
|
||||
|
||||
新增不使用 `current { ... }` 调用域直接使用 `current()` 得到实例的类操作对象
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获得当前实例的类操作对象。
|
||||
|
||||
<h2 class="deprecated">Class.buildOfAny - ext-method</h2>
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.70` `added`
|
||||
|
||||
`v1.0.80` `modified`
|
||||
|
||||
将方法体进行 inline
|
||||
|
||||
`v1.1.0` `deprecated`
|
||||
|
||||
请转移到 `buildOf` 方法
|
||||
|
||||
## Class.buildOf <span class="symbol">- ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun Class<*>.buildOf(vararg param: Any?, initiate: ConstructorConditions): Any?
|
||||
```
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun <T> Class<*>.buildOf(vararg param: Any?, initiate: ConstructorConditions): T?
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.70` `added`
|
||||
|
||||
`v1.0.80` `modified`
|
||||
|
||||
将方法体进行 inline
|
||||
|
||||
`v1.1.0` `modified`
|
||||
|
||||
加入无泛型方法 `buildOf`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 通过构造方法创建新实例,指定类型 `T` 或任意类型 `Any`。
|
||||
|
||||
## Class.allMethods <span class="symbol">- ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun Class<*>.allMethods(result: (index: Int, method: Method) -> Unit)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.70` `added`
|
||||
|
||||
`v1.0.80` `modified`
|
||||
|
||||
将方法体进行 inline
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 遍历当前类中的所有方法。
|
||||
|
||||
## Class.allConstructors <span class="symbol">- ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun Class<*>.allConstructors(result: (index: Int, constructor: Constructor<*>) -> Unit)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.70` `added`
|
||||
|
||||
`v1.0.80` `modified`
|
||||
|
||||
将方法体进行 inline
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 遍历当前类中的所有构造方法。
|
||||
|
||||
## Class.allFields <span class="symbol">- ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun Class<*>.allFields(result: (index: Int, field: Field) -> Unit)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.70` `added`
|
||||
|
||||
`v1.0.80` `modified`
|
||||
|
||||
将方法体进行 inline
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 遍历当前类中的所有变量。
|
@@ -0,0 +1,249 @@
|
||||
---
|
||||
pageClass: code-page
|
||||
---
|
||||
|
||||
::: warning
|
||||
|
||||
The English translation of this page has not been completed, you are welcome to contribute translations to us.
|
||||
|
||||
You can use the **Chrome Translation Plugin** to translate entire pages for reference.
|
||||
|
||||
:::
|
||||
|
||||
# YukiHookFactory <span class="symbol">- kt</span>
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
`v1.0.80` `modified`
|
||||
|
||||
合并到 `IYukiHookXposedInit`,将方法体进行 inline
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 这是 `YukiHookAPI` 相关 `lambda` 方法的封装类以及部分 API 用法。
|
||||
|
||||
## IYukiHookXposedInit.configs <span class="symbol">- ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun IYukiHookXposedInit.configs(initiate: YukiHookAPI.Configs.() -> Unit)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.1` `added`
|
||||
|
||||
`v1.0.80` `modified`
|
||||
|
||||
合并到 `IYukiHookXposedInit`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 在 `IYukiHookXposedInit` 中配置 `Configs`。
|
||||
|
||||
## IYukiHookXposedInit.encase <span class="symbol">- ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun IYukiHookXposedInit.encase(initiate: PackageParam.() -> Unit)
|
||||
```
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun IYukiHookXposedInit.encase(vararg hooker: YukiBaseHooker)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
`v1.0.80` `modified`
|
||||
|
||||
合并到 `IYukiHookXposedInit`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 在 `IYukiHookXposedInit` 中调用 `YukiHookAPI`。
|
||||
|
||||
## Context.modulePrefs <span class="symbol">- ext-field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
val Context.modulePrefs: YukiHookModulePrefs
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获取模块的存取对象。
|
||||
|
||||
## Context.modulePrefs <span class="symbol">- ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun Context.modulePrefs(name: String): YukiHookModulePrefs
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获取模块的存取对象,可设置 `name` 为自定义 Sp 存储名称。
|
||||
|
||||
## Context.dataChannel <span class="symbol">- ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun Context.dataChannel(packageName: String): YukiHookDataChannel.NameSpace
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.88` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获取模块的数据通讯桥命名空间对象。
|
||||
|
||||
::: danger
|
||||
|
||||
只能在模块环境使用此功能,其它环境下使用将不起作用。
|
||||
|
||||
:::
|
||||
|
||||
## Context.processName <span class="symbol">- ext-field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
val Context.processName: String
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获取当前进程名称。
|
||||
|
||||
## Context+Resources.injectModuleAppResources <span class="symbol">- ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun Context.injectModuleAppResources()
|
||||
```
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun Resources.injectModuleAppResources()
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 向 Hook APP (宿主) `Context` 或 `Resources` 注入当前 Xposed 模块的资源。
|
||||
|
||||
注入成功后,你就可以直接使用例如 `ImageView.setImageResource` 或 `Resources.getString` 装载当前 Xposed 模块的资源 ID。
|
||||
|
||||
注入的资源作用域仅限当前 `Context` 或 `Resources`,你需要在每个用到宿主 `Context` 或 `Resources` 的地方重复调用此方法进行注入才能使用。
|
||||
|
||||
::: danger
|
||||
|
||||
只能在 (Xposed) 宿主环境使用此功能,其它环境下使用将不生效且会打印警告信息。
|
||||
|
||||
:::
|
||||
|
||||
## Context.registerModuleAppActivities <span class="symbol">- ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun Context.registerModuleAppActivities(proxy: Any?)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 向 Hook APP (宿主) 注册当前 Xposed 模块的 `Activity`。
|
||||
|
||||
注册成功后,你就可以直接使用 `Context.startActivity` 来启动未在宿主中注册的 `Activity`。
|
||||
|
||||
使用此方法会在未注册的 `Activity` 在 Hook APP (宿主) 中启动时自动调用 `injectModuleAppResources` 注入当前 Xposed 模块的资源。
|
||||
|
||||
你要将需要在宿主启动的 `Activity` 继承于 `ModuleAppActivity` 或 `ModuleAppCompatActivity`。
|
||||
|
||||
::: danger
|
||||
|
||||
只能在 (Xposed) 宿主环境使用此功能,其它环境下使用将不生效且会打印警告信息。
|
||||
|
||||
:::
|
||||
|
||||
## Context.applyModuleTheme <span class="symbol">- ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun Context.applyModuleTheme(theme: Int, configuration: Configuration?): ModuleContextThemeWrapper
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 生成一个 `ContextThemeWrapper` 代理以应用当前 Xposed 模块的主题资源。
|
||||
|
||||
在 Hook APP (宿主) 中使用此方法会自动调用 `injectModuleAppResources` 注入当前 Xposed 模块的资源。
|
||||
|
||||
如果在 Hook APP (宿主) 中使用此方法发生 `ClassCastException`,请手动设置 `configuration`。
|
||||
|
||||
<h2 class="deprecated">isSupportResourcesHook - field</h2>
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.80` `added`
|
||||
|
||||
`v1.0.91` `removed`
|
||||
|
||||
请转移到 `YukiHookAPI.Status.isSupportResourcesHook`
|
||||
|
||||
<h2 class="deprecated">isModuleActive - field</h2>
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.6` `added`
|
||||
|
||||
`v1.0.91` `removed`
|
||||
|
||||
请转移到 `YukiHookAPI.Status.isModuleActive`
|
||||
|
||||
<h2 class="deprecated">isXposedModuleActive - field</h2>
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.6` `added`
|
||||
|
||||
`v1.0.91` `removed`
|
||||
|
||||
请转移到 `YukiHookAPI.Status.isXposedModuleActive`
|
||||
|
||||
<h2 class="deprecated">isTaiChiModuleActive - field</h2>
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
`v1.0.91` `removed`
|
||||
|
||||
请转移到 `YukiHookAPI.Status.isTaiChiModuleActive`
|
||||
|
||||
<h1 class="deprecated">YukiHookModuleStatus - class</h1>
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
`v1.0.91` `deprecated`
|
||||
|
||||
请转移到 `YukiHookAPI.Status`
|
@@ -0,0 +1,447 @@
|
||||
---
|
||||
pageClass: code-page
|
||||
---
|
||||
|
||||
::: warning
|
||||
|
||||
The English translation of this page has not been completed, you are welcome to contribute translations to us.
|
||||
|
||||
You can use the **Chrome Translation Plugin** to translate entire pages for reference.
|
||||
|
||||
:::
|
||||
|
||||
# LoggerFactory <span class="symbol">- kt</span>
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 这是 `YukiHookAPI` 的日志封装类,可实现同时向 `Logcat` 和 `XposedBridge.log` 打印日志的功能。
|
||||
|
||||
## LoggerType <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
enum class LoggerType
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 需要打印的日志类型。
|
||||
|
||||
决定于模块与 (Xposed) 宿主环境使用的打印方式。
|
||||
|
||||
### LOGD <span class="symbol">- enum</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
LOGD
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 仅使用 `android.util.Log`。
|
||||
|
||||
### XPOSEDBRIDGE <span class="symbol">- enum</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
XPOSEDBRIDGE
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 仅使用 `XposedBridge.log`。
|
||||
|
||||
::: danger
|
||||
|
||||
只能在 (Xposed) 宿主环境中使用,模块环境将不生效。
|
||||
|
||||
:::
|
||||
|
||||
### SCOPE <span class="symbol">- enum</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
SCOPE
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 分区使用。
|
||||
|
||||
(Xposed) 宿主环境仅使用 `XPOSEDBRIDGE`。
|
||||
|
||||
模块环境仅使用 `LOGD`。
|
||||
|
||||
### BOTH <span class="symbol">- enum</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
BOTH
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 同时使用。
|
||||
|
||||
(Xposed) 宿主环境使用 `LOGD` 与 `XPOSEDBRIDGE`。
|
||||
|
||||
模块环境仅使用 `LOGD`。
|
||||
|
||||
## YukiHookLogger <span class="symbol">- object</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
object YukiHookLogger
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 调试日志实现类。
|
||||
|
||||
### contents <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
val contents: String
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获取当前日志文件内容。
|
||||
|
||||
如果当前没有已记录的日志会返回空字符串。
|
||||
|
||||
### clear <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun clear()
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 清除全部已记录的日志。
|
||||
|
||||
### saveToFile <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun saveToFile(fileName: String)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 保存当前日志到文件。
|
||||
|
||||
若当前未开启 `Configs.isRecord` 或记录为空则不会进行任何操作。
|
||||
|
||||
日志文件会追加到 `fileName` 的文件结尾,若文件不存在会自动创建。
|
||||
|
||||
::: danger
|
||||
|
||||
文件读写权限取决于当前宿主已获取的权限。
|
||||
|
||||
:::
|
||||
|
||||
### Configs <span class="symbol">- object</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
object Configs
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 配置 `YukiHookLogger`。
|
||||
|
||||
#### TAG <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
const val TAG: Int
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 标签。
|
||||
|
||||
#### PRIORITY <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
const val PRIORITY: Int
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 优先级。
|
||||
|
||||
#### PACKAGE_NAME <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
const val PACKAGE_NAME: Int
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 当前宿主的包名。
|
||||
|
||||
#### USER_ID <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
const val USER_ID: Int
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 当前宿主的用户 ID (主用户不显示)。
|
||||
|
||||
#### isEnable <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
var isEnable: Boolean
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 是否启用调试日志的输出功能。
|
||||
|
||||
关闭后将会停用 `YukiHookAPI` 对全部日志的输出。
|
||||
|
||||
但是不影响当你手动调用下面这些方法输出日志。
|
||||
|
||||
`loggerD`、`loggerI`、`loggerW`、`loggerE`。
|
||||
|
||||
当 `isEnable` 关闭后 `YukiHookAPI.Configs.isDebug` 也将同时关闭。
|
||||
|
||||
#### isRecord <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
var isRecord: Boolean
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 是否启用调试日志的记录功能。
|
||||
|
||||
开启后将会在内存中记录全部可用的日志和异常堆栈。
|
||||
|
||||
需要同时启用 [isEnable](#isenable-field) 才能有效。
|
||||
|
||||
::: danger
|
||||
|
||||
过量的日志可能会导致宿主运行缓慢或造成频繁 GC。
|
||||
|
||||
:::
|
||||
|
||||
开启后你可以调用 [YukiHookLogger.saveToFile](#savetofile-method) 实时保存日志到文件或使用 [YukiHookLogger.contents](#contents-field) 获取实时日志文件。
|
||||
|
||||
#### tag <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
var tag: String
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 这是一个调试日志的全局标识。
|
||||
|
||||
默认文案为 `YukiHookAPI`。
|
||||
|
||||
你可以修改为你自己的文案。
|
||||
|
||||
#### elements <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun elements(vararg item: Int)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 自定义调试日志对外显示的元素。
|
||||
|
||||
只对日志记录和 `XposedBridge.log` 生效。
|
||||
|
||||
日志元素的排列将按照你在 `item` 中设置的顺序进行显示。
|
||||
|
||||
你还可以留空 `item` 以不显示除日志内容外的全部元素。
|
||||
|
||||
可用的元素有:`TAG`、`PRIORITY`、`PACKAGE_NAME`、`USER_ID`。
|
||||
|
||||
**Function Example**
|
||||
|
||||
打印的日志样式将按照你设置的排列顺序和元素内容进行。
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
elements(TAG, PRIORITY, PACKAGE_NAME, USER_ID)
|
||||
```
|
||||
|
||||
以上内容定义的日志将显示为如下样式。
|
||||
|
||||
> The following example
|
||||
|
||||
```:no-line-numbers
|
||||
[YukiHookAPI][D][com.demo.test][999]--> This is a log
|
||||
```
|
||||
|
||||
如果我们调整元素顺序以及减少个数,那么结果又会不一样。
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
elements(PACKAGE_NAME, USER_ID, PRIORITY)
|
||||
```
|
||||
|
||||
以上内容定义的日志将显示为如下样式。
|
||||
|
||||
> The following example
|
||||
|
||||
```:no-line-numbers
|
||||
[com.demo.test][999][D]--> This is a log
|
||||
```
|
||||
|
||||
## loggerD <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun loggerD(tag: String, msg: String, type: LoggerType)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
`v1.1.0` `modified`
|
||||
|
||||
新增 `type` 参数
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 向 `Logcat` 和 `XposedBridge` 打印日志,级别 `D`。
|
||||
|
||||
`tag` 的默认参数为 `YukiHookAPI.Configs.debugTag`,你可以进行自定义。
|
||||
|
||||
## loggerI <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun loggerI(tag: String, msg: String, type: LoggerType)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
`v1.1.0` `modified`
|
||||
|
||||
新增 `type` 参数
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 向 `Logcat` 和 `XposedBridge` 打印日志,级别 `I`。
|
||||
|
||||
`tag` 的默认参数为 `YukiHookAPI.Configs.debugTag`,你可以进行自定义。
|
||||
|
||||
## loggerW <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun loggerW(tag: String, msg: String, type: LoggerType)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
`v1.1.0` `modified`
|
||||
|
||||
新增 `type` 参数
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 向 `Logcat` 和 `XposedBridge` 打印日志,级别 `W`。
|
||||
|
||||
`tag` 的默认参数为 `YukiHookAPI.Configs.debugTag`,你可以进行自定义。
|
||||
|
||||
## loggerE <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun loggerE(tag: String, msg: String, e: Throwable?, type: LoggerType)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
`v1.1.0` `modified`
|
||||
|
||||
新增 `type` 参数
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 向 `Logcat` 和 `XposedBridge` 打印日志,级别 `E`,可携带 `e` 异常信息,将打印异常堆栈。
|
||||
|
||||
`tag` 的默认参数为 `YukiHookAPI.Configs.debugTag`,你可以进行自定义。
|
@@ -0,0 +1,886 @@
|
||||
---
|
||||
pageClass: code-page
|
||||
---
|
||||
|
||||
::: warning
|
||||
|
||||
The English translation of this page has not been completed, you are welcome to contribute translations to us.
|
||||
|
||||
You can use the **Chrome Translation Plugin** to translate entire pages for reference.
|
||||
|
||||
:::
|
||||
|
||||
# HookParam <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
class HookParam internal constructor(private val creatorInstance: YukiMemberHookCreator, private var param: YukiHookCallback.Param?)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
`v1.1.0` `modified`
|
||||
|
||||
移动 `HookParamWrapper` 到 `YukiHookCallback.Param`
|
||||
|
||||
修正拼写错误的 **creater** 命名到 **creator**
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> Hook 方法、构造方法的目标对象实现类。
|
||||
|
||||
## args <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
val args: Array<Any?>
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
在 `v1.0` 添加
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获取当前 Hook 对象 `member` 或 `constructor` 的参数对象数组。
|
||||
|
||||
这里的数组每项类型默认为 `Any`,你可以使用 `args` 方法来实现 `ArgsModifyer.cast` 功能。
|
||||
|
||||
<h2 class="deprecated">firstArgs - field</h2>
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
`v1.0.75` `removed`
|
||||
|
||||
请使用 `args(index = 0)` 或 `args().first()`
|
||||
|
||||
<h2 class="deprecated">lastArgs - field</h2>
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
`v1.0.75` `removed`
|
||||
|
||||
请使用 `args().last()`
|
||||
|
||||
## instance <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
val instance: Any
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获取当前 Hook 实例的对象。
|
||||
|
||||
::: danger
|
||||
|
||||
如果你当前 Hook 的对象是一个静态,那么它将不存在实例的对象。
|
||||
|
||||
:::
|
||||
|
||||
## instanceClass <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
val instanceClass: Class<*>
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获取当前 Hook 实例的类对象。
|
||||
|
||||
## member <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
val member: Member
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获取当前 Hook 对象的 `Member`。
|
||||
|
||||
在不确定 `Member` 类型为 `Method` 或 `Constructor` 时可以使用此方法。
|
||||
|
||||
## method <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
val method: Method
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获取当前 Hook 对象的方法。
|
||||
|
||||
## constructor <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
val constructor: Constructor
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获取当前 Hook 对象的构造方法。
|
||||
|
||||
## result <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
var result: Any?
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获取、设置当前 Hook 对象的 `method` 或 `constructor` 的返回值。
|
||||
|
||||
## hasThrowable <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
val hasThrowable: Boolean
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 判断是否存在设置过的方法调用抛出异常。
|
||||
|
||||
## throwable <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
val throwable: Throwable?
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获取设置的方法调用抛出异常。
|
||||
|
||||
## Throwable.throwToApp <span class="symbol">- i-ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun Throwable.throwToApp()
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 向 Hook APP 抛出异常。
|
||||
|
||||
使用 `hasThrowable` 判断当前是否存在被抛出的异常。
|
||||
|
||||
使用 `throwable` 获取当前设置的方法调用抛出异常。
|
||||
|
||||
仅会在回调方法的 `MemberHookCreator.beforeHook` 或 `MemberHookCreator.afterHook` 中生效。
|
||||
|
||||
::: danger
|
||||
|
||||
设置后会同时执行 **resultNull** 方法并将异常抛出给当前 Hook APP。
|
||||
|
||||
:::
|
||||
|
||||
**Function Example**
|
||||
|
||||
Hook 过程中的异常仅会作用于 (Xposed) 宿主环境,目标 Hook APP 不会受到影响。
|
||||
|
||||
若想将异常抛给 Hook APP,可以直接使用如下方法。
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
injectMember {
|
||||
method {
|
||||
// ...
|
||||
}
|
||||
beforeHook {
|
||||
RuntimeException("Test Exception").throwToApp()
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
::: danger
|
||||
|
||||
向 Hook APP 抛出异常<u>**会对其暴露被 Hook 的事实**</u>,是不安全的,容易被检测,请按实际场景合理使用。
|
||||
|
||||
:::
|
||||
|
||||
## result <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun <reified T> result(): T?
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.75` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获取当前 Hook 对象的 `method` 或 `constructor` 的返回值 `T`。
|
||||
|
||||
<h2 class="deprecated">firstArg - method</h2>
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.66` `added`
|
||||
|
||||
`v1.0.75` `removed`
|
||||
|
||||
<h2 class="deprecated">lastArgs - method</h2>
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.66` `added`
|
||||
|
||||
`v1.0.75` `removed`
|
||||
|
||||
## instance <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun <reified T> instance(): T
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获取当前 Hook 实例的对象 `T`。
|
||||
|
||||
**Function Example**
|
||||
|
||||
你可以通过 `instance` 方法轻松使用泛型 `cast` 为目标对象的类型。
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
instance<Activity>().finish()
|
||||
```
|
||||
|
||||
## args <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun args(): ArgsIndexCondition
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.75` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获取当前 Hook 对象的 `method` 或 `constructor` 的参数数组下标实例化类。
|
||||
|
||||
## args <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun args(index: Int): ArgsModifyer
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
`v1.0.75` `modified`
|
||||
|
||||
默认值 `index = 0` 移动到新的使用方法 `args().first()`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获取当前 Hook 对象的 `method` 或 `constructor` 的参数实例化对象类。
|
||||
|
||||
**Function Example**
|
||||
|
||||
你可以通过 `args` 方法修改当前 Hook 实例的方法、构造方法的参数内容。
|
||||
|
||||
你可以直接使用 `set` 方法设置 `param` 为你的目标实例,接受 `Any` 类型。
|
||||
|
||||
::: danger
|
||||
|
||||
请确保 **param** 类型为你的目标实例类型。
|
||||
|
||||
:::
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
args(index = 0).set("modify the value")
|
||||
```
|
||||
|
||||
你可以这样直接设置第一位 `param` 的值。
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
args().first().set("modify the value")
|
||||
```
|
||||
|
||||
你还可以直接设置最后一位 `param` 的值。
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
args().last().set("modify the value")
|
||||
```
|
||||
|
||||
你还可以使用 `setNull` 方法设置 `param` 为空。
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
args(index = 1).setNull()
|
||||
```
|
||||
|
||||
你还可以使用 `setTrue` 方法设置 `param` 为 `true`。
|
||||
|
||||
::: danger
|
||||
|
||||
请确保 **param** 类型为 **Boolean**。
|
||||
|
||||
:::
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
args(index = 1).setTrue()
|
||||
```
|
||||
|
||||
你还可以使用 `setFalse` 方法设置 `param` 为 `false`。
|
||||
|
||||
::: danger
|
||||
|
||||
请确保 **param** 类型为 **Boolean**。
|
||||
|
||||
:::
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
args(index = 1).setFalse()
|
||||
```
|
||||
|
||||
## callOriginal <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun callOriginal(): Any?
|
||||
```
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun <T> callOriginal(): T?
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 执行原始 `Member`。
|
||||
|
||||
调用自身未进行 Hook 的原始 `Member` 并调用原始参数执行。
|
||||
|
||||
**功能实例**
|
||||
|
||||
此方法可以 `invoke` 原始未经 Hook 的 `Member` 对象,取决于原始 `Member` 的参数。
|
||||
|
||||
调用自身原始的方法不会再经过当前 `beforeHook`、`afterHook` 以及 `replaceUnit`、`replaceAny`。
|
||||
|
||||
比如我们 Hook 的这个方法被这样调用 `test("test value")`,使用此方法会调用其中的 `"test value"` 作为参数。
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
injectMember {
|
||||
method {
|
||||
name = "test"
|
||||
param(StringType)
|
||||
returnType = StringType
|
||||
}
|
||||
afterHook {
|
||||
// <方案1> 不使用泛型,不获取方法执行结果,调用将使用原方法传入的 args 自动传参
|
||||
callOriginal()
|
||||
// <方案2> 使用泛型,已知方法执行结果参数类型进行 cast
|
||||
// 假设返回值为 String,失败会返回 null,调用将使用原方法传入的 args 自动传参
|
||||
val value = callOriginal<String>()
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## invokeOriginal <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun invokeOriginal(vararg args: Any?): Any?
|
||||
```
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun <T> invokeOriginal(vararg args: Any?): T?
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
`v1.1.0` `modified`
|
||||
|
||||
不再需要使用 `member.invokeOriginal` 进行调用
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 执行原始 `Member`。
|
||||
|
||||
调用自身未进行 Hook 的原始 `Member` 并自定义 `args` 执行。
|
||||
|
||||
**功能实例**
|
||||
|
||||
此方法可以 `invoke` 原始未经 Hook 的 `Member` 对象,可自定义需要调用的参数内容。
|
||||
|
||||
调用自身原始的方法不会再经过当前 `beforeHook`、`afterHook` 以及 `replaceUnit`、`replaceAny`。
|
||||
|
||||
比如我们 Hook 的这个方法被这样调用 `test("test value")`,使用此方法可自定义其中的 `args` 作为参数。
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
injectMember {
|
||||
method {
|
||||
name = "test"
|
||||
param(StringType)
|
||||
returnType = StringType
|
||||
}
|
||||
afterHook {
|
||||
// <方案1> 不使用泛型,不获取方法执行结果
|
||||
invokeOriginal("test value")
|
||||
// <方案2> 使用泛型,已知方法执行结果参数类型进行 cast,假设返回值为 String,失败会返回 null
|
||||
val value = invokeOriginal<String>("test value")
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## resultTrue <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun resultTrue()
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置当前 Hook 对象方法的 `result` 返回值为 `true`。
|
||||
|
||||
::: danger
|
||||
|
||||
请确保 **result** 类型为 **Boolean**。
|
||||
|
||||
:::
|
||||
|
||||
## resultFalse <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun resultFalse()
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置当前 Hook 对象方法的 `result` 返回值为 `false`。
|
||||
|
||||
::: danger
|
||||
|
||||
请确保 **result** 类型为 **Boolean**。
|
||||
|
||||
:::
|
||||
|
||||
## resultNull <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun resultNull()
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
::: warning
|
||||
|
||||
此方法将强制设置 Hook 对象方法的 **result** 为 **null**。
|
||||
|
||||
:::
|
||||
|
||||
## ArgsIndexCondition <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inner class ArgsIndexCondition internal constructor()
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.75` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 对方法参数的数组下标进行实例化类。
|
||||
|
||||
### first <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun first(): ArgsModifyer
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.75` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获取当前 Hook 对象的 `method` 或 `constructor` 的参数数组第一位。
|
||||
|
||||
### last <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun last(): ArgsModifyer
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.75` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获取当前 Hook 对象的 `method` 或 `constructor` 的参数数组最后一位。
|
||||
|
||||
## ArgsModifyer <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inner class ArgsModifyer internal constructor(private val index: Int)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 对方法参数的修改进行实例化类。
|
||||
|
||||
### cast <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun <T> cast(): T?
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.66` `added`
|
||||
|
||||
`v1.0.68` `modified`
|
||||
|
||||
修改 ~~`of`~~ 为 `cast`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 得到方法参数的实例对象 `T`。
|
||||
|
||||
### byte <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun byte(): Byte?
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.68` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 得到方法参数的实例对象 Byte。
|
||||
|
||||
### int <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun int(): Int
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.66` `added`
|
||||
|
||||
`v1.0.68` `modified`
|
||||
|
||||
修改 ~~`ofInt`~~ 为 `int`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 得到方法参数的实例对象 Int。
|
||||
|
||||
### long <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun long(): Long
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.66` `added`
|
||||
|
||||
`v1.0.68` `modified`
|
||||
|
||||
修改 ~~`ofLong`~~ 为 `long`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 得到方法参数的实例对象 Long。
|
||||
|
||||
### short <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun short(): Short
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.66` `added`
|
||||
|
||||
`v1.0.68` `modified`
|
||||
|
||||
修改 ~~`ofShort`~~ 为 `short`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 得到方法参数的实例对象 Short。
|
||||
|
||||
### double <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun double(): Double
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.66` `added`
|
||||
|
||||
`v1.0.68` `modified`
|
||||
|
||||
修改 ~~`ofDouble`~~ 为 `double`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 得到方法参数的实例对象 Double。
|
||||
|
||||
### float <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun float(): Float
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.66` `added`
|
||||
|
||||
`v1.0.68` `modified`
|
||||
|
||||
修改 ~~`ofFloat`~~ 为 `float`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 得到方法参数的实例对象 Float。
|
||||
|
||||
### string <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun string(): String
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.66` `added`
|
||||
|
||||
`v1.0.68` `modified`
|
||||
|
||||
修改 ~~`ofString`~~ 为 `string`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 得到方法参数的实例对象 String。
|
||||
|
||||
### char <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun char(): Char
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.68` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 得到方法参数的实例对象 Char。
|
||||
|
||||
### boolean <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun boolean(): Boolean
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.66` `added`
|
||||
|
||||
`v1.0.68` `modified`
|
||||
|
||||
修改 ~~`ofBoolean`~~ 为 `boolean`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 得到方法参数的实例对象 Boolean。
|
||||
|
||||
### any <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun any(): Any?
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.77` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 得到方法参数的实例对象 Any。
|
||||
|
||||
### array <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun <reified T> array(): Array<T>
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.68` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 得到方法参数的实例对象 Array。
|
||||
|
||||
### list <span class="symbol">- method</span>
|
||||
```kotlin:no-line-numbers
|
||||
inline fun <reified T> list(): List<T>
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.68` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 得到方法参数的实例对象 List。
|
||||
|
||||
### set <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun <T> set(any: T?)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置方法参数的实例对象。
|
||||
|
||||
### setNull <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun setNull()
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置方法参数的实例对象为 `null`。
|
||||
|
||||
### setTrue <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun setTrue()
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置方法参数的实例对象为 `true`。
|
||||
|
||||
::: danger
|
||||
|
||||
请确保目标对象的类型是 **Boolean**。
|
||||
|
||||
:::
|
||||
|
||||
### setFalse <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun setFalse()
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置方法参数的实例对象为 `false`。
|
||||
|
||||
::: danger
|
||||
|
||||
请确保目标对象的类型是 **Boolean**。
|
||||
|
||||
:::
|
@@ -0,0 +1,996 @@
|
||||
---
|
||||
pageClass: code-page
|
||||
---
|
||||
|
||||
::: warning
|
||||
|
||||
The English translation of this page has not been completed, you are welcome to contribute translations to us.
|
||||
|
||||
You can use the **Chrome Translation Plugin** to translate entire pages for reference.
|
||||
|
||||
:::
|
||||
|
||||
# PackageParam <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
open class PackageParam internal constructor(internal var wrapper: PackageParamWrapper?)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 装载 Hook 的目标 APP 入口对象实现类。
|
||||
|
||||
## appClassLoader <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
val appClassLoader:ClassLoader
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获取当前 Hook APP 的 `ClassLoader`。
|
||||
|
||||
## appInfo <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
val appInfo: ApplicationInfo
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获取当前 Hook APP 的 `ApplicationInfo`。
|
||||
|
||||
## appUserId <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
val appUserId: Int
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获取当前 Hook APP 的用户 ID。
|
||||
|
||||
机主为 `0`,应用双开 (分身) 或工作资料因系统环境不同 ID 也各不相同。
|
||||
|
||||
## appContext <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
val appContext: Application?
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.72` `added`
|
||||
|
||||
`v1.1.0` `modified`
|
||||
|
||||
加入可空类型 (空安全)
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获取当前 Hook APP 的 `Application`。
|
||||
|
||||
::: danger
|
||||
|
||||
首次装载可能是空的,请延迟一段时间再获取或使用 **onAppLifecycle** 监听来完成。
|
||||
|
||||
:::
|
||||
|
||||
## appResources <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
val appResources:Resources?
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.80` `added`
|
||||
|
||||
`v1.1.0` `modified`
|
||||
|
||||
加入可空类型 (空安全)
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获取当前 Hook APP 的 Resources。
|
||||
|
||||
::: danger
|
||||
|
||||
你只能在 **HookResources.hook** 方法体内或 **appContext** 装载完毕时进行调用。
|
||||
|
||||
:::
|
||||
|
||||
## systemContext <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
val systemContext: Context
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获取当前系统框架的 `Context`。
|
||||
|
||||
## processName <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
val processName: String
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获取当前 Hook APP 的进程名称。
|
||||
|
||||
## packageName <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
val packageName: String
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获取当前 Hook APP 的包名。
|
||||
|
||||
## isFirstApplication <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
val isFirstApplication: Boolean
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获取当前 Hook APP 是否为第一个 `Application`。
|
||||
|
||||
## mainProcessName <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
val mainProcessName: String
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.70` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获取当前 Hook APP 的主进程名称。
|
||||
|
||||
其对应的就是 `packageName`。
|
||||
|
||||
## moduleAppFilePath <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
val moduleAppFilePath: String
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.80` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获取当前 Xposed 模块自身 APK 文件路径。
|
||||
|
||||
::: danger
|
||||
|
||||
作为 Hook API 装载时无法使用,会获取到空字符串。
|
||||
|
||||
:::
|
||||
|
||||
## moduleAppResources <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
val moduleAppResources: YukiModuleResources
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.80` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获取当前 Xposed 模块自身 `Resources`。
|
||||
|
||||
::: danger
|
||||
|
||||
作为 Hook API 或不支持的 Hook Framework 装载时无法使用,会抛出异常。
|
||||
|
||||
:::
|
||||
|
||||
## prefs <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
val prefs: YukiHookModulePrefs
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获得当前使用的存取数据对象缓存实例。
|
||||
|
||||
::: danger
|
||||
|
||||
作为 Hook API 装载时无法使用,会抛出异常。
|
||||
|
||||
:::
|
||||
|
||||
## prefs <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun prefs(name: String): YukiHookModulePrefs
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
`v1.0.80` `modified`
|
||||
|
||||
将方法体进行 inline
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获得当前使用的存取数据对象缓存实例。
|
||||
|
||||
你可以通过 `name` 来自定义 Sp 存储的名称。
|
||||
|
||||
::: danger
|
||||
|
||||
作为 Hook API 装载时无法使用,会抛出异常。
|
||||
|
||||
:::
|
||||
|
||||
## dataChannel <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
val dataChannel: YukiHookDataChannel.NameSpace
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.88` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获得当前使用的数据通讯桥命名空间对象。
|
||||
|
||||
::: danger
|
||||
|
||||
作为 Hook API 装载时无法使用,会抛出异常。
|
||||
|
||||
:::
|
||||
|
||||
## resources <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun resources(): HookResources
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.80` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获得当前 Hook APP 的 `YukiResources` 对象。
|
||||
|
||||
请调用 `HookResources.hook` 方法开始 Hook。
|
||||
|
||||
## refreshModuleAppResources <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun refreshModuleAppResources()
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.87` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 刷新当前 Xposed 模块自身 `Resources`。
|
||||
|
||||
## onAppLifecycle <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun onAppLifecycle(initiate: AppLifecycle.() -> Unit)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.88` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 监听当前 Hook APP 生命周期装载事件。
|
||||
|
||||
::: warning
|
||||
|
||||
在 **loadZygote** 中不会被装载,仅会在 **loadSystem**、**loadApp** 中装载。
|
||||
|
||||
作为 Hook API 装载时请使用原生的 **Application** 实现生命周期监听。
|
||||
|
||||
:::
|
||||
|
||||
## loadApp <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun loadApp(name: String, initiate: PackageParam.() -> Unit)
|
||||
```
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun loadApp(name: String, hooker: YukiBaseHooker)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
`v1.0.80` `modified`
|
||||
|
||||
将方法体进行 inline
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 装载并 Hook 指定包名的 APP。
|
||||
|
||||
`name` 为 APP 的包名,后方的两个参数一个可作为 `lambda` 方法体使用,一个可以直接装载子 Hooker。
|
||||
|
||||
装载并 Hook 指定、全部包名的 APP。
|
||||
|
||||
若要装载 APP Zygote 事件,请使用 `loadZygote`。
|
||||
|
||||
若要 Hook 系统框架,请使用 `loadSystem`。
|
||||
|
||||
**Function Example**
|
||||
|
||||
你可以使用 `loadApp` 的 `lambda` 方法体形式或直接装载一个 Hooker。
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
// 使用 lambda
|
||||
loadApp(name = "com.example.test") {
|
||||
// Your code here.
|
||||
}
|
||||
// 使用 Hooker
|
||||
loadApp(name = "com.example.test", CustomHooker)
|
||||
```
|
||||
|
||||
若不指定 `name` 参数,则此方法体默认会过滤当前系统中全部可被 Hook 的 APP。
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
// 使用 lambda
|
||||
loadApp {
|
||||
// Your code here.
|
||||
}
|
||||
// 使用 Hooker
|
||||
loadApp(hooker = CustomHooker)
|
||||
```
|
||||
|
||||
## loadZygote <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun loadZygote(initiate: PackageParam.() -> Unit)
|
||||
```
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun loadZygote(hooker: YukiBaseHooker)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.80` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 装载 APP Zygote 事件。
|
||||
|
||||
方法中的两个参数一个可作为 `lambda` 方法体使用,一个可以直接装载子 Hooker。
|
||||
|
||||
## loadSystem <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun loadSystem(initiate: PackageParam.() -> Unit)
|
||||
```
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun loadSystem(hooker: YukiBaseHooker)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.82` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 装载并 Hook 系统框架。
|
||||
|
||||
方法中的两个参数一个可作为 `lambda` 方法体使用,一个可以直接装载子 Hooker。
|
||||
|
||||
## withProcess <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun withProcess(name: String, initiate: PackageParam.() -> Unit)
|
||||
```
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun withProcess(name: String, hooker: YukiBaseHooker)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.70` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 装载并 Hook APP 的指定进程。
|
||||
|
||||
`name` 为 APP 的进程名称,后方的两个参数一个可作为 `lambda` 方法体使用,一个可以直接装载子 Hooker。
|
||||
|
||||
## loadHooker <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun loadHooker(hooker: YukiBaseHooker)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 装载 Hook 子类。
|
||||
|
||||
你可以填入 `hooker` 在 Hooker 中继续装载 Hooker。
|
||||
|
||||
## searchClass <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun searchClass(name: String, async: Boolean, initiate: ClassConditions): DexClassFinder.Result
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 通过 `appClassLoader` 按指定条件查找并得到当前 Hook APP **Dex** 中的 `Class`。
|
||||
|
||||
::: danger
|
||||
|
||||
此方法在 **Class** 数量过多及查找条件复杂时会非常耗时。
|
||||
|
||||
建议启用 **async** 或设置 **name** 参数,**name** 参数将在 Hook APP (宿主) 不同版本中自动进行本地缓存以提升效率。
|
||||
|
||||
此功能尚在试验阶段,性能与稳定性可能仍然存在问题,使用过程遇到问题请向我们报告并帮助我们改进。
|
||||
|
||||
:::
|
||||
|
||||
<h2 class="deprecated">String+VariousClass.clazz - i-ext-field</h2>
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
`v1.1.0` `deprecated`
|
||||
|
||||
请转移到 `toClass(...)` 方法
|
||||
|
||||
<h2 class="deprecated">String.hasClass - i-ext-field</h2>
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
`v1.1.0` `deprecated`
|
||||
|
||||
请转移到 `hasClass(...)` 方法
|
||||
|
||||
## String+VariousClass.toClass <span class="symbol">- i-ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun String.toClass(loader: ClassLoader?): Class<*>
|
||||
```
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun VariousClass.toClass(loader: ClassLoader?): Class<*>
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 通过字符串类名、`VariousClass` 转换为 `loader` 中的实体类。
|
||||
|
||||
默认使用当前 `appClassLoader` 装载目标 `Class`。
|
||||
|
||||
**Function Example**
|
||||
|
||||
你可以轻松地将 `String` 类型的 `Class` 包名转为 `Class` 实例。
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
"com.example.demo.DemoClass".toClass()
|
||||
```
|
||||
|
||||
你还可以向 `loader` 参数传入你自定义的 `ClassLoader`。
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
val customClassLoader: ClassLoader? = ... // 假设这个就是你的 ClassLoader
|
||||
"com.example.demo.DemoClass".toClass(customClassLoader)
|
||||
```
|
||||
|
||||
你还可以创建一个 `VariousClass`,并转换为实体类。
|
||||
|
||||
`VariousClass` 会枚举所有设置的 `Class` 并最终获得第一个存在的 `Class`。
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
VariousClass("com.example.demo.DemoClass1", "com.example.demo.DemoClass2").toClass()
|
||||
```
|
||||
|
||||
同样地,你还可以向 `loader` 参数传入你自定义的 `ClassLoader`。
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
val customClassLoader: ClassLoader? = ... // 假设这个就是你的 ClassLoader
|
||||
VariousClass("com.example.demo.DemoClass1", "com.example.demo.DemoClass2").toClass(customClassLoader)
|
||||
```
|
||||
|
||||
## String+VariousClass.toClassOrNull <span class="symbol">- i-ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun String.toClassOrNull(loader: ClassLoader?): Class<*>?
|
||||
```
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun VariousClass.toClassOrNull(loader: ClassLoader?): Class<*>?
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 通过字符串类名、`VariousClass` 转换为 `loader` 中的实体类。
|
||||
|
||||
默认使用当前 `appClassLoader` 装载目标 `Class`。
|
||||
|
||||
找不到 `Class` 会返回 `null`,不会抛出异常。
|
||||
|
||||
**Function Example**
|
||||
|
||||
用法请参考 [String+VariousClass.toClass](#string-variousclass-toclass-i-ext-method) 方法。
|
||||
|
||||
## String.hasClass <span class="symbol">- i-ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun String.hasClass(loader: ClassLoader?): Boolean
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 通过字符串类名查找是否存在。
|
||||
|
||||
默认使用当前 `appClassLoader` 装载目标 `Class`。
|
||||
|
||||
**Function Example**
|
||||
|
||||
你可以轻松的使用此方法判断字符串中的类是否存在。
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
if("com.example.demo.DemoClass".hasClass()) {
|
||||
// Your code here.
|
||||
}
|
||||
```
|
||||
|
||||
你还可以自定义其中的 `loader` 参数,默认为 `appClassLoader`。
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
val customClassLoader: ClassLoader? = ... // 假设这个就是你的 ClassLoader
|
||||
if("com.example.demo.DemoClass".hasClass(customClassLoader)) {
|
||||
// Your code here.
|
||||
}
|
||||
```
|
||||
|
||||
## findClass <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun findClass(name: String, loader: ClassLoader?): HookClass
|
||||
```
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun findClass(vararg name: String, loader: ClassLoader?): VariousClass
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
`v1.0.1` `modified`
|
||||
|
||||
移除了 ~~`findClass(various: VariousClass)`~~ 方法
|
||||
|
||||
`v1.1.0` `modified`
|
||||
|
||||
新增 `loader` 参数
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 通过完整包名+名称查找需要被 Hook 的 `Class`。
|
||||
|
||||
::: warning
|
||||
|
||||
使用此方法会得到一个 **HookClass** 仅用于 Hook,若想查找 **Class** 请使用 [toClass](#string-variousclass-toclass-i-ext-method) 功能。
|
||||
|
||||
:::
|
||||
|
||||
**Function Example**
|
||||
|
||||
你可以使用三种方式查找你需要 Hook 的目标 `Class`。
|
||||
|
||||
你可以直接将被查找的 `Class` 完整包名+名称填入 `name` 中。
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
findClass(name = "com.example.demo.DemoClass")
|
||||
```
|
||||
|
||||
若你不确定多个版本的 `Class` 以及不同名称,你可以将多个完整包名+名称填入 `name` 中。
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
findClass("com.example.demo.DemoClass1", "com.example.demo.DemoClass2", "com.example.demo.DemoClass3")
|
||||
```
|
||||
|
||||
你还可以创建一个 `VariousClass`,将 `Class` 的完整包名+名称填入 `VariousClass` 的 `name` 中并填入 `various` 参数中。
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
val variousClass = VariousClass("com.example.demo.DemoClass1", "com.example.demo.DemoClass2", "com.example.demo.DemoClass3")
|
||||
```
|
||||
|
||||
若你当前需要查找的 `Class` 不属于 `appClassLoader`,你可以使用 `loader` 参数指定你要装载的 `ClassLoader`。
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
val outsideLoader: ClassLoader? = ... // 假设这就是你的 ClassLoader
|
||||
findClass(name = "com.example.demo.OutsideClass", loader = outsideLoader)
|
||||
```
|
||||
|
||||
同样地,在不确定多个版本的 `Class` 以及不同名称时,也可以使用 `loader` 参数指定你要装载的 `ClassLoader`。
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
val outsideLoader: ClassLoader? = ... // 假设这就是你的 ClassLoader
|
||||
findClass("com.example.demo.OutsideClass1", "com.example.demo.OutsideClass2", "com.example.demo.OutsideClass3", loader = outsideLoader)
|
||||
```
|
||||
|
||||
## String+Class+VariousClass+HookClass.hook <span class="symbol">- i-ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun String.hook(initiate: YukiMemberHookCreator.() -> Unit): YukiMemberHookCreator.Result
|
||||
```
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun Class<*>.hook(isForceUseAbsolute: Boolean, initiate: YukiMemberHookCreator.() -> Unit): YukiMemberHookCreator.Result
|
||||
```
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun VariousClass.hook(initiate: YukiMemberHookCreator.() -> Unit): YukiMemberHookCreator.Result
|
||||
```
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun HookClass.hook(initiate: YukiMemberHookCreator.() -> Unit): YukiMemberHookCreator.Result
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
`v1.0.1` `modified`
|
||||
|
||||
新增 `VariousClass` 的直接调用 `hook` 方法
|
||||
|
||||
`v1.0.2` `modified`
|
||||
|
||||
新增 `String` 的直接调用 `hook` 方法
|
||||
|
||||
`v1.0.3` `modified`
|
||||
|
||||
新增 `YukiMemberHookCreator.Result` 返回值
|
||||
|
||||
`v1.0.70` `modified`
|
||||
|
||||
新增 `isUseAppClassLoader` 参数
|
||||
|
||||
`v1.0.80` `modified`
|
||||
|
||||
将方法体进行 inline
|
||||
|
||||
`v1.1.0` `modified`
|
||||
|
||||
移除了 ~~`isUseAppClassLoader`~~ 参数
|
||||
|
||||
添加了 `isForceUseAbsolute` 参数到 `Class.hook` 方法
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 这是一切 Hook 的入口创建方法,Hook 方法、构造方法。
|
||||
|
||||
**Function Example**
|
||||
|
||||
如你所见,Hook 方法体的创建可使用 4 种方式。
|
||||
|
||||
通过字符串类名得到 `HookClass` 实例进行创建。
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
"com.example.demo.DemoClass".hook {
|
||||
// Your code here.
|
||||
}
|
||||
|
||||
```
|
||||
通过 `findClass` 得到 `HookClass` 实例进行创建。
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
findClass(name = "com.example.demo.DemoClass").hook {
|
||||
// Your code here.
|
||||
}
|
||||
```
|
||||
|
||||
使用 `stub` 或直接拿到 `Class` 实例进行创建。
|
||||
|
||||
默认情况下 API 会将 `Class` 实例转换为类名并绑定到 `appClassLoader`,若失败,则会使用原始 `Class` 实例直接进行 Hook。
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
Stub::class.java.hook {
|
||||
// Your code here.
|
||||
}
|
||||
```
|
||||
|
||||
若当前 `Class` 不在 `appClassLoader` 且自动匹配无法找到该 `Class`,请启用 `isForceUseAbsolute`。
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
YourClass::class.java.hook(isForceUseAbsolute = true) {
|
||||
// Your code here.
|
||||
}
|
||||
```
|
||||
|
||||
使用 `VariousClass` 实例进行创建。
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
VariousClass("com.example.demo.DemoClass1", "com.example.demo.DemoClass2").hook {
|
||||
// Your code here.
|
||||
}
|
||||
```
|
||||
|
||||
或者直接使用可变字符串数组进行创建。
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
findClass("com.example.demo.DemoClass1", "com.example.demo.DemoClass2").hook {
|
||||
// Your code here.
|
||||
}
|
||||
```
|
||||
|
||||
## HookResources.hook <span class="symbol">- i-ext-method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun HookResources.hook(initiate: YukiResourcesHookCreator.() -> Unit)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.80` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> Hook APP 的 Resources。
|
||||
|
||||
::: danger
|
||||
|
||||
请注意你需要确保当前 Hook Framework 支持且 **InjectYukiHookWithXposed.isUsingResourcesHook** 已启用。
|
||||
|
||||
:::
|
||||
|
||||
**Function Example**
|
||||
|
||||
Resources Hook 为固定用法,获取 `resources` 对象,然后调用 `hook` 方法开始 Hook。
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
resources().hook {
|
||||
// Your code here.
|
||||
}
|
||||
```
|
||||
|
||||
::: danger
|
||||
|
||||
这是固定用法,为了防止发生问题,你不可手动实现任何 **HookResources** 实例执行 **hook** 调用。
|
||||
|
||||
:::
|
||||
|
||||
将 Resources 的 Hook 设置为这样是为了与 `findClass(...).hook` 做到统一,使得调用起来逻辑不会混乱。
|
||||
|
||||
## AppLifecycle <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inner class AppLifecycle internal constructor()
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.88` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 当前 Hook APP 的生命周期实例处理类。
|
||||
|
||||
### attachBaseContext <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun attachBaseContext(result: (baseContext: Context, hasCalledSuper: Boolean) -> Unit)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.88` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 监听当前 Hook APP 装载 `Application.attachBaseContext`。
|
||||
|
||||
### onCreate <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun onCreate(initiate: Application.() -> Unit)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.88` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 监听当前 Hook APP 装载 `Application.onCreate`。
|
||||
|
||||
### onTerminate <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun onTerminate(initiate: Application.() -> Unit)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.88` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 监听当前 Hook APP 装载 `Application.onTerminate`。
|
||||
|
||||
### onLowMemory <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun onLowMemory(initiate: Application.() -> Unit)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.88` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 监听当前 Hook APP 装载 `Application.onLowMemory`。
|
||||
|
||||
### onTrimMemory <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun onTrimMemory(result: (self: Application, level: Int) -> Unit)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.88` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 监听当前 Hook APP 装载 `Application.onTrimMemory`。
|
||||
|
||||
### onConfigurationChanged <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun onConfigurationChanged(result: (self: Application, config: Configuration) -> Unit)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.88` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 监听当前 Hook APP 装载 `Application.onConfigurationChanged`。
|
||||
|
||||
### registerReceiver <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun registerReceiver(vararg action: String, result: (context: Context, intent: Intent) -> Unit)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.88` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 注册系统广播监听。
|
@@ -0,0 +1,23 @@
|
||||
---
|
||||
pageClass: code-page
|
||||
---
|
||||
|
||||
::: warning
|
||||
|
||||
The English translation of this page has not been completed, you are welcome to contribute translations to us.
|
||||
|
||||
You can use the **Chrome Translation Plugin** to translate entire pages for reference.
|
||||
|
||||
:::
|
||||
|
||||
# ComponentTypeFactory <span class="symbol">- kt</span>
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 这是一个预置 Hook 类型的常量类,主要为 `Android` 相关组件的 `Class` 内容,跟随版本更新会逐一进行增加。
|
||||
|
||||
详情可 [点击这里](https://github.com/fankes/YukiHookAPI/blob/master/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/type/android/ComponentTypeFactory.kt) 进行查看。
|
@@ -0,0 +1,23 @@
|
||||
---
|
||||
pageClass: code-page
|
||||
---
|
||||
|
||||
::: warning
|
||||
|
||||
The English translation of this page has not been completed, you are welcome to contribute translations to us.
|
||||
|
||||
You can use the **Chrome Translation Plugin** to translate entire pages for reference.
|
||||
|
||||
:::
|
||||
|
||||
# GraphicsTypeFactory <span class="symbol">- kt</span>
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 这是一个预置 Hook 类型的常量类,主要为 `Android` 相关 `Graphics` 的 `Class` 内容,跟随版本更新会逐一进行增加。
|
||||
|
||||
详情可 [点击这里](https://github.com/fankes/YukiHookAPI/blob/master/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/type/android/GraphicsTypeFactory.kt) 进行查看。
|
@@ -0,0 +1,23 @@
|
||||
---
|
||||
pageClass: code-page
|
||||
---
|
||||
|
||||
::: warning
|
||||
|
||||
The English translation of this page has not been completed, you are welcome to contribute translations to us.
|
||||
|
||||
You can use the **Chrome Translation Plugin** to translate entire pages for reference.
|
||||
|
||||
:::
|
||||
|
||||
# ViewTypeFactory <span class="symbol">- kt</span>
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 这是一个预置 Hook 类型的常量类,主要为 `Android` 相关 `Widget` 的 `Class` 内容,跟随版本更新会逐一进行增加。
|
||||
|
||||
详情可 [点击这里](https://github.com/fankes/YukiHookAPI/blob/master/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/type/android/ViewTypeFactory.kt) 进行查看。
|
@@ -0,0 +1,35 @@
|
||||
---
|
||||
pageClass: code-page
|
||||
---
|
||||
|
||||
::: warning
|
||||
|
||||
The English translation of this page has not been completed, you are welcome to contribute translations to us.
|
||||
|
||||
You can use the **Chrome Translation Plugin** to translate entire pages for reference.
|
||||
|
||||
:::
|
||||
|
||||
# DefinedTypeFactory <span class="symbol">- kt</span>
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 这是一个内部类型的定义常量类,主要用于反射 API 相关用法的延伸。
|
||||
|
||||
## VagueType <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
val VagueType: Class<*>
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 得到模糊类型。
|
@@ -0,0 +1,23 @@
|
||||
---
|
||||
pageClass: code-page
|
||||
---
|
||||
|
||||
::: warning
|
||||
|
||||
The English translation of this page has not been completed, you are welcome to contribute translations to us.
|
||||
|
||||
You can use the **Chrome Translation Plugin** to translate entire pages for reference.
|
||||
|
||||
:::
|
||||
|
||||
# VariableTypeFactory <span class="symbol">- kt</span>
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 这是一个预置 Hook 类型的常量类,主要为 `Java` 相关基本变量类型的 `Class` 内容,跟随版本更新会逐一进行增加。
|
||||
|
||||
详情可 [点击这里](https://github.com/fankes/YukiHookAPI/blob/master/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/type/java/VariableTypeFactory.kt) 进行查看。
|
@@ -0,0 +1,92 @@
|
||||
---
|
||||
pageClass: code-page
|
||||
---
|
||||
|
||||
::: warning
|
||||
|
||||
The English translation of this page has not been completed, you are welcome to contribute translations to us.
|
||||
|
||||
You can use the **Chrome Translation Plugin** to translate entire pages for reference.
|
||||
|
||||
:::
|
||||
|
||||
# ModuleApplication <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
open class ModuleApplication: Application()
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.77` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 这是对使用 `YukiHookAPI` Xposed 模块实现中的一个扩展功能。
|
||||
|
||||
在你的 Xposed 模块的 `Application` 中继承此类。
|
||||
|
||||
或在 `AndroidManifest.xml` 的 `application` 标签中指定此类。
|
||||
|
||||
目前可实现功能如下
|
||||
|
||||
- 全局共享模块中静态的 `appContext`
|
||||
|
||||
- 在模块与宿主中装载 `YukiHookAPI.Config` 以确保 `YukiHookAPI.Configs.debugTag` 不需要重复定义
|
||||
|
||||
- 在模块与宿主中使用 `YukiHookDataChannel` 进行通讯
|
||||
|
||||
- 在模块中使用系统隐藏 API,核心技术引用了开源项目 [FreeReflection](https://github.com/tiann/FreeReflection)
|
||||
|
||||
- 在模块中使用 `YukiHookAPI.Status.isTaiChiModuleActive` 判断太极、无极激活状态
|
||||
|
||||
**Function Example**
|
||||
|
||||
将此类继承到你的自定义 `Application` 上。
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
package com.demo
|
||||
|
||||
class MyApplication: ModuleApplication() {
|
||||
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
在 `AndroidManifest.xml` 的 `application` 标签中指定自定义的 `Application`。
|
||||
|
||||
> The following example
|
||||
|
||||
```xml
|
||||
<application
|
||||
android:name="com.demo.MyApplication"
|
||||
...>
|
||||
```
|
||||
|
||||
如果你不需要自定义 `Application` 可以直接将 `ModuleApplication` 设置到 `AndroidManifest.xml` 的 `application` 标签中。
|
||||
|
||||
> The following example
|
||||
|
||||
```xml
|
||||
<application
|
||||
android:name="com.highcapable.yukihookapi.hook.xposed.application.ModuleApplication"
|
||||
...>
|
||||
```
|
||||
|
||||
## appContext <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
val appContext: ModuleApplication
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.77` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获取全局静态 `Application` 实例。
|
@@ -0,0 +1,41 @@
|
||||
---
|
||||
pageClass: code-page
|
||||
---
|
||||
|
||||
::: warning
|
||||
|
||||
The English translation of this page has not been completed, you are welcome to contribute translations to us.
|
||||
|
||||
You can use the **Chrome Translation Plugin** to translate entire pages for reference.
|
||||
|
||||
:::
|
||||
|
||||
# YukiModuleResources <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
class YukiModuleResources private constructor(private val baseInstance: XModuleResources) : Resources
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.80` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 对接 `XModuleResources` 的中间层实例。
|
||||
|
||||
## fwd <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun fwd(resId: Int): YukiResForwarder
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.80` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 对接 `XModuleResources.fwd` 方法。
|
||||
|
||||
创建 `YukiResForwarder` 与 `XResForwarder` 实例。
|
@@ -0,0 +1,63 @@
|
||||
---
|
||||
pageClass: code-page
|
||||
---
|
||||
|
||||
::: warning
|
||||
|
||||
The English translation of this page has not been completed, you are welcome to contribute translations to us.
|
||||
|
||||
You can use the **Chrome Translation Plugin** to translate entire pages for reference.
|
||||
|
||||
:::
|
||||
|
||||
# YukiResForwarder <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
class YukiResForwarder private constructor(private val baseInstance: XResForwarder)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.80` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 对接 `XResForwarder` 的中间层实例。
|
||||
|
||||
<h2 class="deprecated">instance - field</h2>
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.80` `added`
|
||||
|
||||
`v1.1.0` `deprecated`
|
||||
|
||||
不再对外公开 `instance` 参数
|
||||
|
||||
## id <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
val id: Int
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.80` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获得当前 APP 的 Resources Id。
|
||||
|
||||
## resources <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
val resources: Resources
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.80` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获得当前 APP 的 Resources。
|
@@ -0,0 +1,89 @@
|
||||
---
|
||||
pageClass: code-page
|
||||
---
|
||||
|
||||
::: warning
|
||||
|
||||
The English translation of this page has not been completed, you are welcome to contribute translations to us.
|
||||
|
||||
You can use the **Chrome Translation Plugin** to translate entire pages for reference.
|
||||
|
||||
:::
|
||||
|
||||
# YukiResources <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
class YukiResources private constructor(private val baseInstance: XResources) : Resources
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.80` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 对接 `XResources` 的中间层实例。
|
||||
|
||||
## LayoutInflatedParam <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
class LayoutInflatedParam(internal val baseParam: XC_LayoutInflated.LayoutInflatedParam)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.80` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 装载 Hook APP 的目标布局 Resources 实现类。
|
||||
|
||||
### variantName <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
val variantName: String
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.80` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获取当前被 Hook 的布局装载目录名称。
|
||||
|
||||
例如:`layout`、`layout-land`、`layout-sw600dp`。
|
||||
|
||||
### currentView <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
val currentView: View
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.80` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获取当前被 Hook 的布局实例。
|
||||
|
||||
### findViewByIdentifier <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun <reified T : View> View.findViewByIdentifier(name: String): T?
|
||||
```
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun <reified T : View> findViewByIdentifier(name: String): T?
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.80` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 使用 Identifier 查找 Hook APP 指定 Id 的 `View`。
|
||||
|
||||
扩展方法可以使用 Identifier 查找 Hook APP 当前装载布局中指定 Id 的 `View`。
|
@@ -0,0 +1,81 @@
|
||||
---
|
||||
pageClass: code-page
|
||||
---
|
||||
|
||||
::: warning
|
||||
|
||||
The English translation of this page has not been completed, you are welcome to contribute translations to us.
|
||||
|
||||
You can use the **Chrome Translation Plugin** to translate entire pages for reference.
|
||||
|
||||
:::
|
||||
|
||||
# YukiXposedEvent <span class="symbol">- object</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
object YukiXposedEvent
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.80` `first`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 实现对原生 Xposed API 的装载事件监听。
|
||||
|
||||
## events <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun events(initiate: YukiXposedEvent.() -> Unit)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.80` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 对 `YukiXposedEvent` 创建一个方法体。
|
||||
|
||||
## onInitZygote <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun onInitZygote(result: (StartupParam) -> Unit)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.80` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置 initZygote 事件监听。
|
||||
|
||||
## onHandleLoadPackage <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun onHandleLoadPackage(result: (LoadPackageParam) -> Unit)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.80` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置 handleLoadPackage 事件监听。
|
||||
|
||||
## onHandleInitPackageResources <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun onHandleInitPackageResources(result: (InitPackageResourcesParam) -> Unit)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.80` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置 handleInitPackageResources 事件监听。
|
@@ -0,0 +1,161 @@
|
||||
---
|
||||
pageClass: code-page
|
||||
---
|
||||
|
||||
::: warning
|
||||
|
||||
The English translation of this page has not been completed, you are welcome to contribute translations to us.
|
||||
|
||||
You can use the **Chrome Translation Plugin** to translate entire pages for reference.
|
||||
|
||||
:::
|
||||
|
||||
# YukiHookDataChannel <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
class YukiHookDataChannel private constructor()
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.88` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 实现 Xposed 模块的数据通讯桥。
|
||||
|
||||
通过模块与宿主相互注册 `BroadcastReceiver` 来实现数据的交互。
|
||||
|
||||
模块需要将 `Application` 继承于 `ModuleApplication` 来实现此功能。
|
||||
|
||||
::: danger
|
||||
|
||||
模块与宿主需要保持存活状态,否则无法建立通讯。
|
||||
|
||||
:::
|
||||
|
||||
## NameSpace <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inner class NameSpace internal constructor(private val context: Context?, private val packageName: String, private val isSecure: Boolean)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.88` `added`
|
||||
|
||||
`v1.0.90` `modified`
|
||||
|
||||
新增 `isSecure` 参数
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> `YukiHookDataChannel` 命名空间。
|
||||
|
||||
### with <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun with(initiate: NameSpace.() -> Unit): NameSpace
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.88` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 创建一个调用空间。
|
||||
|
||||
### put <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun <T> put(key: String, value: T)
|
||||
```
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun <T> put(data: ChannelData<T>, value: T?)
|
||||
```
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun put(vararg data: ChannelData<*>)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.88` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 发送键值数据。
|
||||
|
||||
### put <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun put(key: String)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.88` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 仅发送键值监听,使用默认值 `VALUE_WAIT_FOR_LISTENER` 发送键值数据。
|
||||
|
||||
### wait <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun <T> wait(key: String, result: (value: T) -> Unit)
|
||||
```
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun <T> wait(data: ChannelData<T>, result: (value: T) -> Unit)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.88` `added`
|
||||
|
||||
`v1.0.90` `modified`
|
||||
|
||||
移除默认值 `value`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获取键值数据。
|
||||
|
||||
### wait <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun wait(key: String, callback: () -> Unit)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.88` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 仅获取监听结果,不获取键值数据。
|
||||
|
||||
::: danger
|
||||
|
||||
仅限使用 **VALUE_WAIT_FOR_LISTENER** 发送的监听才能被接收。
|
||||
|
||||
:::
|
||||
|
||||
### checkingVersionEquals <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun checkingVersionEquals(result: (Boolean) -> Unit)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.88` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获取模块与宿主的版本是否匹配。
|
||||
|
||||
通过此方法可原生判断 Xposed 模块更新后宿主并未重新装载造成两者不匹配的情况。
|
@@ -0,0 +1,76 @@
|
||||
---
|
||||
pageClass: code-page
|
||||
---
|
||||
|
||||
::: warning
|
||||
|
||||
The English translation of this page has not been completed, you are welcome to contribute translations to us.
|
||||
|
||||
You can use the **Chrome Translation Plugin** to translate entire pages for reference.
|
||||
|
||||
:::
|
||||
|
||||
# ChannelData <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
data class ChannelData<T>(var key: String, var value: T?)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.88` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 数据通讯桥键值构造类。
|
||||
|
||||
这个类是对 `YukiHookDataChannel` 的一个扩展用法。
|
||||
|
||||
**Function Example**
|
||||
|
||||
建立一个模板类定义模块与宿主需要发送的键值数据。
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
object DataConst {
|
||||
|
||||
val TEST_KV_DATA_1 = ChannelData("test_data_1", "defalut value")
|
||||
val TEST_KV_DATA_2 = ChannelData("test_data_2", 0)
|
||||
}
|
||||
```
|
||||
|
||||
键值数据定义后,你就可以方便地在模块和宿主中调用所需要发送的数据。
|
||||
|
||||
> 模块示例如下
|
||||
|
||||
```kotlin
|
||||
// 从指定包名的宿主获取
|
||||
dataChannel(packageName = "com.example.demo").wait(DataConst.TEST_KV_DATA_1) { value ->
|
||||
// Your code here.
|
||||
}
|
||||
// 发送给指定包名的宿主 - 未填写 value 时将使用模板提供的默认值
|
||||
dataChannel(packageName = "com.example.demo").put(DataConst.TEST_KV_DATA_1, value = "sending value")
|
||||
```
|
||||
|
||||
> 宿主示例如下
|
||||
|
||||
```kotlin
|
||||
// 从模块获取
|
||||
dataChannel.wait(DataConst.TEST_KV_DATA_1) { value ->
|
||||
// Your code here.
|
||||
}
|
||||
// 发送给模块 - 未填写 value 时将使用模板提供的默认值
|
||||
dataChannel.put(DataConst.TEST_KV_DATA_1, value = "sending value")
|
||||
```
|
||||
|
||||
你依然可以不使用模板定义的默认值,随时修改你的默认值。
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
// 获取 - 此时 value 取到的默认值将会是 2 - 并不是模板提供的 0
|
||||
dataChannel.wait(DataConst.TEST_KV_DATA_2, value = 2) { value ->
|
||||
// Your code here.
|
||||
}
|
||||
```
|
@@ -0,0 +1,29 @@
|
||||
---
|
||||
pageClass: code-page
|
||||
---
|
||||
|
||||
::: warning
|
||||
|
||||
The English translation of this page has not been completed, you are welcome to contribute translations to us.
|
||||
|
||||
You can use the **Chrome Translation Plugin** to translate entire pages for reference.
|
||||
|
||||
:::
|
||||
|
||||
# ModuleAppActivity <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
open class ModuleAppActivity : Activity()
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 代理 `Activity`。
|
||||
|
||||
继承于此类的 `Activity` 可以同时在宿主与模块中启动。
|
||||
|
||||
在 (Xposed) 宿主环境需要在宿主启动时调用 `Context.registerModuleAppActivities` 进行注册。
|
@@ -0,0 +1,45 @@
|
||||
---
|
||||
pageClass: code-page
|
||||
---
|
||||
|
||||
::: warning
|
||||
|
||||
The English translation of this page has not been completed, you are welcome to contribute translations to us.
|
||||
|
||||
You can use the **Chrome Translation Plugin** to translate entire pages for reference.
|
||||
|
||||
:::
|
||||
|
||||
# ModuleAppCompatActivity <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
open class ModuleAppCompatActivity : AppCompatActivity()
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 代理 `AppCompatActivity`。
|
||||
|
||||
继承于此类的 `Activity` 可以同时在宿主与模块中启动。
|
||||
|
||||
在 (Xposed) 宿主环境需要在宿主启动时调用 `Context.registerModuleAppActivities` 进行注册。
|
||||
|
||||
在 (Xposed) 宿主环境需要重写 `moduleTheme` 设置 AppCompat 主题,否则会无法启动。
|
||||
|
||||
## moduleTheme <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
open val moduleTheme: Int
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置当前代理的 `Activity` 主题。
|
@@ -0,0 +1,43 @@
|
||||
---
|
||||
pageClass: code-page
|
||||
---
|
||||
|
||||
::: warning
|
||||
|
||||
The English translation of this page has not been completed, you are welcome to contribute translations to us.
|
||||
|
||||
You can use the **Chrome Translation Plugin** to translate entire pages for reference.
|
||||
|
||||
:::
|
||||
|
||||
# ModuleContextThemeWrapper <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
class ModuleContextThemeWrapper private constructor(baseContext: Context, theme: Int, configuration: Configuration?) : ContextThemeWrapper
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 代理 `ContextThemeWrapper`。
|
||||
|
||||
通过包装,你可以轻松在 (Xposed) 宿主环境使用来自模块的主题资源。
|
||||
|
||||
## applyConfiguration <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun applyConfiguration(initiate: Configuration.() -> Unit): ModuleContextThemeWrapper
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.1.0` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 设置当前 `ModuleContextThemeWrapper` 的 `Configuration`。
|
||||
|
||||
设置后会自动调用 `Resources.updateConfiguration`。
|
@@ -0,0 +1,499 @@
|
||||
---
|
||||
pageClass: code-page
|
||||
---
|
||||
|
||||
::: warning
|
||||
|
||||
The English translation of this page has not been completed, you are welcome to contribute translations to us.
|
||||
|
||||
You can use the **Chrome Translation Plugin** to translate entire pages for reference.
|
||||
|
||||
:::
|
||||
|
||||
# YukiHookModulePrefs <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
class YukiHookModulePrefs private constructor(private var context: Context?)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 实现 Xposed 模块的数据存取,对接 `SharedPreferences` 和 `XSharedPreferences`。
|
||||
|
||||
在不同环境智能选择存取使用的对象。
|
||||
|
||||
::: danger
|
||||
|
||||
此功能为实验性功能,仅在 LSPosed 环境测试通过,EdXposed 理论也可以使用但不再推荐。
|
||||
|
||||
:::
|
||||
|
||||
使用 LSPosed 环境请在 `AndroidManifests.xml` 中将 `xposedminversion` 最低设置为 `93`。
|
||||
|
||||
详见 [New XSharedPreferences](https://github.com/LSPosed/LSPosed/wiki/New-XSharedPreferences#for-the-module)。
|
||||
|
||||
若你在按照规定配置后依然无法使用或出现文件权限错误问题,可以参考 [isEnableHookSharedPreferences](../../../YukiHookAPI#isenablehooksharedpreferences-field)。
|
||||
|
||||
未使用 LSPosed 环境请将你的模块 `API` 降至 `26` 以下,`YukiHookAPI` 将会尝试使用 `makeWorldReadable` 但仍有可能不成功。
|
||||
|
||||
太极请参阅 [文件权限/配置/XSharedPreference](https://taichi.cool/zh/doc/for-xposed-dev.html#文件权限-配置-xsharedpreference)。
|
||||
|
||||
::: danger
|
||||
|
||||
当你在 Xposed 模块中存取数据的时候 **context** 必须不能是空的。
|
||||
|
||||
:::
|
||||
|
||||
若你正在使用 `PreferenceFragmentCompat`,请迁移到 `ModulePreferenceFragment` 以适配上述功能特性。
|
||||
|
||||
**可选配置**
|
||||
|
||||
若你不想将你的模块的 `xposedminversion` 最低设置为 `93`,你可以在 `AndroidManifest.xml` 中添加 `xposedsharedprefs` 来实现支持。
|
||||
|
||||
详见 [New XSharedPreferences](https://github.com/LSPosed/LSPosed/wiki/New-XSharedPreferences#for-the-module)。
|
||||
|
||||
> The following example
|
||||
|
||||
```xml
|
||||
<meta-data
|
||||
android:name="xposedsharedprefs"
|
||||
android:value="true"/>
|
||||
```
|
||||
|
||||
## isXSharePrefsReadable <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
val isXSharePrefsReadable: Boolean
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.90` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获取 `XSharedPreferences` 是否可读。
|
||||
|
||||
::: danger
|
||||
|
||||
只能在 (Xposed) 宿主环境中使用,模块环境中始终返回 false。
|
||||
|
||||
:::
|
||||
|
||||
## isRunInNewXShareMode <span class="symbol">- field</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
val isRunInNewXShareMode: Boolean
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.78` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获取 `YukiHookModulePrefs` 是否正处于 EdXposed/LSPosed 的最高权限运行。
|
||||
|
||||
前提条件为当前 Xposed 模块已被激活。
|
||||
|
||||
::: danger
|
||||
|
||||
只能在模块环境中使用,(Xposed) 宿主环境中始终返回 false。
|
||||
|
||||
:::
|
||||
|
||||
## name <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun name(name: String): YukiHookModulePrefs
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 自定义 Sp 存储名称。
|
||||
|
||||
**Function Example**
|
||||
|
||||
在 `Activity` 中的使用方法。
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
modulePrefs("custom_name").getString("custom_key")
|
||||
```
|
||||
|
||||
在 (Xposed) 宿主环境 `PackageParam` 中的使用方法。
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
prefs("custom_name").getString("custom_key")
|
||||
```
|
||||
|
||||
## direct <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun direct(): YukiHookModulePrefs
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.5` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 忽略缓存直接读取键值。
|
||||
|
||||
无论是否开启 `YukiHookAPI.Configs.isEnableModulePrefsCache`。
|
||||
|
||||
仅在 `XSharedPreferences` 下生效。
|
||||
|
||||
## getString <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun getString(key: String, value: String): String
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获取 `String` 键值。
|
||||
|
||||
## getStringSet <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun getStringSet(key: String, value: Set<String>): Set<String>
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.77` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获取 `Set<String>` 键值。
|
||||
|
||||
## getBoolean <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun getBoolean(key: String, value: Boolean): Boolean
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获取 `Boolean` 键值。
|
||||
|
||||
## getInt <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun getInt(key: String, value: Int): Int
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获取 `Int` 键值。
|
||||
|
||||
## getLong <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun getLong(key: String, value: Long): Long
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获取 `Long` 键值。
|
||||
|
||||
## getFloat <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun getFloat(key: String, value: Float): Float
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获取 `Float` 键值。
|
||||
|
||||
## all <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun all(): HashMap<String, Any?>
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.77` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 获取全部存储的键值数据。
|
||||
|
||||
智能识别对应环境读取键值数据。
|
||||
|
||||
::: danger
|
||||
|
||||
每次调用都会获取实时的数据,不受缓存控制,请勿在高并发场景中使用。
|
||||
|
||||
:::
|
||||
|
||||
## remove <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun remove(key: String)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 移除全部包含 `key` 的存储数据。
|
||||
|
||||
::: warning
|
||||
|
||||
在 (Xposed) 宿主环境下只读,无法使用。
|
||||
|
||||
:::
|
||||
|
||||
## remove <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun <reified T> remove(prefs: PrefsData<T>)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.67` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 移除 `PrefsData.key` 的存储数据。
|
||||
|
||||
::: warning
|
||||
|
||||
在 (Xposed) 宿主环境下只读,无法使用。
|
||||
|
||||
:::
|
||||
|
||||
## clear <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun clear()
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.77` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 移除全部存储数据。
|
||||
|
||||
::: warning
|
||||
|
||||
在 (Xposed) 宿主环境下只读,无法使用。
|
||||
|
||||
:::
|
||||
|
||||
## putString <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun putString(key: String, value: String)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 存储 `String` 键值。
|
||||
|
||||
::: warning
|
||||
|
||||
在 (Xposed) 宿主环境下只读,无法使用。
|
||||
|
||||
:::
|
||||
|
||||
## putStringSet <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun putStringSet(key: String, value: Set<String>)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.77` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 存储 `Set<String>` 键值。
|
||||
|
||||
::: warning
|
||||
|
||||
在 (Xposed) 宿主环境下只读,无法使用。
|
||||
|
||||
:::
|
||||
|
||||
## putBoolean <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun putBoolean(key: String, value: Boolean)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 存储 `Boolean` 键值。
|
||||
|
||||
::: warning
|
||||
|
||||
在 (Xposed) 宿主环境下只读,无法使用。
|
||||
|
||||
:::
|
||||
|
||||
## putInt <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun putInt(key: String, value: Int)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 存储 `Int` 键值。
|
||||
|
||||
::: warning
|
||||
|
||||
在 (Xposed) 宿主环境下只读,无法使用。
|
||||
|
||||
:::
|
||||
|
||||
## putLong <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun putLong(key: String, value: Long)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 存储 `Long` 键值。
|
||||
|
||||
::: warning
|
||||
|
||||
在 (Xposed) 宿主环境下只读,无法使用。
|
||||
|
||||
:::
|
||||
|
||||
## putFloat <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun putFloat(key: String, value: Float)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 存储 `Float` 键值。
|
||||
|
||||
::: warning
|
||||
|
||||
在 (Xposed) 宿主环境下只读,无法使用。
|
||||
|
||||
:::
|
||||
|
||||
## get <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun <reified T> get(prefs: PrefsData<T>, value: T): T
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.67` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 智能获取指定类型的键值。
|
||||
|
||||
## put <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
inline fun <reified T> put(prefs: PrefsData<T>, value: T)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.67` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 智能存储指定类型的键值。
|
||||
|
||||
::: warning
|
||||
|
||||
在 (Xposed) 宿主环境下只读,无法使用。
|
||||
|
||||
:::
|
||||
|
||||
## clearCache <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun clearCache()
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.5` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 清除 `XSharedPreferences` 中缓存的键值数据。
|
||||
|
||||
无论是否开启 `YukiHookAPI.Configs.isEnableModulePrefsCache`。
|
||||
|
||||
调用此方法将清除当前存储的全部键值缓存。
|
||||
|
||||
下次将从 `XSharedPreferences` 重新读取。
|
||||
|
||||
在 (Xposed) 宿主环境中使用。
|
@@ -0,0 +1,71 @@
|
||||
---
|
||||
pageClass: code-page
|
||||
---
|
||||
|
||||
::: warning
|
||||
|
||||
The English translation of this page has not been completed, you are welcome to contribute translations to us.
|
||||
|
||||
You can use the **Chrome Translation Plugin** to translate entire pages for reference.
|
||||
|
||||
:::
|
||||
|
||||
# PrefsData <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
data class PrefsData<T>(var key: String, var value: T)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.67` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 键值对存储构造类。
|
||||
|
||||
这个类是对 `YukiHookModulePrefs` 的一个扩展用法。
|
||||
|
||||
**Function Example**
|
||||
|
||||
建立一个模板类定义模块与宿主需要使用的键值数据。
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
object DataConst {
|
||||
|
||||
val TEST_KV_DATA_1 = PrefsData("test_data_1", "defalut value")
|
||||
val TEST_KV_DATA_2 = PrefsData("test_data_2", false)
|
||||
val TEST_KV_DATA_3 = PrefsData("test_data_3", 0)
|
||||
}
|
||||
```
|
||||
|
||||
键值数据定义后,你就可以方便地在模块和宿主中调用所需要的数据。
|
||||
|
||||
> 模块示例如下
|
||||
|
||||
```kotlin
|
||||
// 读取
|
||||
val data = modulePrefs.get(DataConst.TEST_KV_DATA_1)
|
||||
// 写入
|
||||
modulePrefs.put(DataConst.TEST_KV_DATA_1, "written value")
|
||||
```
|
||||
|
||||
> 宿主示例如下
|
||||
|
||||
```kotlin
|
||||
// 读取 String
|
||||
val dataString = prefs.get(DataConst.TEST_KV_DATA_1)
|
||||
// 读取 Boolean
|
||||
val dataBoolean = prefs.get(DataConst.TEST_KV_DATA_2)
|
||||
```
|
||||
|
||||
你依然可以不使用模板定义的默认值,随时修改你的默认值。
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
// 读取 - 此时 data 取到的默认值将会是 2 - 并不是模板提供的 0
|
||||
val data = prefs.get(DataConst.TEST_KV_DATA_3, 2)
|
||||
```
|
@@ -0,0 +1,101 @@
|
||||
---
|
||||
pageClass: code-page
|
||||
---
|
||||
|
||||
::: warning
|
||||
|
||||
The English translation of this page has not been completed, you are welcome to contribute translations to us.
|
||||
|
||||
You can use the **Chrome Translation Plugin** to translate entire pages for reference.
|
||||
|
||||
:::
|
||||
|
||||
# ModulePreferenceFragment <span class="symbol">- class</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
abstract class ModulePreferenceFragment : PreferenceFragmentCompat(), SharedPreferences.OnSharedPreferenceChangeListener
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.78` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 这是对使用 `YukiHookAPI` Xposed 模块实现中的一个扩展功能。
|
||||
|
||||
此类接管了 `PreferenceFragmentCompat` 并对其实现了 Sp 存储在 Xposed 模块中的全局可读可写。
|
||||
|
||||
在你使用 `PreferenceFragmentCompat` 的实例中,将继承对象换成此类。
|
||||
|
||||
然后请将重写方法由 `onCreatePreferences` 替换为 `onCreatePreferencesInModuleApp` 即可。
|
||||
|
||||
**Function Example**
|
||||
|
||||
使用 `ModulePreferenceFragment` 创建一个 `PreferenceFragmentCompat` 对象。
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
class SettingsFragment : ModulePreferenceFragment() {
|
||||
|
||||
override fun onCreatePreferencesInModuleApp(savedInstanceState: Bundle?, rootKey: String?) {
|
||||
setPreferencesFromResource(R.xml.settings_preferences, rootKey)
|
||||
// Your code here.
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
其余用法与 `PreferenceFragmentCompat` 保持一致。
|
||||
|
||||
## onCreatePreferencesInModuleApp <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
abstract fun onCreatePreferencesInModuleApp(savedInstanceState: Bundle?, rootKey: String?)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.78` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 对接原始方法 `onCreatePreferences`。
|
||||
|
||||
## onSharedPreferenceChanged <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences?, key: String?)
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.78` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 实现了 `SharedPreferences.OnSharedPreferenceChangeListener` 的原生监听功能。
|
||||
|
||||
**Function Example**
|
||||
|
||||
::: warning
|
||||
|
||||
在使用 **onSharedPreferenceChanged** 时请保留 super 方法。
|
||||
|
||||
:::
|
||||
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
class SettingsFragment : ModulePreferenceFragment() {
|
||||
|
||||
override fun onCreatePreferencesInModuleApp(savedInstanceState: Bundle?, rootKey: String?) {
|
||||
// ...
|
||||
}
|
||||
|
||||
override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences?, key: String?) {
|
||||
super.onSharedPreferenceChanged(sharedPreferences, key)
|
||||
// Your code here.
|
||||
}
|
||||
}
|
||||
```
|
@@ -0,0 +1,109 @@
|
||||
---
|
||||
pageClass: code-page
|
||||
---
|
||||
|
||||
::: warning
|
||||
|
||||
The English translation of this page has not been completed, you are welcome to contribute translations to us.
|
||||
|
||||
You can use the **Chrome Translation Plugin** to translate entire pages for reference.
|
||||
|
||||
:::
|
||||
|
||||
# IYukiHookXposedInit <span class="symbol">- interface</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
interface IYukiHookXposedInit
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
`v1.0.80` `modified` `deprecated`
|
||||
|
||||
作废了 ~~`YukiHookXposedInitProxy`~~ 名称但保留接口
|
||||
|
||||
转移到 `IYukiHookXposedInit` 新名称
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> YukiHookAPI 的 Xposed 装载 API 调用接口。
|
||||
|
||||
## onInit <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun onInit()
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.5` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 配置 `YukiHookAPI.Configs` 的初始化方法。
|
||||
|
||||
::: danger
|
||||
|
||||
在这里只能进行初始化配置,不能进行 Hook 操作。
|
||||
|
||||
:::
|
||||
|
||||
此方法可选,你也可以选择不对 [YukiHookAPI.Configs](../../../YukiHookAPI#configs-object) 进行配置。
|
||||
|
||||
## onHook <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun onHook()
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> Xposed API 的模块装载调用入口方法。
|
||||
|
||||
## onXposedEvent <span class="symbol">- method</span>
|
||||
|
||||
```kotlin:no-line-numbers
|
||||
fun onXposedEvent()
|
||||
```
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0.80` `added`
|
||||
|
||||
**Function Illustrate**
|
||||
|
||||
> 监听 Xposed 原生装载事件。
|
||||
|
||||
若你的 Hook 事件中存在需要兼容的原生 Xposed 功能,可在这里实现。
|
||||
|
||||
请在这里使用 [YukiXposedEvent](../bridge/event/YukiXposedEvent) 创建回调事件监听。
|
||||
|
||||
可监听的事件如下:
|
||||
|
||||
`YukiXposedEvent.onInitZygote`
|
||||
|
||||
`YukiXposedEvent.onHandleLoadPackage`
|
||||
|
||||
`YukiXposedEvent.onHandleInitPackageResources`
|
||||
|
||||
::: danger
|
||||
|
||||
此接口仅供监听和实现原生 Xposed API 的功能,请不要在这里操作 **YukiHookAPI**。
|
||||
|
||||
:::
|
||||
|
||||
<h1 class="deprecated">YukiHookXposedInitProxy - interface</h1>
|
||||
|
||||
**Change Records**
|
||||
|
||||
`v1.0` `first`
|
||||
|
||||
`v1.0.80` `deprecated`
|
||||
|
||||
请转移到 `IYukiHookXposedInit`
|
Reference in New Issue
Block a user