style: lots of changes

- move demo-app, demo-module to samples
- rename yukihookapi to yukihookapi-core
- optimize code
- other small changes
This commit is contained in:
2023-09-21 03:19:13 +08:00
parent dd7912a577
commit 8ba166dab9
179 changed files with 919 additions and 682 deletions

3
samples/demo-module/.gitignore vendored Normal file
View File

@@ -0,0 +1,3 @@
/build
/src/main/assets/xposed_init
/src/main/resources/META-INF/yukihookapi_init

48
samples/demo-module/proguard-rules.pro vendored Normal file
View File

@@ -0,0 +1,48 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
-ignorewarnings
-optimizationpasses 10
-dontusemixedcaseclassnames
-dontoptimize
-verbose
-overloadaggressively
-allowaccessmodification
-adaptclassstrings
-adaptresourcefilenames
-adaptresourcefilecontents
-renamesourcefileattribute P
-keepattributes SourceFile,LineNumberTable
-keepclassmembers class androidx.appcompat.app.AlertDialog {
*** mAlert;
}
-keepclassmembers class androidx.appcompat.app.AlertController {
*** mButtonPositive;
*** mButtonNegative;
*** mButtonNeutral;
}

View File

@@ -0,0 +1,56 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.highcapable.yukihookapi.demo_module">
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<queries>
<intent>
<action android:name="android.intent.action.MAIN" />
</intent>
</queries>
<application
android:name=".application.DemoApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.Default">
<!-- 设置为 Xposed 模块 -->
<meta-data
android:name="xposedmodule"
android:value="true" />
<!-- 设置你的模块描述 -->
<meta-data
android:name="xposeddescription"
android:value="YukiHookAPI Xposed Module Test" />
<!-- 最低 Xposed 版本号 -->
<meta-data
android:name="xposedminversion"
android:value="93" />
<!-- LSPosed 作用域声明 -->
<meta-data
android:name="xposedscope"
android:resource="@array/module_scope" />
<activity
android:name=".ui.MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".ui.PreferenceActivity"
android:exported="false" />
</application>
</manifest>

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@@ -0,0 +1,39 @@
/*
* YukiHookAPI - An efficient Hook API and Xposed Module solution built in Kotlin.
* Copyright (C) 2019-2023 HighCapable
* https://github.com/fankes/YukiHookAPI
*
* MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* This file is Created by fankes on 2022/4/15.
*/
package com.highcapable.yukihookapi.demo_module.application
import com.highcapable.yukihookapi.hook.log.loggerD
import com.highcapable.yukihookapi.hook.xposed.application.ModuleApplication
class DemoApplication : ModuleApplication() {
override fun onCreate() {
super.onCreate()
loggerD(msg = "I am running in module space")
}
}

View File

@@ -0,0 +1,38 @@
/*
* YukiHookAPI - An efficient Hook API and Xposed Module solution built in Kotlin.
* Copyright (C) 2019-2023 HighCapable
* https://github.com/fankes/YukiHookAPI
*
* MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* This file is Created by fankes on 2022/3/27.
*/
package com.highcapable.yukihookapi.demo_module.data
import com.highcapable.yukihookapi.hook.xposed.channel.data.ChannelData
import com.highcapable.yukihookapi.hook.xposed.prefs.data.PrefsData
object DataConst {
val TEST_KV_DATA = PrefsData("test_data", "Test data is nothing")
val TEST_CN_DATA = ChannelData<String>("key_from_host")
}

View File

