mirror of
https://github.com/HighCapable/YukiHookAPI.git
synced 2025-09-04 01:35:17 +08:00
feat: update demo
This commit is contained in:
@@ -47,6 +47,9 @@ dependencies {
|
|||||||
implementation(com.highcapable.hikage.hikage.extension)
|
implementation(com.highcapable.hikage.hikage.extension)
|
||||||
implementation(com.highcapable.hikage.hikage.widget.androidx)
|
implementation(com.highcapable.hikage.hikage.widget.androidx)
|
||||||
implementation(com.highcapable.hikage.hikage.widget.material)
|
implementation(com.highcapable.hikage.hikage.widget.material)
|
||||||
|
implementation(com.highcapable.betterandroid.ui.component)
|
||||||
|
implementation(com.highcapable.betterandroid.ui.extension)
|
||||||
|
implementation(com.highcapable.betterandroid.system.extension)
|
||||||
implementation(androidx.core.core.ktx)
|
implementation(androidx.core.core.ktx)
|
||||||
implementation(androidx.appcompat.appcompat)
|
implementation(androidx.appcompat.appcompat)
|
||||||
implementation(androidx.lifecycle.lifecycle.viewmodel.ktx)
|
implementation(androidx.lifecycle.lifecycle.viewmodel.ktx)
|
||||||
|
@@ -27,7 +27,7 @@ import android.os.Bundle
|
|||||||
import android.view.Gravity
|
import android.view.Gravity
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import com.highcapable.betterandroid.ui.component.activity.AppViewsActivity
|
||||||
import com.highcapable.betterandroid.ui.extension.view.toast
|
import com.highcapable.betterandroid.ui.extension.view.toast
|
||||||
import com.highcapable.betterandroid.ui.extension.view.updateMargins
|
import com.highcapable.betterandroid.ui.extension.view.updateMargins
|
||||||
import com.highcapable.hikage.extension.setContentView
|
import com.highcapable.hikage.extension.setContentView
|
||||||
@@ -36,67 +36,82 @@ import com.highcapable.hikage.widget.android.widget.ImageView
|
|||||||
import com.highcapable.hikage.widget.android.widget.LinearLayout
|
import com.highcapable.hikage.widget.android.widget.LinearLayout
|
||||||
import com.highcapable.hikage.widget.android.widget.TextView
|
import com.highcapable.hikage.widget.android.widget.TextView
|
||||||
import com.highcapable.hikage.widget.androidx.core.widget.NestedScrollView
|
import com.highcapable.hikage.widget.androidx.core.widget.NestedScrollView
|
||||||
|
import com.highcapable.hikage.widget.com.google.android.material.appbar.MaterialToolbar
|
||||||
import com.highcapable.yukihookapi.demo_app.R
|
import com.highcapable.yukihookapi.demo_app.R
|
||||||
import com.highcapable.yukihookapi.demo_app.test.Main
|
import com.highcapable.yukihookapi.demo_app.test.Main
|
||||||
import android.R as Android_R
|
import android.R as Android_R
|
||||||
|
|
||||||
class MainActivity : AppCompatActivity() {
|
class MainActivity : AppViewsActivity() {
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
val hikage = setContentView {
|
val hikage = setContentView {
|
||||||
NestedScrollView(
|
LinearLayout(
|
||||||
lparams = LayoutParams(matchParent = true),
|
lparams = LayoutParams(widthMatchParent = true),
|
||||||
init = {
|
init = {
|
||||||
isFillViewport = true
|
orientation = LinearLayout.VERTICAL
|
||||||
isVerticalScrollBarEnabled = false
|
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
LinearLayout(
|
MaterialToolbar(
|
||||||
lparams = LayoutParams(widthMatchParent = true) {
|
lparams = LayoutParams(widthMatchParent = true),
|
||||||
updateMargins(vertical = 20.dp)
|
|
||||||
},
|
|
||||||
init = {
|
init = {
|
||||||
orientation = LinearLayout.VERTICAL
|
title = stringResource(R.string.app_name)
|
||||||
gravity = Gravity.CENTER
|
}
|
||||||
|
)
|
||||||
|
NestedScrollView(
|
||||||
|
lparams = LayoutParams(matchParent = true),
|
||||||
|
init = {
|
||||||
|
isFillViewport = true
|
||||||
|
isVerticalScrollBarEnabled = false
|
||||||
|
isVerticalFadingEdgeEnabled = true
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
ImageView(
|
LinearLayout(
|
||||||
lparams = LayoutParams(50.dp, 50.dp) {
|
lparams = LayoutParams(widthMatchParent = true) {
|
||||||
bottomMargin = 15.dp
|
updateMargins(vertical = 20.dp)
|
||||||
|
},
|
||||||
|
init = {
|
||||||
|
orientation = LinearLayout.VERTICAL
|
||||||
|
gravity = Gravity.CENTER
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
setImageResource(R.mipmap.ic_face_unhappy)
|
ImageView(
|
||||||
}
|
lparams = LayoutParams(50.dp, 50.dp) {
|
||||||
TextView(
|
|
||||||
lparams = LayoutParams {
|
|
||||||
bottomMargin = 25.dp
|
|
||||||
}
|
|
||||||
) {
|
|
||||||
text = stringResource(R.string.test_string)
|
|
||||||
textSize = 17.5f
|
|
||||||
}
|
|
||||||
repeat(11) {
|
|
||||||
TextView(
|
|
||||||
id = "sample_text_$it",
|
|
||||||
lparams = LayoutParams {
|
|
||||||
bottomMargin = 15.dp
|
bottomMargin = 15.dp
|
||||||
}
|
}
|
||||||
|
) {
|
||||||
|
setImageResource(R.mipmap.ic_face_unhappy)
|
||||||
|
}
|
||||||
|
TextView(
|
||||||
|
lparams = LayoutParams {
|
||||||
|
bottomMargin = 25.dp
|
||||||
|
}
|
||||||
) {
|
) {
|
||||||
text = stringResource(R.string.test_string)
|
text = stringResource(R.string.test_string)
|
||||||
textSize = 17.5f
|
textSize = 17.5f
|
||||||
}
|
}
|
||||||
}
|
repeat(11) {
|
||||||
ImageView(
|
TextView(
|
||||||
lparams = LayoutParams(30.dp, 30.dp) {
|
id = "sample_text_$it",
|
||||||
bottomMargin = 15.dp
|
lparams = LayoutParams {
|
||||||
|
bottomMargin = 15.dp
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
text = stringResource(R.string.test_string)
|
||||||
|
textSize = 17.5f
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ImageView(
|
||||||
|
lparams = LayoutParams(30.dp, 30.dp) {
|
||||||
|
bottomMargin = 15.dp
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
setImageResource(Android_R.mipmap.sym_def_app_icon)
|
||||||
|
}
|
||||||
|
Button {
|
||||||
|
text = "Click Me!"
|
||||||
|
setOnClickListener { toast() }
|
||||||
}
|
}
|
||||||
) {
|
|
||||||
setImageResource(Android_R.mipmap.sym_def_app_icon)
|
|
||||||
}
|
|
||||||
Button {
|
|
||||||
text = "Click Me!"
|
|
||||||
setOnClickListener { toast() }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||||
<!-- Base application theme. -->
|
<!-- Base application theme. -->
|
||||||
<style name="Theme.Default" parent="Theme.Material3.DayNight">
|
<style name="Theme.Default" parent="Theme.Material3.DayNight.NoActionBar">
|
||||||
<!-- Primary brand color. -->
|
<!-- Primary brand color. -->
|
||||||
<item name="colorPrimary">@color/yuki_theme_color</item>
|
<item name="colorPrimary">@color/yuki_theme_color</item>
|
||||||
<item name="colorPrimaryVariant">@color/yuki_theme_color</item>
|
<item name="colorPrimaryVariant">@color/yuki_theme_color</item>
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
<resources>
|
<resources>
|
||||||
<string name="app_name">YukiHookDemoApp</string>
|
<string name="app_name">YukiHook App</string>
|
||||||
<string name="test_string">I am feel not good</string>
|
<string name="test_string">I am feel not good</string>
|
||||||
</resources>
|
</resources>
|
@@ -1,6 +1,6 @@
|
|||||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||||
<!-- Base application theme. -->
|
<!-- Base application theme. -->
|
||||||
<style name="Theme.Default" parent="Theme.Material3.DayNight">
|
<style name="Theme.Default" parent="Theme.Material3.DayNight.NoActionBar">
|
||||||
<!-- Primary brand color. -->
|
<!-- Primary brand color. -->
|
||||||
<item name="colorPrimary">@color/yuki_theme_color</item>
|
<item name="colorPrimary">@color/yuki_theme_color</item>
|
||||||
<item name="colorPrimaryVariant">@color/yuki_theme_color</item>
|
<item name="colorPrimaryVariant">@color/yuki_theme_color</item>
|
||||||
|
@@ -53,6 +53,9 @@ dependencies {
|
|||||||
implementation(com.highcapable.hikage.hikage.extension)
|
implementation(com.highcapable.hikage.hikage.extension)
|
||||||
implementation(com.highcapable.hikage.hikage.widget.androidx)
|
implementation(com.highcapable.hikage.hikage.widget.androidx)
|
||||||
implementation(com.highcapable.hikage.hikage.widget.material)
|
implementation(com.highcapable.hikage.hikage.widget.material)
|
||||||
|
implementation(com.highcapable.betterandroid.ui.component)
|
||||||
|
implementation(com.highcapable.betterandroid.ui.extension)
|
||||||
|
implementation(com.highcapable.betterandroid.system.extension)
|
||||||
implementation(androidx.preference.preference.ktx)
|
implementation(androidx.preference.preference.ktx)
|
||||||
implementation(androidx.core.core.ktx)
|
implementation(androidx.core.core.ktx)
|
||||||
implementation(androidx.appcompat.appcompat)
|
implementation(androidx.appcompat.appcompat)
|
||||||
|
@@ -50,6 +50,7 @@
|
|||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".ui.PreferenceActivity"
|
android:name=".ui.PreferenceActivity"
|
||||||
android:exported="false" />
|
android:exported="false"
|
||||||
|
android:theme="@style/Theme.Default.ActionBar" />
|
||||||
</application>
|
</application>
|
||||||
</manifest>
|
</manifest>
|
@@ -25,10 +25,10 @@ package com.highcapable.yukihookapi.demo_module.hook
|
|||||||
|
|
||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.os.Build
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.widget.Button
|
import android.widget.Button
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||||
|
import com.highcapable.betterandroid.system.extension.tool.SystemVersion
|
||||||
import com.highcapable.kavaref.KavaRef.Companion.resolve
|
import com.highcapable.kavaref.KavaRef.Companion.resolve
|
||||||
import com.highcapable.kavaref.extension.ArrayClass
|
import com.highcapable.kavaref.extension.ArrayClass
|
||||||
import com.highcapable.yukihookapi.YukiHookAPI
|
import com.highcapable.yukihookapi.YukiHookAPI
|
||||||
@@ -190,7 +190,7 @@ object HookEntry : IYukiHookXposedInit {
|
|||||||
// Register Activity Proxy
|
// Register Activity Proxy
|
||||||
// 注册模块 Activity 代理
|
// 注册模块 Activity 代理
|
||||||
onAppLifecycle {
|
onAppLifecycle {
|
||||||
onCreate { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) registerModuleAppActivities() }
|
onCreate { if (SystemVersion.isHighOrEqualsTo(SystemVersion.N)) registerModuleAppActivities() }
|
||||||
}
|
}
|
||||||
// Find Class to hook
|
// Find Class to hook
|
||||||
// 得到需要 Hook 的 Class
|
// 得到需要 Hook 的 Class
|
||||||
@@ -288,7 +288,7 @@ object HookEntry : IYukiHookXposedInit {
|
|||||||
.setTitle("Hooked")
|
.setTitle("Hooked")
|
||||||
.setMessage("I am hook your toast showing!")
|
.setMessage("I am hook your toast showing!")
|
||||||
.apply {
|
.apply {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
|
if (SystemVersion.isHighOrEqualsTo(SystemVersion.N))
|
||||||
setPositiveButton("START PARASITIC") { _, _ ->
|
setPositiveButton("START PARASITIC") { _, _ ->
|
||||||
MaterialAlertDialogBuilder(context)
|
MaterialAlertDialogBuilder(context)
|
||||||
.setTitle("Start Parasitic")
|
.setTitle("Start Parasitic")
|
||||||
|
@@ -35,22 +35,22 @@ import com.highcapable.betterandroid.ui.extension.view.toast
|
|||||||
import com.highcapable.betterandroid.ui.extension.view.updateMargins
|
import com.highcapable.betterandroid.ui.extension.view.updateMargins
|
||||||
import com.highcapable.hikage.extension.setContentView
|
import com.highcapable.hikage.extension.setContentView
|
||||||
import com.highcapable.hikage.widget.android.widget.Button
|
import com.highcapable.hikage.widget.android.widget.Button
|
||||||
import com.highcapable.hikage.widget.android.widget.EditText
|
|
||||||
import com.highcapable.hikage.widget.android.widget.LinearLayout
|
import com.highcapable.hikage.widget.android.widget.LinearLayout
|
||||||
import com.highcapable.hikage.widget.android.widget.TextView
|
import com.highcapable.hikage.widget.android.widget.TextView
|
||||||
import com.highcapable.hikage.widget.androidx.core.widget.NestedScrollView
|
import com.highcapable.hikage.widget.androidx.core.widget.NestedScrollView
|
||||||
|
import com.highcapable.hikage.widget.com.google.android.material.appbar.MaterialToolbar
|
||||||
|
import com.highcapable.hikage.widget.com.google.android.material.textfield.TextInputEditText
|
||||||
|
import com.highcapable.hikage.widget.com.google.android.material.textfield.TextInputLayout
|
||||||
import com.highcapable.yukihookapi.YukiHookAPI
|
import com.highcapable.yukihookapi.YukiHookAPI
|
||||||
import com.highcapable.yukihookapi.demo_module.R
|
import com.highcapable.yukihookapi.demo_module.R
|
||||||
import com.highcapable.yukihookapi.demo_module.data.DataConst
|
import com.highcapable.yukihookapi.demo_module.data.DataConst
|
||||||
|
import com.highcapable.yukihookapi.demo_module.ui.base.BaseActivity
|
||||||
import com.highcapable.yukihookapi.hook.factory.dataChannel
|
import com.highcapable.yukihookapi.hook.factory.dataChannel
|
||||||
import com.highcapable.yukihookapi.hook.factory.prefs
|
import com.highcapable.yukihookapi.hook.factory.prefs
|
||||||
import com.highcapable.yukihookapi.hook.xposed.parasitic.activity.base.ModuleAppCompatActivity
|
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.Date
|
import java.util.Date
|
||||||
|
|
||||||
class MainActivity : ModuleAppCompatActivity() {
|
class MainActivity : BaseActivity() {
|
||||||
|
|
||||||
override val moduleTheme get() = R.style.Theme_Default
|
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
@@ -62,111 +62,129 @@ class MainActivity : ModuleAppCompatActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
val hikage = setContentView {
|
val hikage = setContentView {
|
||||||
NestedScrollView(
|
LinearLayout(
|
||||||
lparams = LayoutParams(matchParent = true),
|
lparams = LayoutParams(widthMatchParent = true),
|
||||||
init = {
|
init = {
|
||||||
isFillViewport = true
|
orientation = LinearLayout.VERTICAL
|
||||||
isVerticalScrollBarEnabled = false
|
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
LinearLayout(
|
MaterialToolbar(
|
||||||
lparams = LayoutParams(widthMatchParent = true) {
|
lparams = LayoutParams(widthMatchParent = true),
|
||||||
updateMargins(vertical = 20.dp)
|
|
||||||
},
|
|
||||||
init = {
|
init = {
|
||||||
orientation = LinearLayout.VERTICAL
|
title = stringResource(R.string.app_name)
|
||||||
gravity = Gravity.CENTER
|
}
|
||||||
|
)
|
||||||
|
NestedScrollView(
|
||||||
|
lparams = LayoutParams(matchParent = true),
|
||||||
|
init = {
|
||||||
|
isFillViewport = true
|
||||||
|
isVerticalScrollBarEnabled = false
|
||||||
|
isVerticalFadingEdgeEnabled = true
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
lateinit var editText: TextView
|
|
||||||
LinearLayout(
|
LinearLayout(
|
||||||
lparams = LayoutParams(widthMatchParent = true) {
|
lparams = LayoutParams(widthMatchParent = true) {
|
||||||
updateMargins(horizontal = 50.dp)
|
updateMargins(vertical = 20.dp)
|
||||||
updateMargins(bottom = 15.dp)
|
|
||||||
},
|
},
|
||||||
init = {
|
init = {
|
||||||
orientation = LinearLayout.VERTICAL
|
orientation = LinearLayout.VERTICAL
|
||||||
gravity = Gravity.CENTER or Gravity.START
|
gravity = Gravity.CENTER
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
repeat(6) { index ->
|
lateinit var editText: TextView
|
||||||
TextView(
|
LinearLayout(
|
||||||
id = "sample_title_text_$index",
|
lparams = LayoutParams(widthMatchParent = true) {
|
||||||
lparams = LayoutParams {
|
updateMargins(horizontal = 50.dp)
|
||||||
bottomMargin = 5.dp
|
updateMargins(bottom = 15.dp)
|
||||||
}
|
},
|
||||||
) {
|
init = {
|
||||||
textSize = 18f
|
orientation = LinearLayout.VERTICAL
|
||||||
isSingleLine = true
|
|
||||||
ellipsize = TextUtils.TruncateAt.END
|
|
||||||
gravity = Gravity.CENTER or Gravity.START
|
gravity = Gravity.CENTER or Gravity.START
|
||||||
}
|
}
|
||||||
|
) {
|
||||||
|
repeat(6) { index ->
|
||||||
|
TextView(
|
||||||
|
id = "sample_title_text_$index",
|
||||||
|
lparams = LayoutParams {
|
||||||
|
bottomMargin = 5.dp
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
textSize = 18f
|
||||||
|
isSingleLine = true
|
||||||
|
ellipsize = TextUtils.TruncateAt.END
|
||||||
|
gravity = Gravity.CENTER or Gravity.START
|
||||||
|
}
|
||||||
|
TextView(
|
||||||
|
id = "sample_subtitle_text_$index",
|
||||||
|
lparams = LayoutParams {
|
||||||
|
bottomMargin = if (index < 5) 15.dp else 25.dp
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
alpha = 0.85f
|
||||||
|
textSize = 15f
|
||||||
|
isSingleLine = true
|
||||||
|
ellipsize = TextUtils.TruncateAt.END
|
||||||
|
gravity = Gravity.CENTER or Gravity.START
|
||||||
|
}
|
||||||
|
}
|
||||||
TextView(
|
TextView(
|
||||||
id = "sample_subtitle_text_$index",
|
|
||||||
lparams = LayoutParams {
|
lparams = LayoutParams {
|
||||||
bottomMargin = if (index < 5) 15.dp else 25.dp
|
leftMargin = 5.dp
|
||||||
|
bottomMargin = 25.dp
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
alpha = 0.85f
|
|
||||||
textSize = 15f
|
textSize = 15f
|
||||||
isSingleLine = true
|
isSingleLine = true
|
||||||
ellipsize = TextUtils.TruncateAt.END
|
ellipsize = TextUtils.TruncateAt.END
|
||||||
gravity = Gravity.CENTER or Gravity.START
|
gravity = Gravity.CENTER or Gravity.START
|
||||||
|
text = "Leave something in there"
|
||||||
}
|
}
|
||||||
|
TextInputLayout(
|
||||||
|
lparams = LayoutParams(widthMatchParent = true)
|
||||||
|
) {
|
||||||
|
editText = TextInputEditText(
|
||||||
|
lparams = LayoutParams(widthMatchParent = true)
|
||||||
|
) {
|
||||||
|
hint = "Please enter the text"
|
||||||
|
isSingleLine = true
|
||||||
|
textSize = 18f
|
||||||
|
hostEnvironment { isEnabled = false }
|
||||||
|
setText(prefs().get(DataConst.TEST_KV_DATA))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Button(
|
||||||
|
lparams = LayoutParams {
|
||||||
|
bottomMargin = 15.dp
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
text = "Save Test Data"
|
||||||
|
hostEnvironment { isEnabled = false }
|
||||||
|
setOnClickListener { _ ->
|
||||||
|
moduleEnvironment {
|
||||||
|
if (editText.textToString().isNotEmpty()) {
|
||||||
|
prefs().edit { put(DataConst.TEST_KV_DATA, editText.textToString()) }
|
||||||
|
toast("Saved")
|
||||||
|
} else toast("Please enter the text")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Button {
|
||||||
|
text = "Open PreferenceFragment"
|
||||||
|
setOnClickListener { startActivity<PreferenceActivity>() }
|
||||||
}
|
}
|
||||||
TextView(
|
TextView(
|
||||||
lparams = LayoutParams {
|
lparams = LayoutParams {
|
||||||
leftMargin = 5.dp
|
topMargin = 25.dp
|
||||||
bottomMargin = 25.dp
|
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
textSize = 15f
|
alpha = 0.45f
|
||||||
|
textSize = 13f
|
||||||
isSingleLine = true
|
isSingleLine = true
|
||||||
ellipsize = TextUtils.TruncateAt.END
|
ellipsize = TextUtils.TruncateAt.END
|
||||||
gravity = Gravity.CENTER or Gravity.START
|
gravity = Gravity.CENTER or Gravity.START
|
||||||
text = "Leave something in there"
|
text = "Compiled Time:${SimpleDateFormat.getDateTimeInstance().format(Date(YukiHookAPI.Status.compiledTimestamp))}"
|
||||||
}
|
}
|
||||||
editText = EditText(
|
|
||||||
lparams = LayoutParams(width = 250.dp)
|
|
||||||
) {
|
|
||||||
hint = "Please enter the text"
|
|
||||||
isSingleLine = true
|
|
||||||
textSize = 18f
|
|
||||||
hostEnvironment { isEnabled = false }
|
|
||||||
setText(prefs().get(DataConst.TEST_KV_DATA))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Button(
|
|
||||||
lparams = LayoutParams {
|
|
||||||
bottomMargin = 15.dp
|
|
||||||
}
|
|
||||||
) {
|
|
||||||
text = "Save Test Data"
|
|
||||||
hostEnvironment { isEnabled = false }
|
|
||||||
setOnClickListener { _ ->
|
|
||||||
moduleEnvironment {
|
|
||||||
if (editText.textToString().isNotEmpty()) {
|
|
||||||
prefs().edit { put(DataConst.TEST_KV_DATA, editText.textToString()) }
|
|
||||||
toast("Saved")
|
|
||||||
} else toast("Please enter the text")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Button {
|
|
||||||
text = "Open PreferenceFragment"
|
|
||||||
setOnClickListener { startActivity<PreferenceActivity>() }
|
|
||||||
}
|
|
||||||
TextView(
|
|
||||||
lparams = LayoutParams {
|
|
||||||
topMargin = 25.dp
|
|
||||||
}
|
|
||||||
) {
|
|
||||||
alpha = 0.45f
|
|
||||||
textSize = 13f
|
|
||||||
isSingleLine = true
|
|
||||||
ellipsize = TextUtils.TruncateAt.END
|
|
||||||
gravity = Gravity.CENTER or Gravity.START
|
|
||||||
text = "Compiled Time:${SimpleDateFormat.getDateTimeInstance().format(Date(YukiHookAPI.Status.compiledTimestamp))}"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -25,12 +25,12 @@ import android.os.Bundle
|
|||||||
import androidx.preference.SwitchPreference
|
import androidx.preference.SwitchPreference
|
||||||
import com.highcapable.yukihookapi.YukiHookAPI
|
import com.highcapable.yukihookapi.YukiHookAPI
|
||||||
import com.highcapable.yukihookapi.demo_module.R
|
import com.highcapable.yukihookapi.demo_module.R
|
||||||
import com.highcapable.yukihookapi.hook.xposed.parasitic.activity.base.ModuleAppCompatActivity
|
import com.highcapable.yukihookapi.demo_module.ui.base.BaseActivity
|
||||||
import com.highcapable.yukihookapi.hook.xposed.prefs.ui.ModulePreferenceFragment
|
import com.highcapable.yukihookapi.hook.xposed.prefs.ui.ModulePreferenceFragment
|
||||||
|
|
||||||
class PreferenceActivity : ModuleAppCompatActivity() {
|
class PreferenceActivity : BaseActivity() {
|
||||||
|
|
||||||
override val moduleTheme get() = R.style.Theme_Default
|
override val moduleTheme get() = R.style.Theme_Default_ActionBar
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
@@ -0,0 +1,50 @@
|
|||||||
|
/*
|
||||||
|
* YukiHookAPI - An efficient Hook API and Xposed Module solution built in Kotlin.
|
||||||
|
* Copyright (C) 2019 HighCapable
|
||||||
|
* https://github.com/HighCapable/YukiHookAPI
|
||||||
|
*
|
||||||
|
* Apache License Version 2.0
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*
|
||||||
|
* This file is created by fankes on 2025/6/18.
|
||||||
|
*/
|
||||||
|
package com.highcapable.yukihookapi.demo_module.ui.base
|
||||||
|
|
||||||
|
import android.content.res.Configuration
|
||||||
|
import android.os.Bundle
|
||||||
|
import com.highcapable.betterandroid.ui.component.activity.AppViewsActivity
|
||||||
|
import com.highcapable.yukihookapi.demo_module.R
|
||||||
|
import com.highcapable.yukihookapi.hook.xposed.parasitic.activity.proxy.ModuleActivity
|
||||||
|
|
||||||
|
abstract class BaseActivity : AppViewsActivity(), ModuleActivity {
|
||||||
|
|
||||||
|
override val moduleTheme get() = R.style.Theme_Default
|
||||||
|
|
||||||
|
override fun getClassLoader() = delegate.getClassLoader()
|
||||||
|
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
delegate.onCreate(savedInstanceState)
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onConfigurationChanged(newConfig: Configuration) {
|
||||||
|
delegate.onConfigurationChanged(newConfig)
|
||||||
|
super.onConfigurationChanged(newConfig)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onRestoreInstanceState(savedInstanceState: Bundle) {
|
||||||
|
delegate.onRestoreInstanceState(savedInstanceState)
|
||||||
|
super.onRestoreInstanceState(savedInstanceState)
|
||||||
|
}
|
||||||
|
}
|
@@ -1,6 +1,6 @@
|
|||||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||||
<!-- Base application theme. -->
|
<!-- Base application theme. -->
|
||||||
<style name="Theme.Default" parent="Theme.Material3.DayNight">
|
<style name="Theme.Default" parent="Theme.Material3.DayNight.NoActionBar">
|
||||||
<!-- Primary brand color. -->
|
<!-- Primary brand color. -->
|
||||||
<item name="colorPrimary">@color/yuki_theme_color</item>
|
<item name="colorPrimary">@color/yuki_theme_color</item>
|
||||||
<item name="colorPrimaryVariant">@color/yuki_theme_color</item>
|
<item name="colorPrimaryVariant">@color/yuki_theme_color</item>
|
||||||
|
@@ -1,3 +1,3 @@
|
|||||||
<resources>
|
<resources>
|
||||||
<string name="app_name">YukiHookDemoModule</string>
|
<string name="app_name">YukiHook Module</string>
|
||||||
</resources>
|
</resources>
|
@@ -1,6 +1,6 @@
|
|||||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||||
<!-- Base application theme. -->
|
<!-- Base application theme. -->
|
||||||
<style name="Theme.Default" parent="Theme.Material3.DayNight">
|
<style name="Theme.Default" parent="Theme.Material3.DayNight.NoActionBar">
|
||||||
<!-- Primary brand color. -->
|
<!-- Primary brand color. -->
|
||||||
<item name="colorPrimary">@color/yuki_theme_color</item>
|
<item name="colorPrimary">@color/yuki_theme_color</item>
|
||||||
<item name="colorPrimaryVariant">@color/yuki_theme_color</item>
|
<item name="colorPrimaryVariant">@color/yuki_theme_color</item>
|
||||||
@@ -16,4 +16,11 @@
|
|||||||
<!-- Customize your theme here. -->
|
<!-- Customize your theme here. -->
|
||||||
<item name="android:windowSplashScreenAnimatedIcon" tools:targetApi="s">@mipmap/ic_launcher</item>
|
<item name="android:windowSplashScreenAnimatedIcon" tools:targetApi="s">@mipmap/ic_launcher</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<style name="Theme.Default.ActionBar" parent="Theme.Material3.DayNight">
|
||||||
|
<!-- 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>
|
||||||
|
</style>
|
||||||
</resources>
|
</resources>
|
Reference in New Issue
Block a user