Update hook demo

This commit is contained in:
2022-05-01 09:51:06 +08:00
parent f1d957fac6
commit b48ad4a850
10 changed files with 467 additions and 181 deletions

View File

@@ -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() }
}
}

View File

@@ -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"

View File

@@ -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
}