@@ -0,0 +1,473 @@
/*
* YukiHookAPI - An efficient Hook API and Xposed Module solution built in Kotlin.
* Copyright (C) 2019-2023 HighCapable
* https://github.com/fankes/YukiHookAPI
*
* MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* This file is Created by fankes on 2022/2/9.
*/
@file:Suppress("SetTextI18n")
package com.highcapable.yukihookapi.demo_module.hook
import android.app.Activity
import android.content.Intent
import android.os.Build
import android.widget.Button
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.highcapable.yukihookapi.YukiHookAPI
import com.highcapable.yukihookapi.annotation.xposed.InjectYukiHookWithXposed
import com.highcapable.yukihookapi.demo_module.R
import com.highcapable.yukihookapi.demo_module.data.DataConst
import com.highcapable.yukihookapi.demo_module.hook.factory.compatStyle
import com.highcapable.yukihookapi.demo_module.ui.MainActivity
import com.highcapable.yukihookapi.hook.factory.applyModuleTheme
import com.highcapable.yukihookapi.hook.factory.registerModuleAppActivities
import com.highcapable.yukihookapi.hook.type.android.ActivityClass
import com.highcapable.yukihookapi.hook.type.android.BundleClass
import com.highcapable.yukihookapi.hook.type.java.StringArrayClass
import com.highcapable.yukihookapi.hook.type.java.StringClass
import com.highcapable.yukihookapi.hook.type.java.UnitType
import com.highcapable.yukihookapi.hook.xposed.bridge.event.YukiXposedEvent
import com.highcapable.yukihookapi.hook.xposed.proxy.IYukiHookXposedInit
@InjectYukiHookWithXposed
object HookEntry : IYukiHookXposedInit {
override fun onInit() {
// Configure YuKiHookAPI
// Can be shortened to configs {}
// 配置 YuKiHookAPI
// 可简写为 configs {}
YukiHookAPI.configs {
// Configure YukiHookLogger
// 配置 YukiHookLogger
debugLog {
// TAG for global debugging
// Filter this TAG in the Logcat console to find detailed logs
// 全局调试用的 TAG
// 在 Logcat 控制台过滤此 TAG 可找到详细日志
tag = "YukiHookAPI-Demo"
// Whether to enable the output function of the debug log, enabled by default
// When closed, the API will stop output all logs, it is recommended not to disable this option arbitrarily
// Although it is incorrect to say that a lot of logs are written to the user's device, but NO LOG NO DEBUGGABLE
// Whether the log will affect the fluency of the device has always been a false proposition
// But if not has this option may cause some criticism, it is recommended not to close it
// 是否启用调试日志的输出功能 - 默认启用
// 一旦关闭后除手动日志外 API 将停止全部日志的输出 - 建议不要随意关掉这个选项
// 虽然说对用户的设备写入大量日志是不正确的 - 但是没有日志你将无法调试
// 关于日志是否会影响设备的流畅度一直是一个伪命题
// 但是不设置这个选项可能会引起一些非议 - 建议不要关闭就是了
isEnable = true
// Whether to enable the logging function of debug log, not enabled by default
// When enabled, all available logs and exception stacks will be recorded in memory
// Please note, excessive logging may slow down the Host App or cause frequent GCs
// After enabling, you can call [YukiHookLogger.saveToFile] to save the log to file in real-time
// Or use [YukiHookLogger.contents] to get the real-time log file contents
// 是否启用调试日志的记录功能 - 默认不启用
// 开启后将会在内存中记录全部可用的日志和异常堆栈
// 请注意 - 过量的日志可能会导致宿主运行缓慢或造成频繁 GC
// 开启后你可以调用 [YukiHookLogger.saveToFile] 实时保存日志到文件或使用 [YukiHookLogger.contents] 获取实时日志文件
isRecord = false
// Customize the elements displayed by the debug log externally
// Only valid for logging and [XposedBridge.log]
// The arrangement of log elements will be displayed in the order you set in [item]
// You can also leave [item] blank to not show all elements except the log content
// Available elements are: [TAG], [PRIORITY], [PACKAGE_NAME], [USER_ID]
// 自定义调试日志对外显示的元素
// 只对日志记录和 [XposedBridge.log] 生效
// 日志元素的排列将按照你在 [item] 中设置的顺序进行显示
// 你还可以留空 [item] 以不显示除日志内容外的全部元素
// 可用的元素有:[TAG]、[PRIORITY]、[PACKAGE_NAME]、[USER_ID]
elements(TAG, PRIORITY, PACKAGE_NAME, USER_ID)
}
// Whether to enable debug mode
// Please note, for a release build, be sure to turn off debugging to prevent a lot of log stuffing on the user's device
// 是否开启调试模式
// 请注意 - 若作为发布版本请务必关闭调试功能防止对用户设备造成大量日志填充
isDebug = true
// Whether to enable the current Xposed Module's own [Resources] cache function
// Under normal circumstances, the resources of the Module App will not change
// But in the case of locale changes, screen size changes. Etc. you need to refresh the cache
// If none of the above requirements, it is recommended to enable it before the Host App restarts
// You can manually call [PackageParam.refreshModuleAppResources] to refresh the cache
// 是否启用当前 Xposed 模块自身 [Resources] 缓存功能
// 一般情况下模块的 Resources 是不会改变的 - 但是在语言区域更改、分辨率更改等情况下 - 就需要刷新缓存
// 若无上述需求 - 在宿主重新启动之前建议开启
// 你可以手动调用 [PackageParam.refreshModuleAppResources] 来刷新缓存
isEnableModuleAppResourcesCache = true
// Whether to enable status functions such as Hook Xposed Module activation
// Enable state detection for natively supported Xposed Modules, this feature is enabled by default
// After closing you will no longer be able to use the functions in [YukiHookAPI.Status] in the Module environment
// When the feature is enabled, it will be automatically hooked [YukiHookModuleStatus] when the Host App starts up
// 是否启用 Hook Xposed 模块激活等状态功能
// 为原生支持 Xposed 模块激活状态检测 - 此功能默认启用
// 关闭后你将不能再在模块环境中使用 [YukiHookAPI.Status] 中的功能
// 功能启用后 - 将会在宿主启动时自动 Hook [YukiHookModuleStatus]
isEnableHookModuleStatus = true
// Whether to enable Hook [SharedPreferences]
// Enable will force [SharedPreferences] file permissions to be adjusted to [Context.MODE_WORLD_READABLE] (0664) at Module App startup
// This is an optional experimental feature, this feature is not enabled by default
// Only used to fix some systems that may still have file permission errors after enabling New XSharedPreferences
// If you can use [YukiHookPrefsBridge] normally, it is not recommended to enable this feature
// 是否启用 Hook [SharedPreferences]
// 启用后将在模块启动时强制将 [SharedPreferences] 文件权限调整为 [Context.MODE_WORLD_READABLE] (0664)
// 这是一个可选的实验性功能 - 此功能默认不启用
// 仅用于修复某些系统可能会出现在启用了 New XSharedPreferences 后依然出现文件权限错误问题 - 若你能正常使用 [YukiHookPrefsBridge] 就不建议启用此功能
isEnableHookSharedPreferences = false
// Whether to enable the [YukiHookDataChannel] function of the current Xposed Module interacting with the Host App
// Please make sure the Xposed Module's [Application] extends [ModuleApplication] to be valid
// This feature is enabled by default, when disabled it will not load [YukiHookDataChannel] when the feature is initialized
// When the feature is enabled, it will automatically register the Hook [Application] lifecycle method when the Host App starts
// 是否启用当前 Xposed 模块与宿主交互的 [YukiHookDataChannel] 功能
// 请确保 Xposed 模块的 [Application] 继承于 [ModuleApplication] 才能有效
// 此功能默认启用 - 关闭后将不会在功能初始化的时候装载 [YukiHookDataChannel]
// 功能启用后 - 将会在宿主启动时自动 Hook [Application] 的生命周期方法进行注册
isEnableDataChannel = true
}
}
override fun onHook() {
// Start your hook
// Can be shortened to encase {}
// 开始你的 Hook
// 可简写为 encase {}
YukiHookAPI.encase {
// Load App Zygote event
// 装载 APP Zygote 事件
loadZygote {
// Find Class to hook
// 得到需要 Hook 的 Class
ActivityClass.hook {
injectMember {
method {
name = "onCreate"
param(BundleClass)
}
afterHook {
// Add text after the [Activity] title
// 在 [Activity] 标题后方加入文字
instance<Activity>().apply { title = "$title [Active]" }
}
}
}
// Find Resources to hook
// Requires Hook Framework to support Resources Hook to succeed
// Resources Hook in Zygote only needs Hook Framework support, no need to enable this feature
// 得到需要 Hook 的 Resources
// 需要 Hook Framework 支持 Resources Hook(资源钩子) 才能成功
// 在 Zygote 中的 Resources Hook 只需要 Hook Framework 支持 - 无需启用此功能
resources().hook {
// Inject the Resources to be hooked
// 注入要 Hook 的 Resources
injectResource {
// Set the conditions
// 设置条件
conditions {
name = "sym_def_app_icon"
mipmap()
}
// Replace with the Resources of the current Module App
// Module App's Resources can be obfuscated with R8, results are not affected
// 替换为当前模块的 Resources
// 模块的 Resources 可以使用 R8 混淆 - 结果不受影响
replaceToModuleResource(R.mipmap.ic_icon)
}
}
}
// Load the app to be hooked
// 装载需要 Hook 的 APP
loadApp(name = "com.highcapable.yukihookapi.demo_app") {
// Register Activity Proxy
// 注册模块 Activity 代理
onAppLifecycle {
onCreate { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) registerModuleAppActivities() }
}
// Find Class to hook
// 得到需要 Hook 的 Class
findClass(name = "$packageName.ui.MainActivity").hook {
// Inject the method to be hooked
// 注入要 Hook 的方法
injectMember {
method {
name = "getFirstText"
emptyParam()
returnType = StringClass
}
// Replaced hook
// 执行替换 Hook
replaceTo(any = "Hello YukiHookAPI!")
}
// Inject the method to be hooked
// 注入要 Hook 的方法
injectMember {
method {
name = "onCreate"
param(BundleClass)
}
// Before hook the method
// 在方法执行之前拦截
beforeHook {
field {
name = "secondText"
type = StringClass
}.get(instance).set("I am hook result")
}
// After hook the method
// 在执行方法之后拦截
afterHook {
if (prefs.getBoolean("show_dialog_when_demo_app_opend"))
MaterialAlertDialogBuilder(instance<Activity>().applyModuleTheme(R.style.Theme_Default))
.setTitle("Hooked")
.setMessage(
"This App has been hooked!\n\n" +
"Hook Framework: ${YukiHookAPI.Status.Executor.name}\n\n" +
"Xposed API Version: ${YukiHookAPI.Status.Executor.apiLevel}\n\n" +
"Support Resources Hook: ${YukiHookAPI.Status.isSupportResourcesHook}"
)
.setPositiveButton("OK", null)
.show().compatStyle()
}
}
// Inject the method to be hooked
// 注入要 Hook 的方法
injectMember {
method {
name = "getRegularText"
param(StringClass)
returnType = StringClass
}
// Before hook the method
// 在方法执行之前拦截
beforeHook {
// Set the 0th param (recomment)
// 设置 0 号 param (推荐)
args().first().set("I am hook method param")
// The following method is also ok
// 下面这种方式也是可以的
// args[0] = "I am hook method param"
}
}
// Inject the method to be hooked
// 注入要 Hook 的方法
injectMember {
method {
name = "getArray"
param(StringArrayClass)
returnType = StringArrayClass
}
// Before hook the method
// 在方法执行之前拦截
beforeHook {
// Set the 0th param
// 设置 0 号 param
args().first().array<String>()[0] = "peach"
}
}
// Inject the method to be hooked
// 注入要 Hook 的方法
injectMember {
method {
name = "toast"
emptyParam()
returnType = UnitType
}
// Intercept the entire method
// 拦截整个方法
replaceUnit {
instance<Activity>().applyModuleTheme(R.style.Theme_Default).also { context ->
MaterialAlertDialogBuilder(context)
.setTitle("Hooked")
.setMessage("I am hook your toast showing!")
.apply {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
setPositiveButton("START PARASITIC") { _, _ ->
MaterialAlertDialogBuilder(context)
.setTitle("Start Parasitic")
.setMessage("This function will start MainActivity that exists in the module app.")
.setPositiveButton("YES") { _, _ ->
context.startActivity(Intent(context, MainActivity::class.java))
}.setNegativeButton("NO", null).show().compatStyle()
}
}.setNegativeButton("SEND MSG TO MODULE") { _, _ ->
dataChannel.put(DataConst.TEST_CN_DATA, value = "I am host, can you hear me?")
}.setNeutralButton("REMOVE HOOK") { _, _ ->
removeSelf()
}.show().compatStyle()
}
}
}
// Inject the method to be hooked
// 注入要 Hook 的方法
injectMember {
method {
name = "getDataText"
emptyParam()
returnType = StringClass
}
// Replaced hook
// 执行替换 Hook
replaceTo(prefs.get(DataConst.TEST_KV_DATA))
}
}
// Find Class to hook
// 得到需要 Hook 的 Class
findClass(name = "$packageName.test.Main").hook {
// Inject the method to be hooked
// 注入要 Hook 的方法
injectMember {
constructor { param(StringClass) }
// Before hook the method
// 在方法执行之前拦截
beforeHook {
// Set the 0th param
// 设置 0 号 param
args().first().set("I am hook constructor param")
}
}
// Inject the method to be hooked
// 注入要 Hook 的方法
injectMember {
method {
name = "getSuperString"
emptyParam()
// This method is not in the current Class
// Just set this find condition to automatically go to the super class of the current Class to find
// Since the method shown will only exist in the super class
// So you can set only the super class to find isOnlySuperClass = true to save time
// If you want to keep trying to find the current Class, please remove isOnlySuperClass = true
// 这个方法不在当前的 Class
// 只需要设置此查找条件即可自动前往当前 Class 的父类查找
// 由于演示的方法只会在父类存在 - 所以可以设置仅查找父类 isOnlySuperClass = true 节省时间
// 如果想继续尝试查找当前 Class - 请删除 isOnlySuperClass = true
superClass(isOnlySuperClass = true)
}
// Replaced hook
// 执行替换 Hook
replaceTo(any = "I am hook super class method")
}
// Inject the method to be hooked
// 注入要 Hook 的方法
injectMember {
method { name = "getTestResultFirst" }.all()
// Replaced hook
// 执行替换 Hook
replaceTo(any = "I am hook all methods first")
}
// Inject the method to be hooked
// 注入要 Hook 的方法
injectMember {
method { name = "getTestResultLast" }.all()
// Replaced hook
// 执行替换 Hook
replaceTo(any = "I am hook all methods last")
}
}
// Find Resources to hook
// Requires Hook Framework to support Resources Hook to succeed
// Resources Hook in Zygote only needs Hook Framework support, no need to enable this feature
// 得到需要 Hook 的 Resources
// 需要 Hook Framework 支持 Resources Hook(资源钩子) 且启用此功能才能成功
resources().hook {
// Inject the Resources to be hooked
// 注入要 Hook 的 Resources
injectResource {
// Set the conditions
// 设置条件
conditions {
name = "activity_main"
layout()
}
// Hook layout inflater
// Hook 布局装载器
injectAsLayout {
// Replace the button text with the specified Id in this layout
// 替换布局中指定 Id 的按钮文本
findViewByIdentifier<Button>(name = "app_demo_button")?.text = "Touch Me!"
}
}
// Inject the Resources to be hooked
// 注入要 Hook 的 Resources
injectResource {
// Set the conditions
// 设置条件
conditions {
name = "test_string"
string()
}
// Replace with the specified Resources
// 替换为指定的 Resources
replaceTo(any = "I am hook to make your Happy")
}
// Inject the Resources to be hooked
// 注入要 Hook 的 Resources
injectResource {
// Set the conditions
// 设置条件
conditions {
name = "ic_face_unhappy"
mipmap()
}
// Replace with the Resources of the current Module App
// Module App's Resources can be obfuscated with R8, results are not affected
// 替换为当前模块的 Resources
// 模块的 Resources 可以使用 R8 混淆 - 结果不受影响
replaceToModuleResource(R.mipmap.ic_face_happy)
}
}
}
}
}
// Optional listener function, you can not override this method if you don't need it
// This method is implemented in Demo only to introduce its function
// 可选的监听功能 - 如不需要你可以不重写这个方法
// Demo 中实现这个方法仅为了介绍它的功能
override fun onXposedEvent() {
// (Optional) Listen to the loading event of the native Xposed API
// If your Hook event has native Xposed functionality that needs to be compatible, it can be implemented here
// Don't handle any YukiHookAPI events here, do it in onHook
// (可选) 监听原生 Xposed API 的装载事件
// 若你的 Hook 事件中存在需要兼容的原生 Xposed 功能 - 可在这里实现
// 不要在这里处理任何 YukiHookAPI 的事件 - 请在 onHook 中完成
YukiXposedEvent.events {
onInitZygote {
// Implement listening for the initZygote event
// 实现监听 initZygote 事件
}
onHandleLoadPackage {
// Implement listener handleLoadPackage event
// Call native Xposed API methods
// 实现监听 handleLoadPackage 事件
// 可调用原生 Xposed API 方法
// XposedHelpers.findAndHookMethod("className", it.classLoader, "methodName", object : XC_MethodHook())
}
onHandleInitPackageResources {
// Implement the listener handleInitPackageResources event
// Call native Xposed API methods
// 实现监听 handleInitPackageResources 事件
// 可调用原生 Xposed API 方法
// it.res.setReplacement(0x7f060001, "replaceMent")
}
}
}
}

