mirror of
https://github.com/gkd-kit/gkd.git
synced 2024-11-16 11:42:22 +08:00
perf: app item padding
This commit is contained in:
parent
747a20ac3c
commit
d48ae8d251
|
@ -70,7 +70,7 @@ import li.songe.gkd.data.stringify
|
|||
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.itemPadding
|
||||
import li.songe.gkd.ui.style.appItemPadding
|
||||
import li.songe.gkd.util.LocalNavController
|
||||
import li.songe.gkd.util.ProfileTransitions
|
||||
import li.songe.gkd.util.SortTypeOption
|
||||
|
@ -247,7 +247,7 @@ fun GlobalRuleExcludePage(subsItemId: Long, groupKey: Int) {
|
|||
Row(
|
||||
modifier = Modifier
|
||||
.height(IntrinsicSize.Min)
|
||||
.itemPadding(),
|
||||
.appItemPadding(),
|
||||
horizontalArrangement = Arrangement.SpaceBetween,
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
) {
|
||||
|
@ -314,29 +314,33 @@ fun GlobalRuleExcludePage(subsItemId: Long, groupKey: Int) {
|
|||
|
||||
if (group != null) {
|
||||
val checked = getChecked(excludeData, group, appInfo.id, appInfo)
|
||||
Switch(
|
||||
checked = checked ?: false,
|
||||
onCheckedChange = {
|
||||
if (checked == null) {
|
||||
toast("内置禁用,不可修改")
|
||||
return@Switch
|
||||
}
|
||||
vm.viewModelScope.launchTry {
|
||||
val subsConfig = (vm.subsConfigFlow.value ?: SubsConfig(
|
||||
type = SubsConfig.GlobalGroupType,
|
||||
subsItemId = subsItemId,
|
||||
groupKey = groupKey,
|
||||
)).copy(
|
||||
exclude = excludeData.copy(
|
||||
appIds = excludeData.appIds.toMutableMap().apply {
|
||||
set(appInfo.id, !it)
|
||||
})
|
||||
.stringify()
|
||||
)
|
||||
DbSet.subsConfigDao.insert(subsConfig)
|
||||
}
|
||||
},
|
||||
)
|
||||
if (checked != null) {
|
||||
Switch(
|
||||
checked = checked,
|
||||
onCheckedChange = {
|
||||
vm.viewModelScope.launchTry {
|
||||
val subsConfig = (vm.subsConfigFlow.value ?: SubsConfig(
|
||||
type = SubsConfig.GlobalGroupType,
|
||||
subsItemId = subsItemId,
|
||||
groupKey = groupKey,
|
||||
)).copy(
|
||||
exclude = excludeData.copy(
|
||||
appIds = excludeData.appIds.toMutableMap().apply {
|
||||
set(appInfo.id, !it)
|
||||
})
|
||||
.stringify()
|
||||
)
|
||||
DbSet.subsConfigDao.insert(subsConfig)
|
||||
}
|
||||
},
|
||||
)
|
||||
} else {
|
||||
Switch(
|
||||
enabled = false,
|
||||
checked = false,
|
||||
onCheckedChange = {},
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,6 +40,7 @@ import com.google.accompanist.drawablepainter.rememberDrawablePainter
|
|||
import li.songe.gkd.data.AppInfo
|
||||
import li.songe.gkd.data.RawSubscription
|
||||
import li.songe.gkd.data.SubsConfig
|
||||
import li.songe.gkd.ui.style.appItemPadding
|
||||
import li.songe.gkd.util.encodeToJson5String
|
||||
import li.songe.gkd.util.json
|
||||
import li.songe.gkd.util.toast
|
||||
|
@ -63,7 +64,7 @@ fun SubsAppCard(
|
|||
onClick?.invoke()
|
||||
}
|
||||
.height(IntrinsicSize.Min)
|
||||
.padding(10.dp, 6.dp),
|
||||
.appItemPadding(),
|
||||
horizontalArrangement = Arrangement.SpaceBetween,
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
) {
|
||||
|
|
|
@ -69,6 +69,7 @@ import li.songe.gkd.permission.canQueryPkgState
|
|||
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.util.LocalNavController
|
||||
import li.songe.gkd.util.SortTypeOption
|
||||
import li.songe.gkd.util.appRefreshingFlow
|
||||
|
@ -285,7 +286,7 @@ fun useAppListPage(): ScaffoldExt {
|
|||
navController.navigate(AppConfigPageDestination(appInfo.id))
|
||||
}
|
||||
.height(IntrinsicSize.Min)
|
||||
.padding(10.dp, 6.dp),
|
||||
.appItemPadding(),
|
||||
horizontalArrangement = Arrangement.SpaceBetween,
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
) {
|
||||
|
|
|
@ -5,3 +5,5 @@ 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)
|
||||
|
|
Loading…
Reference in New Issue
Block a user