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
}

View File

@@ -1,96 +1,132 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<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:gravity="center"
android:orientation="vertical"
tools:ignore="HardcodedText">
android:fillViewport="true"
android:scrollbars="none"
tools:ignore="HardcodedText,ContentDescription">
<TextView
android:id="@+id/app_demo_first_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:text="sample"
android:textSize="18sp" />
<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">
<TextView
android:id="@+id/app_demo_second_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:text="sample"
android:textSize="18sp" />
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginBottom="15dp"
android:src="@mipmap/ic_face_unhappy" />
<TextView
android:id="@+id/app_demo_third_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:text="sample"
android:textSize="18sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="25dp"
android:text="@string/test_string"
android:textSize="17.5sp" />
<TextView
android:id="@+id/app_demo_fourth_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:text="sample"
android:textSize="18sp" />
<TextView
android:id="@+id/app_demo_first_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:text="sample"
android:textSize="17.5sp" />
<TextView
android:id="@+id/app_demo_seventh_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:text="sample"
android:textSize="18sp" />
<TextView
android:id="@+id/app_demo_second_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:text="sample"
android:textSize="17.5sp" />
<TextView
android:id="@+id/app_demo_eighth_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:text="sample"
android:textSize="18sp" />
<TextView
android:id="@+id/app_demo_eleventh_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:text="sample"
android:textSize="17.5sp" />
<TextView
android:id="@+id/app_demo_ninth_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:text="sample"
android:textSize="18sp" />
<TextView
android:id="@+id/app_demo_third_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:text="sample"
android:textSize="17.5sp" />
<TextView
android:id="@+id/app_demo_tenth_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:text="sample"
android:textSize="18sp" />
<TextView
android:id="@+id/app_demo_fourth_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:text="sample"
android:textSize="17.5sp" />
<TextView
android:id="@+id/app_demo_sixth_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:text="sample"
android:textSize="18sp" />
<TextView
android:id="@+id/app_demo_seventh_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:text="sample"
android:textSize="17.5sp" />
<TextView
android:id="@+id/app_demo_fifth_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:text="sample"
android:textSize="18sp" />
<TextView
android:id="@+id/app_demo_eighth_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:text="sample"
android:textSize="17.5sp" />
<Button
android:id="@+id/app_demo_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Click Me!"
android:textAllCaps="false" />
</LinearLayout>
<TextView
android:id="@+id/app_demo_ninth_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:text="sample"
android:textSize="17.5sp" />
<TextView
android:id="@+id/app_demo_tenth_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:text="sample"
android:textSize="17.5sp" />
<TextView
android:id="@+id/app_demo_sixth_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:text="sample"
android:textSize="17.5sp" />
<TextView
android:id="@+id/app_demo_fifth_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:text="sample"
android:textSize="17.5sp" />
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginBottom="15dp"
android:src="@android:mipmap/sym_def_app_icon" />
<Button
android:id="@+id/app_demo_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Click Me!"
android:textAllCaps="false" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View File

@@ -1,3 +1,4 @@
<resources>
<string name="app_name">YukiHookDemoApp</string>
<string name="test_string">I am feel not good</string>
</resources>