View File

@@ -0,0 +1,62 @@
/*
* YukiHookAPI - An efficient Hook API and Xposed Module solution built in Kotlin.
* Copyright (C) 2019-2023 HighCapable
* https://github.com/fankes/YukiHookAPI
*
* MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* This file is Created by fankes on 2022/8/16.
*/
package com.highcapable.yukihookapi.demo_module.hook.factory
import android.graphics.drawable.Drawable
import android.util.TypedValue
import android.widget.Button
import androidx.appcompat.app.AlertDialog
import com.highcapable.yukihookapi.hook.factory.current
/**
* Fixed [AlertDialog] dialog button issue after injecting Module App's Resources in some Host Apps
*
* Reset button text color and background by reflection [Drawable]
*
* 修复 [AlertDialog] 对话框按钮在一些宿主中注入模块资源后会发生问题
*
* 通过反射重新设置按钮的文字颜色和背景 [Drawable]
* @return [AlertDialog]
*/
fun AlertDialog.compatStyle(): AlertDialog {
current().field { name = "mAlert" }.current {
arrayOf(
field { name = "mButtonPositive" }.cast<Button>(),
field { name = "mButtonNegative" }.cast<Button>(),
field { name = "mButtonNeutral" }.cast<Button>()
).forEach {
it?.setBackgroundResource(TypedValue().apply {
context.theme.resolveAttribute(android.R.attr.selectableItemBackground, this, true)
}.resourceId)
it?.setTextColor(TypedValue().apply {
context.theme.resolveAttribute(android.R.attr.colorPrimary, this, true)
}.data)
}
}
return this
}

