From acbf12d7c755a8fa27a1ae3babbb6f567e62a0bc Mon Sep 17 00:00:00 2001 From: Tornaco Date: Fri, 23 Aug 2024 08:15:55 +0800 Subject: [PATCH] UI opt --- .../main/res/values-zh-rCN/app_strings.xml | 3 + .../main/res/values-zh-rTW/app_strings.xml | 3 + .../res/src/main/res/values/app_strings.xml | 3 + .../fortuitous/thanos/main/ChooserActivity.kt | 64 ++++++++++++++----- 4 files changed, 56 insertions(+), 17 deletions(-) diff --git a/android/android_framework/res/src/main/res/values-zh-rCN/app_strings.xml b/android/android_framework/res/src/main/res/values-zh-rCN/app_strings.xml index 178977688..d92ef3e48 100644 --- a/android/android_framework/res/src/main/res/values-zh-rCN/app_strings.xml +++ b/android/android_framework/res/src/main/res/values-zh-rCN/app_strings.xml @@ -248,4 +248,7 @@ 默认 未设置 未知 + + 适用于Root设备,需要安装Magisk或LSPosed框架;LSPosed模式下功能最多,Magisk模式下相对较少 + 适用于非Root设备,需要安装Shizuku,并在Shizuku中勾选Thanox;注意:受限于系统权限,Shizuku模式下功能非常少 \ No newline at end of file diff --git a/android/android_framework/res/src/main/res/values-zh-rTW/app_strings.xml b/android/android_framework/res/src/main/res/values-zh-rTW/app_strings.xml index 657df1780..a0dc2560b 100644 --- a/android/android_framework/res/src/main/res/values-zh-rTW/app_strings.xml +++ b/android/android_framework/res/src/main/res/values-zh-rTW/app_strings.xml @@ -246,4 +246,7 @@ 默认 未设置 未知 + + 适用于Root设备,需要安装Magisk或LSPosed框架;LSPosed模式下功能最多,Magisk模式下相对较少 + 适用于非Root设备,需要安装Shizuku,并在Shizuku中勾选Thanox;注意:受限于系统权限,Shizuku模式下功能非常少 \ No newline at end of file diff --git a/android/android_framework/res/src/main/res/values/app_strings.xml b/android/android_framework/res/src/main/res/values/app_strings.xml index 27ee19388..66380a7d0 100644 --- a/android/android_framework/res/src/main/res/values/app_strings.xml +++ b/android/android_framework/res/src/main/res/values/app_strings.xml @@ -240,4 +240,7 @@ Default Not Set Unknown + + For rooted devices, requires Magisk or LSPosed framework; LSPosed mode provides the most features, while Magisk mode has relatively fewer features. + For non-rooted devices, requires Shizuku and selecting Thanox within Shizuku; Note: Due to system permission restrictions, the Shizuku mode has very limited features. \ No newline at end of file diff --git a/android/app/src/main/java/now/fortuitous/thanos/main/ChooserActivity.kt b/android/app/src/main/java/now/fortuitous/thanos/main/ChooserActivity.kt index c2c1ee9c4..101f233a9 100644 --- a/android/app/src/main/java/now/fortuitous/thanos/main/ChooserActivity.kt +++ b/android/app/src/main/java/now/fortuitous/thanos/main/ChooserActivity.kt @@ -23,7 +23,7 @@ import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding -import androidx.compose.material3.Button +import androidx.compose.material3.Card import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable @@ -31,12 +31,16 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.stringResource +import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp +import androidx.compose.ui.unit.sp import dagger.hilt.android.AndroidEntryPoint import github.tornaco.android.thanos.main.Analytics import github.tornaco.android.thanos.module.compose.common.ComposeThemeActivity import github.tornaco.android.thanos.module.compose.common.widget.LargeSpacer +import github.tornaco.android.thanos.module.compose.common.widget.StandardSpacer +import github.tornaco.android.thanos.module.compose.common.widget.ThanoxCardRoundedCornerShape import github.tornaco.android.thanos.util.ActivityUtils import now.fortuitous.thanos.analytics.SelectActiveMethodShizuku import now.fortuitous.thanos.analytics.SelectActiveMethodXposedOrMagisk @@ -85,25 +89,51 @@ class ChooserActivity : ComposeThemeActivity() { LargeSpacer() } - Button(modifier = Modifier.fillMaxWidth(0.68f), onClick = { - Analytics.reportEvent(SelectActiveMethodShizuku) - AppPreference.setAppType(context, "thanos") - NavActivity.Starter.start(context) - finish() - }) { - Text(text = "Shizuku - " + stringResource(id = github.tornaco.android.thanos.module.common.R.string.common_badge_text_experiment)) - } + MethodCard( + title = "Shizuku", + summary = stringResource(id = github.tornaco.android.thanos.res.R.string.active_method_chooser_summary_shizuku), + onClick = { + Analytics.reportEvent(SelectActiveMethodShizuku) + AppPreference.setAppType(context, "thanos") + NavActivity.Starter.start(context) + finish() + }) + LargeSpacer() - Button(modifier = Modifier.fillMaxWidth(0.68f), onClick = { - Analytics.reportEvent(SelectActiveMethodXposedOrMagisk) - AppPreference.setAppType(context, "thanox") - NavActivity.Starter.start(context) - finish() - }) { - Text(text = "Xposed/Magisk") - } + + + MethodCard( + title = "Xposed/Magisk", + summary = stringResource(id = github.tornaco.android.thanos.res.R.string.active_method_chooser_summary_xposed_magisk), + onClick = { + Analytics.reportEvent(SelectActiveMethodXposedOrMagisk) + AppPreference.setAppType(context, "thanox") + NavActivity.Starter.start(context) + finish() + }) } } } } +} + +@Composable +fun MethodCard( + title: String, + summary: String, + onClick: () -> Unit = {} +) { + Card( + modifier = Modifier + .padding(16.dp), + shape = ThanoxCardRoundedCornerShape, + onClick = onClick, + content = { + Column(Modifier.padding(16.dp)) { + Text(text = title, fontSize = 24.sp, fontWeight = FontWeight.Bold) + StandardSpacer() + Text(text = summary) + } + } + ) } \ No newline at end of file