Skip to content

Commit

Permalink
perf: font, icon
Browse files Browse the repository at this point in the history
  • Loading branch information
lisonge committed Jun 10, 2024
1 parent 59ad7b7 commit e13b3b7
Show file tree
Hide file tree
Showing 7 changed files with 143 additions and 100 deletions.
15 changes: 9 additions & 6 deletions app/src/main/kotlin/li/songe/gkd/ui/AdvancedPage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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(
Expand Down Expand Up @@ -247,7 +247,7 @@ fun AdvancedPage() {
Text(
text = "快照",
modifier = Modifier.itemPadding(),
style = MaterialTheme.typography.titleMedium,
style = MaterialTheme.typography.titleSmall,
color = MaterialTheme.colorScheme.primary,
)

Expand Down Expand Up @@ -337,7 +337,7 @@ fun AdvancedPage() {
Text(
text = "其它",
modifier = Modifier.itemPadding(),
style = MaterialTheme.typography.titleMedium,
style = MaterialTheme.typography.titleSmall,
color = MaterialTheme.colorScheme.primary,
)

Expand All @@ -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)
},
Expand All @@ -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(
Expand Down
42 changes: 28 additions & 14 deletions app/src/main/kotlin/li/songe/gkd/ui/AppConfigPage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 }
Expand Down Expand Up @@ -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(
Expand Down
51 changes: 29 additions & 22 deletions app/src/main/kotlin/li/songe/gkd/ui/GlobalRuleExcludePage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
48 changes: 27 additions & 21 deletions app/src/main/kotlin/li/songe/gkd/ui/SubsPage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Loading

0 comments on commit e13b3b7

Please sign in to comment.