View File

@@ -0,0 +1,127 @@
/*
* YukiHookAPI - An efficient Kotlin version of the Xposed Hook API.
* Copyright (C) 2019-2022 HighCapable
* https://github.com/fankes/YukiHookAPI
*
* MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* This file is Created by fankes on 2022/5/25.
*/
package com.highcapable.yukihookapi.demo_module.hook.java;
import android.app.Activity;
import android.os.Bundle;
import com.highcapable.yukihookapi.YukiHookAPI;
import com.highcapable.yukihookapi.hook.log.YukiHookLogger;
import com.highcapable.yukihookapi.hook.xposed.bridge.event.YukiXposedEvent;
import com.highcapable.yukihookapi.hook.xposed.proxy.IYukiHookXposedInit;
import kotlin.Unit;
// ========
// This only demonstrates how to use it in the Java case (Java 1.8+ only)
// The code here is for demonstration only does not mean that it will work in the future Demo will only sync the latest Kotlin usage
// It is recommended to use Kotlin to complete the writing of the Hook part
// Please remove the code note "//" below to use this demo, but make sure to comment out the HookEntry annotation on the Kotlin side
// 这里仅演示了 Java 情况下的使用方式 (仅限 Java 1.8+)
// 这里的代码仅供演示 - 并不代表今后都可以正常运行 - Demo 只会同步最新的 Kotlin 使用方法
// 建议还是使用 Kotlin 来完成 Hook 部分的编写
// 请删除下方的注释 "//" 以使用此 Demo - 但要确保注释掉 Kotlin 一边的 HookEntry 的注解
// ========
// @InjectYukiHookWithXposed
public class HookEntry implements IYukiHookXposedInit {
@Override
public void onInit() {
YukiHookAPI.Configs config = YukiHookAPI.Configs.INSTANCE;
YukiHookLogger.Configs.INSTANCE.setTag("YukiHookAPI-Demo");
YukiHookLogger.Configs.INSTANCE.setEnable(true);
YukiHookLogger.Configs.INSTANCE.setRecord(false);
YukiHookLogger.Configs.INSTANCE.elements(
YukiHookLogger.Configs.TAG,
YukiHookLogger.Configs.PRIORITY,
YukiHookLogger.Configs.PACKAGE_NAME,
YukiHookLogger.Configs.USER_ID
);
config.setDebug(true);
config.setEnableModuleAppResourcesCache(true);
config.setEnableHookModuleStatus(true);
config.setEnableDataChannel(true);
}
@Override
public void onHook() {
// Here is the Java writing method that is more similar to the Kotlin writing method, just for reference
// Calling Kotlin's lambda in Java also needs to return Unit.INSTANCE in the Unit case
// 这里介绍了比较近似于 Kotlin 写法的 Java 写法 - 仅供参考
// 在 Java 中调用 Kotlin 的 lambda 在 Unit 情况下也需要 return Unit.INSTANCE
YukiHookAPI.INSTANCE.encase(e -> {
e.loadZygote(l -> {
l.hook(Activity.class, false, h -> {
h.injectMember(h.getPRIORITY_DEFAULT(), "Default", i -> {
i.method(m -> {
m.setName("onCreate");
m.param(Bundle.class);
return null;
});
i.afterHook(a -> {
Activity instance = ((Activity) a.getInstance());
instance.setTitle(instance.getTitle() + " [Active]");
return Unit.INSTANCE;
});
return Unit.INSTANCE;
});
return Unit.INSTANCE;
});
return Unit.INSTANCE;
});
// The rest of the code has been omitted, you can continue to refer to the above method to complete
// 余下部分代码已略 - 可继续参考上述方式完成
// ...
return Unit.INSTANCE;
});
}
@Override
public void onXposedEvent() {
// Since Java does not support some methods that do not override Kotlin Interface
// So this method is not needed here, you can leave the content blank
// 由于 Java 不支持不重写 Kotlin Interface 的部分方法
// 所以不需要此方法这里可以不填写内容
YukiXposedEvent event = YukiXposedEvent.INSTANCE;
event.onInitZygote(startupParam -> {
// Write the startupParam method here
// 这里编写 startupParam 方法
return Unit.INSTANCE;
});
event.onHandleLoadPackage(loadPackageParam -> {
// Write the loadPackageParam method here
// 这里编写 loadPackageParam 方法
return Unit.INSTANCE;
});
event.onHandleInitPackageResources(resourcesParam -> {
// Write the resourcesParam method here
// 这里编写 resourcesParam 方法
return Unit.INSTANCE;
});
}
}

