mirror of
https://github.com/gkd-kit/gkd.git
synced 2024-11-16 11:42:22 +08:00
perf: text switch descContent
This commit is contained in:
parent
bca49d3cc0
commit
2b182553d6
|
@ -48,6 +48,7 @@ import androidx.compose.ui.input.nestedscroll.nestedScroll
|
|||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.text.input.KeyboardType
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.text.style.TextDecoration
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.window.Dialog
|
||||
import androidx.core.content.ContextCompat
|
||||
|
@ -78,6 +79,7 @@ import li.songe.gkd.shizuku.safeGetTasks
|
|||
import li.songe.gkd.ui.component.AuthCard
|
||||
import li.songe.gkd.ui.component.SettingItem
|
||||
import li.songe.gkd.ui.component.TextSwitch
|
||||
import li.songe.gkd.ui.component.updateDialogOptions
|
||||
import li.songe.gkd.ui.destinations.SnapshotPageDestination
|
||||
import li.songe.gkd.ui.style.EmptyHeight
|
||||
import li.songe.gkd.ui.style.itemPadding
|
||||
|
@ -246,9 +248,10 @@ fun AdvancedPage() {
|
|||
Text(
|
||||
text = "http://127.0.0.1:${store.httpServerPort}",
|
||||
color = MaterialTheme.colorScheme.primary,
|
||||
style = LocalTextStyle.current.copy(textDecoration = TextDecoration.Underline),
|
||||
modifier = Modifier.clickable {
|
||||
context.openUri("http://127.0.0.1:${store.httpServerPort}")
|
||||
}
|
||||
},
|
||||
)
|
||||
Spacer(modifier = Modifier.width(2.dp))
|
||||
Text(text = "仅本设备可访问")
|
||||
|
@ -257,6 +260,7 @@ fun AdvancedPage() {
|
|||
Text(
|
||||
text = "http://${host}:${store.httpServerPort}",
|
||||
color = MaterialTheme.colorScheme.primary,
|
||||
style = LocalTextStyle.current.copy(textDecoration = TextDecoration.Underline),
|
||||
modifier = Modifier.clickable {
|
||||
context.openUri("http://${host}:${store.httpServerPort}")
|
||||
}
|
||||
|
@ -349,7 +353,7 @@ fun AdvancedPage() {
|
|||
val floatingRunning by FloatingService.isRunning.collectAsState()
|
||||
TextSwitch(
|
||||
name = "悬浮窗服务",
|
||||
desc = "显示截屏按钮,便于用户主动保存快照",
|
||||
desc = "显示截屏按钮,点击即可保存快照",
|
||||
checked = floatingRunning,
|
||||
onCheckedChange = vm.viewModelScope.launchAsFn<Boolean> {
|
||||
if (it) {
|
||||
|
@ -365,7 +369,7 @@ fun AdvancedPage() {
|
|||
|
||||
TextSwitch(
|
||||
name = "音量快照",
|
||||
desc = "音量变化时生成快照,悬浮窗按钮不工作时使用",
|
||||
desc = "音量变化时生成快照,若悬浮按钮不工作可使用",
|
||||
checked = store.captureVolumeChange
|
||||
) {
|
||||
storeFlow.value = store.copy(
|
||||
|
@ -375,7 +379,27 @@ fun AdvancedPage() {
|
|||
|
||||
TextSwitch(
|
||||
name = "截屏快照",
|
||||
desc = "当用户截屏时保存快照(需手动替换快照图片),仅支持部分小米设备",
|
||||
descContent = {
|
||||
Row {
|
||||
Text(
|
||||
text = "触发截屏时保存快照",
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
)
|
||||
Spacer(modifier = Modifier.width(2.dp))
|
||||
Text(
|
||||
text = "查看限制",
|
||||
style = MaterialTheme.typography.bodyMedium.copy(textDecoration = TextDecoration.Underline),
|
||||
color = MaterialTheme.colorScheme.primary,
|
||||
modifier = Modifier.clickable(onClick = throttle {
|
||||
context.mainVm.dialogFlow.updateDialogOptions(
|
||||
title = "限制说明",
|
||||
text = "仅支持部分小米设备截屏触发\n\n只保存节点信息不保存图片, 用户需要在快照记录里替换截图",
|
||||
)
|
||||
})
|
||||
)
|
||||
}
|
||||
},
|
||||
checked = store.captureScreenshot
|
||||
) {
|
||||
storeFlow.value = store.copy(
|
||||
|
@ -385,7 +409,7 @@ fun AdvancedPage() {
|
|||
|
||||
TextSwitch(
|
||||
name = "隐藏状态栏",
|
||||
desc = "当保存快照时,隐藏截图里的顶部状态栏高度区域",
|
||||
desc = "隐藏快照截图顶部状态栏",
|
||||
checked = store.hideSnapshotStatusBar
|
||||
) {
|
||||
storeFlow.value = store.copy(
|
||||
|
@ -395,7 +419,7 @@ fun AdvancedPage() {
|
|||
|
||||
TextSwitch(
|
||||
name = "保存提示",
|
||||
desc = "保存快照时是否提示\"正在保存快照\"",
|
||||
desc = "保存快照时提示\"正在保存快照\"",
|
||||
checked = store.showSaveSnapshotToast
|
||||
) {
|
||||
storeFlow.value = store.copy(
|
||||
|
@ -410,7 +434,8 @@ fun AdvancedPage() {
|
|||
color = MaterialTheme.colorScheme.primary,
|
||||
)
|
||||
|
||||
TextSwitch(name = "保存日志",
|
||||
TextSwitch(
|
||||
name = "保存日志",
|
||||
desc = "保存7天日志,帮助定位BUG",
|
||||
checked = store.log2FileSwitch,
|
||||
onCheckedChange = {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package li.songe.gkd.ui.component
|
||||
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.ColumnScope
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.width
|
||||
|
@ -19,6 +20,7 @@ fun TextSwitch(
|
|||
modifier: Modifier = Modifier,
|
||||
name: String,
|
||||
desc: String? = null,
|
||||
descContent: (@Composable ColumnScope.() -> Unit)? = null,
|
||||
checked: Boolean = true,
|
||||
enabled: Boolean = true,
|
||||
onCheckedChange: ((Boolean) -> Unit)? = null,
|
||||
|
@ -38,6 +40,8 @@ fun TextSwitch(
|
|||
style = MaterialTheme.typography.bodyMedium,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
)
|
||||
} else if (descContent != null) {
|
||||
descContent()
|
||||
}
|
||||
}
|
||||
Spacer(modifier = Modifier.width(10.dp))
|
||||
|
|
|
@ -8,6 +8,7 @@ import androidx.compose.foundation.layout.Spacer
|
|||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.width
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.material.icons.Icons
|
||||
|
@ -32,6 +33,8 @@ import androidx.compose.ui.Alignment
|
|||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.input.nestedscroll.nestedScroll
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.text.style.TextDecoration
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.hilt.navigation.compose.hiltViewModel
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import com.ramcosta.composedestinations.navigation.navigate
|
||||
|
@ -229,7 +232,27 @@ fun useSettingsPage(): ScaffoldExt {
|
|||
if (store.toastWhenClick) {
|
||||
TextSwitch(
|
||||
name = "系统提示",
|
||||
desc = "系统样式触发提示,频率较高时不显示",
|
||||
descContent = {
|
||||
Row {
|
||||
Text(
|
||||
text = "系统样式触发提示",
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
)
|
||||
Spacer(modifier = Modifier.width(2.dp))
|
||||
Text(
|
||||
text = "查看限制",
|
||||
style = MaterialTheme.typography.bodyMedium.copy(textDecoration = TextDecoration.Underline),
|
||||
color = MaterialTheme.colorScheme.primary,
|
||||
modifier = Modifier.clickable(onClick = throttle {
|
||||
mainVm.dialogFlow.updateDialogOptions(
|
||||
title = "限制说明",
|
||||
text = "系统 Toast 存在频率限制, 触发过于频繁会被系统强制不显示\n\n如果只使用开屏一类低频率规则可使用系统提示, 否则建议关闭此项使用自定义样式提示",
|
||||
)
|
||||
})
|
||||
)
|
||||
}
|
||||
},
|
||||
checked = store.useSystemToast,
|
||||
onCheckedChange = {
|
||||
storeFlow.value = store.copy(
|
||||
|
|
Loading…
Reference in New Issue
Block a user