diff --git a/app/src/main/kotlin/li/songe/gkd/ui/AdvancedPage.kt b/app/src/main/kotlin/li/songe/gkd/ui/AdvancedPage.kt index 774cadf..a6d247e 100644 --- a/app/src/main/kotlin/li/songe/gkd/ui/AdvancedPage.kt +++ b/app/src/main/kotlin/li/songe/gkd/ui/AdvancedPage.kt @@ -126,7 +126,7 @@ fun AdvancedPage() { Text( text = "Shizuku", modifier = Modifier.itemPadding(), - style = MaterialTheme.typography.titleMedium, + style = MaterialTheme.typography.titleSmall, color = MaterialTheme.colorScheme.primary, ) val shizukuOk by shizukuOkState.stateFlow.collectAsState() @@ -152,7 +152,7 @@ fun AdvancedPage() { Text( text = "HTTP服务", modifier = Modifier.itemPadding(), - style = MaterialTheme.typography.titleMedium, + style = MaterialTheme.typography.titleSmall, color = MaterialTheme.colorScheme.primary, ) Row( @@ -247,7 +247,7 @@ fun AdvancedPage() { Text( text = "快照", modifier = Modifier.itemPadding(), - style = MaterialTheme.typography.titleMedium, + style = MaterialTheme.typography.titleSmall, color = MaterialTheme.colorScheme.primary, ) @@ -337,7 +337,7 @@ fun AdvancedPage() { Text( text = "其它", modifier = Modifier.itemPadding(), - style = MaterialTheme.typography.titleMedium, + style = MaterialTheme.typography.titleSmall, color = MaterialTheme.colorScheme.primary, ) @@ -359,9 +359,12 @@ fun AdvancedPage() { var value by remember { mutableStateOf(store.httpServerPort.toString()) } - AlertDialog(title = { Text(text = "请输入新端口") }, text = { + AlertDialog(title = { Text(text = "服务端口") }, text = { OutlinedTextField( value = value, + placeholder = { + Text(text = "请输入 5000-65535 的整数") + }, onValueChange = { value = it.filter { c -> c.isDigit() }.take(5) }, @@ -382,7 +385,7 @@ fun AdvancedPage() { onClick = { val newPort = value.toIntOrNull() if (newPort == null || !(5000 <= newPort && newPort <= 65535)) { - toast("请输入在 5000~65535 的任意数字") + toast("请输入 5000-65535 的整数") return@TextButton } storeFlow.value = store.copy( diff --git a/app/src/main/kotlin/li/songe/gkd/ui/AppConfigPage.kt b/app/src/main/kotlin/li/songe/gkd/ui/AppConfigPage.kt index 8137c11..577f9ec 100644 --- a/app/src/main/kotlin/li/songe/gkd/ui/AppConfigPage.kt +++ b/app/src/main/kotlin/li/songe/gkd/ui/AppConfigPage.kt @@ -58,6 +58,7 @@ import li.songe.gkd.db.DbSet import li.songe.gkd.ui.destinations.AppItemPageDestination import li.songe.gkd.ui.destinations.GlobalRulePageDestination import li.songe.gkd.ui.style.itemPadding +import li.songe.gkd.ui.style.menuPadding import li.songe.gkd.util.LOCAL_SUBS_ID import li.songe.gkd.util.LocalNavController import li.songe.gkd.util.ProfileTransitions @@ -124,20 +125,24 @@ fun AppConfigPage(appId: String) { expanded = expanded, onDismissRequest = { expanded = false } ) { + Text( + text = "排序", + modifier = Modifier.menuPadding(), + style = MaterialTheme.typography.labelMedium, + color = MaterialTheme.colorScheme.primary, + ) RuleSortOption.allSubObject.forEach { s -> DropdownMenuItem( text = { - Row( - verticalAlignment = Alignment.CenterVertically - ) { - RadioButton( - selected = ruleSortType == s, - onClick = { - vm.ruleSortTypeFlow.update { s } - } - ) - Text(s.label) - } + Text(s.label) + }, + trailingIcon = { + RadioButton( + selected = ruleSortType == s, + onClick = { + vm.ruleSortTypeFlow.update { s } + } + ) }, onClick = { vm.ruleSortTypeFlow.update { s } @@ -171,9 +176,18 @@ fun AppConfigPage(appId: String) { ExcludeData.parse(g.config?.exclude) } val checked = getChecked(excludeData, g.group, appId, appInfo) - AppGroupCard(g.group, checked, onClick = { - navController.navigate(GlobalRulePageDestination(g.subsItem.id, g.group.key)) - }) { newChecked -> + AppGroupCard( + group = g.group, + checked = checked, + onClick = { + navController.navigate( + GlobalRulePageDestination( + g.subsItem.id, + g.group.key + ) + ) + } + ) { newChecked -> vm.viewModelScope.launchTry { DbSet.subsConfigDao.insert( (g.config ?: SubsConfig( diff --git a/app/src/main/kotlin/li/songe/gkd/ui/GlobalRuleExcludePage.kt b/app/src/main/kotlin/li/songe/gkd/ui/GlobalRuleExcludePage.kt index 56fadd0..64f48fd 100644 --- a/app/src/main/kotlin/li/songe/gkd/ui/GlobalRuleExcludePage.kt +++ b/app/src/main/kotlin/li/songe/gkd/ui/GlobalRuleExcludePage.kt @@ -28,7 +28,6 @@ import androidx.compose.material3.AlertDialog import androidx.compose.material3.Checkbox import androidx.compose.material3.DropdownMenu import androidx.compose.material3.DropdownMenuItem -import androidx.compose.material3.HorizontalDivider import androidx.compose.material3.Icon import androidx.compose.material3.IconButton import androidx.compose.material3.MaterialTheme @@ -71,6 +70,7 @@ import li.songe.gkd.db.DbSet import li.songe.gkd.service.launcherAppId import li.songe.gkd.ui.component.AppBarTextField import li.songe.gkd.ui.style.appItemPadding +import li.songe.gkd.ui.style.menuPadding import li.songe.gkd.util.LocalNavController import li.songe.gkd.util.ProfileTransitions import li.songe.gkd.util.SortTypeOption @@ -182,38 +182,45 @@ fun GlobalRuleExcludePage(subsItemId: Long, groupKey: Int) { expanded = expanded, onDismissRequest = { expanded = false } ) { + Text( + text = "排序", + modifier = Modifier.menuPadding(), + style = MaterialTheme.typography.labelMedium, + color = MaterialTheme.colorScheme.primary, + ) SortTypeOption.allSubObject.forEach { sortOption -> DropdownMenuItem( text = { - Row( - verticalAlignment = Alignment.CenterVertically - ) { - RadioButton(selected = sortType == sortOption, - onClick = { - vm.sortTypeFlow.value = sortOption - } - ) - Text(sortOption.label) - } + Text(sortOption.label) + }, + trailingIcon = { + RadioButton(selected = sortType == sortOption, + onClick = { + vm.sortTypeFlow.value = sortOption + } + ) }, onClick = { vm.sortTypeFlow.value = sortOption }, ) } - HorizontalDivider() + Text( + text = "选项", + modifier = Modifier.menuPadding(), + style = MaterialTheme.typography.labelMedium, + color = MaterialTheme.colorScheme.primary, + ) DropdownMenuItem( text = { - Row( - verticalAlignment = Alignment.CenterVertically - ) { - Checkbox( - checked = showSystemApp, - onCheckedChange = { - vm.showSystemAppFlow.value = !vm.showSystemAppFlow.value - }) - Text("显示系统应用") - } + Text("显示系统应用") + }, + trailingIcon = { + Checkbox( + checked = showSystemApp, + onCheckedChange = { + vm.showSystemAppFlow.value = !vm.showSystemAppFlow.value + }) }, onClick = { vm.showSystemAppFlow.value = !vm.showSystemAppFlow.value diff --git a/app/src/main/kotlin/li/songe/gkd/ui/SubsPage.kt b/app/src/main/kotlin/li/songe/gkd/ui/SubsPage.kt index e492073..09c8597 100644 --- a/app/src/main/kotlin/li/songe/gkd/ui/SubsPage.kt +++ b/app/src/main/kotlin/li/songe/gkd/ui/SubsPage.kt @@ -2,7 +2,6 @@ package li.songe.gkd.ui import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height @@ -22,7 +21,6 @@ import androidx.compose.material3.Checkbox import androidx.compose.material3.DropdownMenu import androidx.compose.material3.DropdownMenuItem import androidx.compose.material3.FloatingActionButton -import androidx.compose.material3.HorizontalDivider import androidx.compose.material3.Icon import androidx.compose.material3.IconButton import androidx.compose.material3.MaterialTheme @@ -62,6 +60,7 @@ import li.songe.gkd.ui.component.AppBarTextField import li.songe.gkd.ui.component.SubsAppCard import li.songe.gkd.ui.component.getDialogResult import li.songe.gkd.ui.destinations.AppItemPageDestination +import li.songe.gkd.ui.style.menuPadding import li.songe.gkd.util.LocalNavController import li.songe.gkd.util.ProfileTransitions import li.songe.gkd.util.SortTypeOption @@ -186,36 +185,43 @@ fun SubsPage( modifier = Modifier.wrapContentSize(Alignment.TopStart) ) { DropdownMenu(expanded = expanded, onDismissRequest = { expanded = false }) { + Text( + text = "排序", + modifier = Modifier.menuPadding(), + style = MaterialTheme.typography.labelMedium, + color = MaterialTheme.colorScheme.primary, + ) SortTypeOption.allSubObject.forEach { sortOption -> DropdownMenuItem( text = { - Row( - verticalAlignment = Alignment.CenterVertically - ) { - RadioButton( - selected = sortType == sortOption, - onClick = { - vm.sortTypeFlow.value = sortOption - }) - Text(sortOption.label) - } + Text(sortOption.label) + }, + trailingIcon = { + RadioButton( + selected = sortType == sortOption, + onClick = { + vm.sortTypeFlow.value = sortOption + }) }, onClick = { vm.sortTypeFlow.value = sortOption }, ) } - HorizontalDivider() + Text( + text = "选项", + modifier = Modifier.menuPadding(), + style = MaterialTheme.typography.labelMedium, + color = MaterialTheme.colorScheme.primary, + ) DropdownMenuItem( text = { - Row( - verticalAlignment = Alignment.CenterVertically - ) { - Checkbox(checked = showUninstallApp, onCheckedChange = { - vm.showUninstallAppFlow.value = it - }) - Text("显示未安装应用") - } + Text("显示未安装应用") + }, + trailingIcon = { + Checkbox(checked = showUninstallApp, onCheckedChange = { + vm.showUninstallAppFlow.value = it + }) }, onClick = { vm.showUninstallAppFlow.value = !showUninstallApp diff --git a/app/src/main/kotlin/li/songe/gkd/ui/home/AppListPage.kt b/app/src/main/kotlin/li/songe/gkd/ui/home/AppListPage.kt index 3e17bf9..3aeb79a 100644 --- a/app/src/main/kotlin/li/songe/gkd/ui/home/AppListPage.kt +++ b/app/src/main/kotlin/li/songe/gkd/ui/home/AppListPage.kt @@ -31,7 +31,6 @@ import androidx.compose.material3.Checkbox import androidx.compose.material3.CircularProgressIndicator import androidx.compose.material3.DropdownMenu import androidx.compose.material3.DropdownMenuItem -import androidx.compose.material3.HorizontalDivider import androidx.compose.material3.Icon import androidx.compose.material3.IconButton import androidx.compose.material3.MaterialTheme @@ -70,6 +69,7 @@ import li.songe.gkd.permission.checkOrRequestPermission import li.songe.gkd.ui.component.AppBarTextField import li.songe.gkd.ui.destinations.AppConfigPageDestination import li.songe.gkd.ui.style.appItemPadding +import li.songe.gkd.ui.style.menuPadding import li.songe.gkd.util.LocalNavController import li.songe.gkd.util.SortTypeOption import li.songe.gkd.util.appRefreshingFlow @@ -213,38 +213,46 @@ fun useAppListPage(): ScaffoldExt { expanded = expanded, onDismissRequest = { expanded = false } ) { + Text( + text = "排序", + modifier = Modifier.menuPadding(), + style = MaterialTheme.typography.labelMedium, + color = MaterialTheme.colorScheme.primary, + ) SortTypeOption.allSubObject.forEach { sortOption -> DropdownMenuItem( text = { - Row( - verticalAlignment = Alignment.CenterVertically - ) { - RadioButton(selected = sortType == sortOption, - onClick = { - storeFlow.update { s -> s.copy(sortType = sortOption.value) } - } - ) - Text(sortOption.label) - } + Text(sortOption.label) + }, + trailingIcon = { + RadioButton(selected = sortType == sortOption, + onClick = { + storeFlow.update { s -> s.copy(sortType = sortOption.value) } + } + ) }, onClick = { storeFlow.update { s -> s.copy(sortType = sortOption.value) } }, ) } - HorizontalDivider() + Text( + text = "选项", + modifier = Modifier.menuPadding(), + style = MaterialTheme.typography.labelMedium, + color = MaterialTheme.colorScheme.primary, + ) DropdownMenuItem( text = { - Row( - verticalAlignment = Alignment.CenterVertically - ) { - Checkbox( - checked = showSystemApp, - onCheckedChange = { - storeFlow.update { s -> s.copy(showSystemApp = !showSystemApp) } - }) - Text("显示系统应用") - } + Text("显示系统应用") + }, + trailingIcon = { + Checkbox( + checked = showSystemApp, + onCheckedChange = { + storeFlow.update { s -> s.copy(showSystemApp = !showSystemApp) } + } + ) }, onClick = { storeFlow.update { s -> s.copy(showSystemApp = !showSystemApp) } @@ -252,16 +260,14 @@ fun useAppListPage(): ScaffoldExt { ) DropdownMenuItem( text = { - Row( - verticalAlignment = Alignment.CenterVertically - ) { - Checkbox( - checked = showHiddenApp, - onCheckedChange = { - storeFlow.update { s -> s.copy(showHiddenApp = !s.showHiddenApp) } - }) - Text("显示隐藏应用") - } + Text("显示隐藏应用") + }, + trailingIcon = { + Checkbox( + checked = showHiddenApp, + onCheckedChange = { + storeFlow.update { s -> s.copy(showHiddenApp = !s.showHiddenApp) } + }) }, onClick = { storeFlow.update { s -> s.copy(showHiddenApp = !showHiddenApp) } diff --git a/app/src/main/kotlin/li/songe/gkd/ui/home/SettingsPage.kt b/app/src/main/kotlin/li/songe/gkd/ui/home/SettingsPage.kt index 3cd83d4..5931087 100644 --- a/app/src/main/kotlin/li/songe/gkd/ui/home/SettingsPage.kt +++ b/app/src/main/kotlin/li/songe/gkd/ui/home/SettingsPage.kt @@ -95,9 +95,12 @@ fun useSettingsPage(): ScaffoldExt { mutableStateOf(store.clickToast) } val maxCharLen = 32 - AlertDialog(title = { Text(text = "请输入提示文字") }, text = { + AlertDialog(title = { Text(text = "触发提示") }, text = { OutlinedTextField( value = value, + placeholder = { + Text(text = "请输入提示内容") + }, onValueChange = { value = it.take(maxCharLen) }, @@ -257,7 +260,7 @@ fun useSettingsPage(): ScaffoldExt { Text( text = "常规", modifier = Modifier.itemPadding(), - style = MaterialTheme.typography.titleMedium, + style = MaterialTheme.typography.titleSmall, color = MaterialTheme.colorScheme.primary, ) @@ -309,7 +312,7 @@ fun useSettingsPage(): ScaffoldExt { Text( text = "更新", modifier = Modifier.itemPadding(), - style = MaterialTheme.typography.titleMedium, + style = MaterialTheme.typography.titleSmall, color = MaterialTheme.colorScheme.primary, ) @@ -356,7 +359,7 @@ fun useSettingsPage(): ScaffoldExt { Text( text = "日志", modifier = Modifier.itemPadding(), - style = MaterialTheme.typography.titleMedium, + style = MaterialTheme.typography.titleSmall, color = MaterialTheme.colorScheme.primary, ) @@ -393,7 +396,7 @@ fun useSettingsPage(): ScaffoldExt { Text( text = "其它", modifier = Modifier.itemPadding(), - style = MaterialTheme.typography.titleMedium, + style = MaterialTheme.typography.titleSmall, color = MaterialTheme.colorScheme.primary, ) diff --git a/app/src/main/kotlin/li/songe/gkd/ui/style/Padding.kt b/app/src/main/kotlin/li/songe/gkd/ui/style/Padding.kt index e643bf5..e06d690 100644 --- a/app/src/main/kotlin/li/songe/gkd/ui/style/Padding.kt +++ b/app/src/main/kotlin/li/songe/gkd/ui/style/Padding.kt @@ -1,9 +1,13 @@ package li.songe.gkd.ui.style import androidx.compose.foundation.layout.padding +import androidx.compose.material3.MenuDefaults import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp fun Modifier.itemPadding() = this then padding(16.dp, 12.dp) fun Modifier.appItemPadding() = this then padding(10.dp, 8.dp) + +fun Modifier.menuPadding() = + this then padding(MenuDefaults.DropdownMenuItemContentPadding).padding(vertical = 8.dp)