View File

@@ -0,0 +1,114 @@
/*
* YukiHookAPI - An efficient Hook API and Xposed Module solution built in Kotlin.
* Copyright (C) 2019-2023 HighCapable
* https://github.com/fankes/YukiHookAPI
*
* MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* This file is Created by fankes on 2022/1/29.
*/
@file:Suppress("SetTextI18n")
package com.highcapable.yukihookapi.demo_module.ui
import android.content.Intent
import android.os.Bundle
import android.widget.Toast
import com.highcapable.yukihookapi.YukiHookAPI
import com.highcapable.yukihookapi.demo_module.R
import com.highcapable.yukihookapi.demo_module.data.DataConst
import com.highcapable.yukihookapi.demo_module.databinding.ActivityMainBinding
import com.highcapable.yukihookapi.hook.factory.dataChannel
import com.highcapable.yukihookapi.hook.factory.prefs
import com.highcapable.yukihookapi.hook.xposed.parasitic.activity.base.ModuleAppCompatActivity
import java.text.SimpleDateFormat
import java.util.Date
class MainActivity : ModuleAppCompatActivity() {
override val moduleTheme get() = R.style.Theme_Default
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
ActivityMainBinding.inflate(layoutInflater).apply {
setContentView(root)
moduleEnvironment {
dataChannel(packageName = "com.highcapable.yukihookapi.demo_app").with {
wait(DataConst.TEST_CN_DATA) {
Toast.makeText(applicationContext, it, Toast.LENGTH_SHORT).show()
}
}
}
moduleDemoActiveText.text = "Module is Active${YukiHookAPI.Status.isModuleActive}"
moduleDemoActiveZhText.text = "Xposed 模块激活状态"
moduleDemoFrameworkText.text = "Hook Framework${YukiHookAPI.Status.Executor.name}"
moduleDemoFrameworkZhText.text = "当前的 Hook 框架"
moduleDemoApiVersionText.text = "Xposed API Version${YukiHookAPI.Status.Executor.apiLevel}"
moduleDemoApiVersionZhText.text = "Xposed API 版本"
moduleDemoYukiHookApiVersionText.text = "YukiHookAPI Version${YukiHookAPI.API_VERSION_NAME}(${YukiHookAPI.API_VERSION_CODE})"
moduleDemoYukiHookApiVersionZhText.text = "YukiHookAPI 版本"
moduleDemoNewXshareText.text =
"${if (YukiHookAPI.Status.isXposedEnvironment) "XSharedPreferences Readable" else "New XSharedPreferences"}${prefs().isPreferencesAvailable}"
moduleDemoNewXshareZhText.text =
if (YukiHookAPI.Status.isXposedEnvironment) "XSharedPreferences 是否可用" else "New XSharedPreferences 支持状态"
moduleDemoResHookText.text = "Support Resources Hook${YukiHookAPI.Status.isSupportResourcesHook}"
moduleDemoResHookZhText.text = "资源钩子支持状态"
moduleDemoComTimeStampText.text =
"Compiled Time${SimpleDateFormat.getDateTimeInstance().format(Date(YukiHookAPI.Status.compiledTimestamp))}"
moduleDemoEditText.also {
hostEnvironment {
it.isEnabled = false
moduleDemoButton.isEnabled = false
}
it.setText(prefs().get(DataConst.TEST_KV_DATA))
moduleDemoButton.setOnClickListener { _ ->
moduleEnvironment {
if (it.text.toString().isNotEmpty()) {
prefs().edit { put(DataConst.TEST_KV_DATA, it.text.toString()) }
Toast.makeText(applicationContext, "Saved", Toast.LENGTH_SHORT).show()
} else Toast.makeText(applicationContext, "Please enter the text", Toast.LENGTH_SHORT).show()
}
}
}
moduleDemoFrgButton.setOnClickListener { startActivity(Intent(this@MainActivity, PreferenceActivity::class.java)) }
}
}
/**
* Running only in (Xposed) Host environment
*
* 仅在 (Xposed) 宿主环境执行
* @param callback Running in the (Xposed) Host environment / 在宿主环境执行
*/
private inline fun hostEnvironment(callback: () -> Unit) {
if (YukiHookAPI.Status.isXposedEnvironment) callback()
}
/**
* Running only in Module environment
*
* 仅在模块环境执行
* @param callback Running in the Module environment / 在模块环境执行
*/
private inline fun moduleEnvironment(callback: () -> Unit) {
if (YukiHookAPI.Status.isXposedEnvironment.not()) callback()
}
}

