From b48ad4a850588f552a83d38a851559bbea5d3d79 Mon Sep 17 00:00:00 2001 From: Fankesyooni Date: Sun, 1 May 2022 09:51:06 +0800 Subject: [PATCH] Update hook demo --- .../yukihookapi/demo_app/ui/MainActivity.kt | 3 +- .../yukihookapi/demo_app/utils/Main.kt | 4 +- .../yukihookapi/demo_app/utils/SuperMain.kt | 35 +++ .../src/main/res/layout/activity_main.xml | 198 ++++++++----- .../res/mipmap-xxhdpi/ic_face_unhappy.png | Bin 0 -> 11124 bytes demo-app/src/main/res/values/strings.xml | 1 + .../yukihookapi/demo_module/hook/HookEntry.kt | 119 +++++++- .../demo_module/ui/MainActivity.kt | 10 +- .../src/main/res/layout/activity_main.xml | 278 ++++++++++++------ .../main/res/mipmap-xxhdpi/ic_face_happy.png | Bin 0 -> 4650 bytes 10 files changed, 467 insertions(+), 181 deletions(-) create mode 100644 demo-app/src/main/java/com/highcapable/yukihookapi/demo_app/utils/SuperMain.kt create mode 100644 demo-app/src/main/res/mipmap-xxhdpi/ic_face_unhappy.png create mode 100644 demo-module/src/main/res/mipmap-xxhdpi/ic_face_happy.png diff --git a/demo-app/src/main/java/com/highcapable/yukihookapi/demo_app/ui/MainActivity.kt b/demo-app/src/main/java/com/highcapable/yukihookapi/demo_app/ui/MainActivity.kt index 9e826730..acbf85ad 100644 --- a/demo-app/src/main/java/com/highcapable/yukihookapi/demo_app/ui/MainActivity.kt +++ b/demo-app/src/main/java/com/highcapable/yukihookapi/demo_app/ui/MainActivity.kt @@ -43,7 +43,7 @@ class MainActivity : AppCompatActivity() { setContentView(root) appDemoFirstText.text = getFirstText() appDemoSecondText.text = secondText - appDemoThirdText.text = Main(string = "Feel real").getString() + appDemoThirdText.text = Main(content = "Feel real").getString() appDemoFourthText.text = getRegularText(string = "Have fun day") appDemoFifthText.text = getDataText() appDemoSixthText.text = getArray(arrayOf("apple", "banana")).let { "${it[0]}, ${it[1]}" } @@ -51,6 +51,7 @@ class MainActivity : AppCompatActivity() { appDemoEighthText.text = Main().getTestResultFirst(string = "Find something interesting") appDemoNinthText.text = Main().getTestResultLast() appDemoTenthText.text = Main().getTestResultLast(string = "This is the last sentence") + appDemoEleventhText.text = Main().getSuperString() appDemoButton.setOnClickListener { toast() } } } diff --git a/demo-app/src/main/java/com/highcapable/yukihookapi/demo_app/utils/Main.kt b/demo-app/src/main/java/com/highcapable/yukihookapi/demo_app/utils/Main.kt index 056429b3..6ded2555 100644 --- a/demo-app/src/main/java/com/highcapable/yukihookapi/demo_app/utils/Main.kt +++ b/demo-app/src/main/java/com/highcapable/yukihookapi/demo_app/utils/Main.kt @@ -27,9 +27,7 @@ */ package com.highcapable.yukihookapi.demo_app.utils -class Main(private val string: String = "") { - - fun getString() = string +class Main(override val content: String = "") : SuperMain(content) { fun getTestResultFirst() = "The world is beautiful" diff --git a/demo-app/src/main/java/com/highcapable/yukihookapi/demo_app/utils/SuperMain.kt b/demo-app/src/main/java/com/highcapable/yukihookapi/demo_app/utils/SuperMain.kt new file mode 100644 index 00000000..00177374 --- /dev/null +++ b/demo-app/src/main/java/com/highcapable/yukihookapi/demo_app/utils/SuperMain.kt @@ -0,0 +1,35 @@ +/* + * 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/4/29. + */ +package com.highcapable.yukihookapi.demo_app.utils + +open class SuperMain(open val content: String = "") { + + fun getSuperString() = "The sea is blue" + + fun getString() = content +} \ No newline at end of file diff --git a/demo-app/src/main/res/layout/activity_main.xml b/demo-app/src/main/res/layout/activity_main.xml index 397b916e..a8ca5610 100644 --- a/demo-app/src/main/res/layout/activity_main.xml +++ b/demo-app/src/main/res/layout/activity_main.xml @@ -1,96 +1,132 @@ - + android:fillViewport="true" + android:scrollbars="none" + tools:ignore="HardcodedText,ContentDescription"> - + - + - + - + - + - + - + - + - + - + -