Skip to content

Commit

Permalink
UI opt
Browse files Browse the repository at this point in the history
  • Loading branch information
Tornaco committed Aug 23, 2024
1 parent c3b1d6e commit acbf12d
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -248,4 +248,7 @@
<string name="module_ops2_perm_state_default">默认</string>
<string name="module_ops2_perm_state_not_set">未设置</string>
<string name="module_ops2_perm_state_unknown">未知</string>

<string name="active_method_chooser_summary_xposed_magisk">适用于Root设备,需要安装Magisk或LSPosed框架;LSPosed模式下功能最多,Magisk模式下相对较少</string>
<string name="active_method_chooser_summary_shizuku">适用于非Root设备,需要安装Shizuku,并在Shizuku中勾选Thanox;注意:受限于系统权限,Shizuku模式下功能非常少</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -246,4 +246,7 @@
<string name="module_ops2_perm_state_default">默认</string>
<string name="module_ops2_perm_state_not_set">未设置</string>
<string name="module_ops2_perm_state_unknown">未知</string>

<string name="active_method_chooser_summary_xposed_magisk">适用于Root设备,需要安装Magisk或LSPosed框架;LSPosed模式下功能最多,Magisk模式下相对较少</string>
<string name="active_method_chooser_summary_shizuku">适用于非Root设备,需要安装Shizuku,并在Shizuku中勾选Thanox;注意:受限于系统权限,Shizuku模式下功能非常少</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -240,4 +240,7 @@
<string name="module_ops2_perm_state_default">Default</string>
<string name="module_ops2_perm_state_not_set">Not Set</string>
<string name="module_ops2_perm_state_unknown">Unknown</string>

<string name="active_method_chooser_summary_xposed_magisk">For rooted devices, requires Magisk or LSPosed framework; LSPosed mode provides the most features, while Magisk mode has relatively fewer features.</string>
<string name="active_method_chooser_summary_shizuku">For non-rooted devices, requires Shizuku and selecting Thanox within Shizuku; Note: Due to system permission restrictions, the Shizuku mode has very limited features.</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,24 @@ 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
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
Expand Down Expand Up @@ -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)
}
}
)
}

0 comments on commit acbf12d

Please sign in to comment.