View File

@@ -0,0 +1,64 @@
/*
* YukiHookAPI - An efficient Hook API and Xposed Module solution built in Kotlin.
* Copyright (C) 2019-2023 HighCapable
* https://github.com/fankes/YukiHookAPI
*
* MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* This file is Created by fankes on 2022/4/18.
*/
package com.highcapable.yukihookapi.demo_module.ui
import android.os.Bundle
import androidx.preference.SwitchPreference
import com.highcapable.yukihookapi.YukiHookAPI
import com.highcapable.yukihookapi.demo_module.R
import com.highcapable.yukihookapi.hook.xposed.parasitic.activity.base.ModuleAppCompatActivity
import com.highcapable.yukihookapi.hook.xposed.prefs.ui.ModulePreferenceFragment
class PreferenceActivity : ModuleAppCompatActivity() {
override val moduleTheme get() = R.style.Theme_Default
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
title = "PreferenceFragment"
supportActionBar?.setDisplayHomeAsUpEnabled(true)
if (savedInstanceState == null)
supportFragmentManager
.beginTransaction()
.replace(android.R.id.content, SettingsFragment())
.commitAllowingStateLoss()
}
override fun onSupportNavigateUp(): Boolean {
onBackPressedDispatcher.onBackPressed()
return true
}
class SettingsFragment : ModulePreferenceFragment() {
override fun onCreatePreferencesInModuleApp(savedInstanceState: Bundle?, rootKey: String?) {
setPreferencesFromResource(R.xml.settings_preferences, rootKey)
findPreference<SwitchPreference>("show_dialog_when_demo_app_opend")?.isEnabled = YukiHookAPI.Status.isXposedEnvironment.not()
}
}
}

