mirror of
https://github.com/HighCapable/YukiHookAPI.git
synced 2025-09-10 12:34:09 +08:00
docs: update to new usage
This commit is contained in:
@@ -37,12 +37,11 @@ After the Host App is hooked, we can directly inject the `Context` obtained in t
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
injectMember {
|
||||
method {
|
||||
name = "onCreate"
|
||||
param(BundleClass)
|
||||
}
|
||||
afterHook {
|
||||
method {
|
||||
name = "onCreate"
|
||||
param(BundleClass)
|
||||
}.hook {
|
||||
after {
|
||||
instance<Activity>().also {
|
||||
// <Scenario 1> Inject Module App's Resources through Context
|
||||
it.injectModuleAppResources()
|
||||
@@ -91,12 +90,11 @@ After the Host App is hooked, we can directly register the `Activity` proxy of t
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
injectMember {
|
||||
method {
|
||||
name = "onCreate"
|
||||
param(BundleClass)
|
||||
}
|
||||
afterHook {
|
||||
method {
|
||||
name = "onCreate"
|
||||
param(BundleClass)
|
||||
}.hook {
|
||||
after {
|
||||
instance<Activity>().registerModuleAppActivities()
|
||||
}
|
||||
}
|
||||
@@ -238,12 +236,11 @@ At this time, we want to use `MaterialAlertDialogBuilder` to create a dialog in
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
injectMember {
|
||||
method {
|
||||
name = "onCreate"
|
||||
param(BundleClass)
|
||||
}
|
||||
afterHook {
|
||||
method {
|
||||
name = "onCreate"
|
||||
param(BundleClass)
|
||||
}.hook {
|
||||
after {
|
||||
// Use applyModuleTheme to create a theme resource in the current Module App
|
||||
val appCompatContext = instance<Activity>().applyModuleTheme(R.style.Theme_AppCompat)
|
||||
// Directly use this Context that wraps the Module App's theme to create a dialog
|
||||
@@ -263,12 +260,11 @@ Which requires at least Android 10 and above system version support and the curr
|
||||
> The following example
|
||||
|
||||
```kotlin
|
||||
injectMember {
|
||||
method {
|
||||
name = "onCreate"
|
||||
param(BundleClass)
|
||||
}
|
||||
afterHook {
|
||||
method {
|
||||
name = "onCreate"
|
||||
param(BundleClass)
|
||||
}.hook {
|
||||
after {
|
||||
// Define the theme resource in the current Module App
|
||||
var appCompatContext: ModuleContextThemeWrapper
|
||||
// <Scenario 1> Get the Configuration object directly to set
|
||||
|
Reference in New Issue
Block a user