Fix allMethods hooking replace bug

This commit is contained in:
2022-03-30 13:40:48 +08:00
parent cc8dbb8995
commit e895759172
5 changed files with 73 additions and 5 deletions

View File

@@ -47,6 +47,10 @@ class MainActivity : AppCompatActivity() {
appDemoFourthText.text = getRegularText(string = "Have fun day")
appDemoFifthText.text = getDataText()
appDemoSixthText.text = getArray(arrayOf("apple", "banana")).let { "${it[0]}, ${it[1]}" }
appDemoSeventhText.text = Main().getTestResultFirst()
appDemoEighthText.text = Main().getTestResultFirst(string = "Find something interesting")
appDemoNinthText.text = Main().getTestResultLast()
appDemoTenthText.text = Main().getTestResultLast(string = "This is the last sentence")
appDemoButton.setOnClickListener { toast() }
}
}

View File

@@ -27,7 +27,15 @@
*/
package com.highcapable.yukihookapi.demo_app.utils
class Main(private val string: String) {
class Main(private val string: String = "") {
fun getString() = string
fun getTestResultFirst() = "The world is beautiful"
fun getTestResultFirst(string: String) = string
fun getTestResultLast() = "The world is fantastic"
fun getTestResultLast(string: String) = string
}

View File

@@ -40,7 +40,31 @@
android:textSize="20sp" />
<TextView
android:id="@+id/app_demo_fifth_text"
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="20sp" />
<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="20sp" />
<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="20sp" />
<TextView
android:id="@+id/app_demo_tenth_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
@@ -55,6 +79,14 @@
android:text="sample"
android:textSize="20sp" />
<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="20sp" />
<Button
android:id="@+id/app_demo_button"
android:layout_width="wrap_content"