View File

@@ -0,0 +1,28 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<group
android:scaleX="0.0030033707"
android:scaleY="0.0030033707"
android:translateX="23.132023"
android:translateY="21.185392">
<path
android:fillColor="#FFDABC"
android:pathData="m11443,12167c24,43 4,-38 25,72l8,695h856c0,-918 4,-1837 6,-2755 1,-435 60,-2522 -12,-2773h-846c-54,208 -15,1255 -14,1549 1,529 3,1057 4,1586 4,2028 -1973,2072 -2539,1286 -287,-398 -323,-668 -321,-1258 2,-454 60,-2931 -12,-3163l-846,0c-41,170 -11,2199 -10,2550 2,833 -73,1594 304,2256 514,901 1772,1112 2698,578 142,-82 259,-166 369,-269 53,-50 116,-114 161,-173 111,-143 43,-125 169,-181z"
android:strokeWidth="0.843583" />
<path
android:fillColor="#D38055"
android:pathData="m14543,10345 l213,1395 -2232,236 50,540c8,3 19,-2 23,7 4,8 17,5 22,6 34,5 24,7 68,7l2163,-234 262,1740 -2688,299c-22,137 34,400 48,546l2729,-297 312,2039 580,-66 -289,-2042 2626,-288 -47,-520c-87,-33 -203,-5 -310,7l-1004,110c-308,34 -1078,157 -1340,132l-266,-1732 2245,-239 -63,-555 -2250,231c-139,-305 -104,-1178 -251,-1413l-531,63c-75,22 -35,8 -70,29z"
android:strokeWidth="0.843583" />
<path
android:fillColor="#FFE6D1"
android:pathData="m4801,9789c75,105 48,257 48,399h821c-10,-103 -18,-224 40,-304 1,-142 537,-994 644,-1176l2019,-3481 -993,-15c-98,23 -239,355 -292,447 -314,546 -1731,3182 -1823,3262 -104,-48 -452,-754 -536,-906L3698,6154c-89,-156 -163,-310 -257,-467 -65,-110 -220,-371 -247,-475l-1055,0z"
android:strokeWidth="0.843583" />
<path
android:fillColor="#FFDABC"
android:pathData="m5710,9884c-59,79 -51,201 -40,304h-821c0,-142 27,-294 -48,-399l6,3133 899,12z"
android:strokeWidth="0.843583" />
</group>
</vector>

View File

@@ -0,0 +1,213 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:scrollbars="none"
tools:ignore="HardcodedText">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="20dp"
android:layout_marginBottom="20dp"
android:gravity="center"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:layout_marginBottom="15dp"
android:gravity="center|start"
android:orientation="vertical">
<TextView
android:id="@+id/module_demo_active_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:ellipsize="end"
android:gravity="center|start"
android:singleLine="true"
android:text="sample"
android:textSize="18sp" />
<TextView
android:id="@+id/module_demo_active_zh_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:alpha="0.85"
android:ellipsize="end"
android:gravity="center|start"
android:singleLine="true"
android:text="sample"
android:textSize="15sp" />
<TextView
android:id="@+id/module_demo_framework_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:ellipsize="end"
android:gravity="center|start"
android:singleLine="true"
android:text="sample"
android:textSize="18sp" />
<TextView
android:id="@+id/module_demo_framework_zh_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:alpha="0.85"
android:ellipsize="end"
android:gravity="center|start"
android:singleLine="true"
android:text="sample"
android:textSize="15sp" />
<TextView
android:id="@+id/module_demo_api_version_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:ellipsize="end"
android:gravity="center|start"
android:singleLine="true"
android:text="sample"
android:textSize="18sp" />
<TextView
android:id="@+id/module_demo_api_version_zh_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:alpha="0.85"
android:ellipsize="end"
android:gravity="center|start"
android:singleLine="true"
android:text="sample"
android:textSize="15sp" />
<TextView
android:id="@+id/module_demo_yuki_hook_api_version_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:ellipsize="end"
android:gravity="center|start"
android:singleLine="true"
android:text="sample"
android:textSize="18sp" />
<TextView
android:id="@+id/module_demo_yuki_hook_api_version_zh_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:alpha="0.85"
android:ellipsize="end"
android:gravity="center|start"
android:singleLine="true"
android:text="sample"
android:textSize="15sp" />
<TextView
android:id="@+id/module_demo_new_xshare_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:ellipsize="end"
android:gravity="center|start"
android:singleLine="true"
android:text="sample"
android:textSize="18sp" />
<TextView
android:id="@+id/module_demo_new_xshare_zh_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:alpha="0.85"
android:ellipsize="end"
android:gravity="center|start"
android:singleLine="true"
android:text="sample"
android:textSize="15sp" />
<TextView
android:id="@+id/module_demo_res_hook_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:ellipsize="end"
android:gravity="center|start"
android:singleLine="true"
android:text="sample"
android:textSize="18sp" />
<TextView
android:id="@+id/module_demo_res_hook_zh_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="25dp"
android:alpha="0.85"
android:ellipsize="end"
android:gravity="center|start"
android:singleLine="true"
android:text="sample"
android:textSize="15sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:layout_marginBottom="15dp"
android:ellipsize="end"
android:gravity="center|start"
android:singleLine="true"
android:text="Leave something in there"
android:textSize="15sp" />
<EditText
android:id="@+id/module_demo_edit_text"
android:layout_width="250dp"
android:layout_height="wrap_content"
android:hint="Please enter the text"
android:singleLine="true"
android:textSize="18sp"
tools:ignore="Autofill,LabelFor,TextFields" />
</LinearLayout>
<Button
android:id="@+id/module_demo_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:text="Save Test Data"
android:textAllCaps="false" />
<Button
android:id="@+id/module_demo_frg_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Open PreferenceFragment"
android:textAllCaps="false" />
<TextView
android:id="@+id/module_demo_com_time_stamp_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="25dp"
android:alpha="0.45"
android:ellipsize="end"
android:gravity="center|start"
android:singleLine="true"
android:text="placeholder"
android:textSize="13sp" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View File

@@ -0,0 +1,19 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.Default" parent="Theme.Material3.DayNight">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/yuki_theme_color</item>
<item name="colorPrimaryVariant">@color/yuki_theme_color</item>
<item name="colorOnPrimary">@color/white</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/yuki_accent_color</item>
<item name="colorSecondaryVariant">@color/yuki_accent_color</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor">@color/yuki_dark_color</item>
<item name="android:navigationBarColor">@android:color/background_dark</item>
<item name="android:windowLightStatusBar" tools:targetApi="m">false</item>
<!-- Customize your theme here. -->
<item name="android:windowSplashScreenAnimatedIcon" tools:targetApi="s">@mipmap/ic_launcher</item>
</style>
</resources>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="module_scope">
<item>com.highcapable.yukihookapi.demo_app</item>
</string-array>
</resources>

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="yuki_theme_color">#FFEBAD70</color>
<color name="yuki_accent_color">#FF777777</color>
<color name="yuki_light_color">#FFFDF5F3</color>
<color name="yuki_dark_color">#FF2D2726</color>
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
</resources>

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#F4B278</color>
</resources>

View File

@@ -0,0 +1,3 @@
<resources>
<string name="app_name">YukiHookDemoModule</string>
</resources>

View File

@@ -0,0 +1,19 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.Default" parent="Theme.Material3.DayNight">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/yuki_theme_color</item>
<item name="colorPrimaryVariant">@color/yuki_theme_color</item>
<item name="colorOnPrimary">@color/white</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/yuki_accent_color</item>
<item name="colorSecondaryVariant">@color/yuki_accent_color</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor">@color/yuki_light_color</item>
<item name="android:navigationBarColor">@android:color/background_light</item>
<item name="android:windowLightStatusBar" tools:targetApi="m">true</item>
<!-- Customize your theme here. -->
<item name="android:windowSplashScreenAnimatedIcon" tools:targetApi="s">@mipmap/ic_launcher</item>
</style>
</resources>

View File

@@ -0,0 +1,10 @@
<PreferenceScreen xmlns:app="http://schemas.android.com/apk/res-auto">
<PreferenceCategory app:title="Normal Preference">
<SwitchPreference
app:defaultValue="false"
app:key="show_dialog_when_demo_app_opend"
app:summary="Open a dialog on start Demo App"
app:title="Show Dialog" />
</PreferenceCategory>
</PreferenceScreen>