@@ -354,7 +354,7 @@ private fun StatusCard(
|
||||
}
|
||||
}
|
||||
.padding(24.dp),
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
verticalAlignment = Alignment.Top
|
||||
) {
|
||||
when {
|
||||
systemStatus.ksuVersion != null -> {
|
||||
@@ -366,8 +366,8 @@ private fun StatusCard(
|
||||
|
||||
val workingModeSurfaceText = when {
|
||||
systemStatus.lkmMode == true -> "LKM"
|
||||
systemStatus.lkmMode == null && systemStatus.kernelVersion.isGKI1() -> "GKI-1.0"
|
||||
systemStatus.lkmMode == false || systemStatus.kernelVersion.isGKI() -> "GKI-2.0"
|
||||
systemStatus.lkmMode == null && systemStatus.kernelVersion.isGKI1() -> "GKI 1.0"
|
||||
systemStatus.lkmMode == false || systemStatus.kernelVersion.isGKI() -> "GKI 2.0"
|
||||
else -> "N-GKI"
|
||||
}
|
||||
|
||||
@@ -375,7 +375,11 @@ private fun StatusCard(
|
||||
Icons.Outlined.TaskAlt,
|
||||
contentDescription = stringResource(R.string.home_working),
|
||||
tint = MaterialTheme.colorScheme.primary,
|
||||
modifier = Modifier.size(24.dp)
|
||||
modifier = Modifier
|
||||
.size(28.dp)
|
||||
.padding(
|
||||
horizontal = 4.dp
|
||||
),
|
||||
)
|
||||
|
||||
Column(Modifier.padding(start = 20.dp)) {
|
||||
@@ -386,6 +390,7 @@ private fun StatusCard(
|
||||
Text(
|
||||
text = workingModeText,
|
||||
style = MaterialTheme.typography.titleMedium,
|
||||
color = MaterialTheme.colorScheme.primary,
|
||||
)
|
||||
|
||||
Spacer(Modifier.width(8.dp))
|
||||
@@ -399,7 +404,8 @@ private fun StatusCard(
|
||||
Text(
|
||||
text = workingModeSurfaceText,
|
||||
style = MaterialTheme.typography.labelMedium,
|
||||
modifier = Modifier.padding(horizontal = 6.dp, vertical = 2.dp)
|
||||
modifier = Modifier.padding(horizontal = 6.dp, vertical = 2.dp),
|
||||
color = MaterialTheme.colorScheme.onPrimary
|
||||
)
|
||||
}
|
||||
|
||||
@@ -418,7 +424,8 @@ private fun StatusCard(
|
||||
modifier = Modifier.padding(
|
||||
horizontal = 6.dp,
|
||||
vertical = 2.dp
|
||||
)
|
||||
),
|
||||
color = MaterialTheme.colorScheme.onPrimary
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -438,6 +445,7 @@ private fun StatusCard(
|
||||
Text(
|
||||
text = stringResource(R.string.home_working_version, systemStatus.ksuVersion),
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
color = MaterialTheme.colorScheme.secondary,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -446,12 +454,14 @@ private fun StatusCard(
|
||||
Text(
|
||||
text = stringResource(R.string.home_superuser_count, getSuperuserCount()),
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
color = MaterialTheme.colorScheme.secondary,
|
||||
)
|
||||
|
||||
Spacer(Modifier.height(4.dp))
|
||||
Text(
|
||||
text = stringResource(R.string.home_module_count, getModuleCount()),
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
color = MaterialTheme.colorScheme.secondary,
|
||||
)
|
||||
|
||||
val kpmVersion = getKpmVersion()
|
||||
@@ -460,6 +470,7 @@ private fun StatusCard(
|
||||
Text(
|
||||
text = stringResource(R.string.home_kpm_module, getKpmModuleCount()),
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
color = MaterialTheme.colorScheme.secondary,
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -471,19 +482,25 @@ private fun StatusCard(
|
||||
Icons.Outlined.Warning,
|
||||
contentDescription = stringResource(R.string.home_not_installed),
|
||||
tint = MaterialTheme.colorScheme.error,
|
||||
modifier = Modifier.size(24.dp)
|
||||
modifier = Modifier
|
||||
.size(28.dp)
|
||||
.padding(
|
||||
horizontal = 4.dp
|
||||
),
|
||||
)
|
||||
|
||||
Column(Modifier.padding(start = 20.dp)) {
|
||||
Text(
|
||||
text = stringResource(R.string.home_not_installed),
|
||||
style = MaterialTheme.typography.titleMedium,
|
||||
color = MaterialTheme.colorScheme.error
|
||||
)
|
||||
|
||||
Spacer(Modifier.height(4.dp))
|
||||
Text(
|
||||
text = stringResource(R.string.home_click_to_install),
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
color = MaterialTheme.colorScheme.onErrorContainer
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -493,19 +510,25 @@ private fun StatusCard(
|
||||
Icons.Outlined.Block,
|
||||
contentDescription = stringResource(R.string.home_unsupported),
|
||||
tint = MaterialTheme.colorScheme.error,
|
||||
modifier = Modifier.size(24.dp)
|
||||
modifier = Modifier
|
||||
.size(28.dp)
|
||||
.padding(
|
||||
horizontal = 4.dp
|
||||
),
|
||||
)
|
||||
|
||||
Column(Modifier.padding(start = 20.dp)) {
|
||||
Text(
|
||||
text = stringResource(R.string.home_unsupported),
|
||||
style = MaterialTheme.typography.titleMedium,
|
||||
color = MaterialTheme.colorScheme.error
|
||||
)
|
||||
|
||||
Spacer(Modifier.height(4.dp))
|
||||
Text(
|
||||
text = stringResource(R.string.home_unsupported_reason),
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
color = MaterialTheme.colorScheme.onErrorContainer
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -667,7 +690,7 @@ private fun InfoCard(
|
||||
icon: ImageVector = Icons.Default.Info
|
||||
) {
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
verticalAlignment = Alignment.Top,
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(vertical = 8.dp)
|
||||
@@ -675,7 +698,9 @@ private fun InfoCard(
|
||||
Icon(
|
||||
imageVector = icon,
|
||||
contentDescription = label,
|
||||
modifier = Modifier.size(24.dp),
|
||||
modifier = Modifier
|
||||
.size(28.dp)
|
||||
.padding(vertical = 4.dp),
|
||||
tint = MaterialTheme.colorScheme.primary,
|
||||
)
|
||||
Spacer(modifier = Modifier.width(16.dp))
|
||||
|
||||
@@ -88,6 +88,7 @@ import com.sukisu.ultra.ui.theme.getCardElevation
|
||||
import androidx.compose.material3.RadioButton
|
||||
import androidx.compose.material3.TextButton
|
||||
import androidx.compose.runtime.saveable.rememberSaveable
|
||||
import androidx.compose.ui.unit.sp
|
||||
|
||||
/**
|
||||
* @author ShirkNeko
|
||||
@@ -1245,10 +1246,10 @@ fun SettingItem(
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.height(if (subtitle != null) SETTINGS_ITEM_HEIGHT + 12.dp else SETTINGS_ITEM_HEIGHT)
|
||||
// .height(if (subtitle != null) SETTINGS_ITEM_HEIGHT + 12.dp else SETTINGS_ITEM_HEIGHT)
|
||||
.clickable(onClick = onClick)
|
||||
.padding(horizontal = 16.dp),
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
.padding(horizontal = 16.dp, vertical = 5.dp),
|
||||
verticalAlignment = Alignment.Top
|
||||
) {
|
||||
Icon(
|
||||
imageVector = icon,
|
||||
@@ -1296,10 +1297,10 @@ fun SwitchSettingItem(
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.height(if (summary != null) SETTINGS_ITEM_HEIGHT + 12.dp else SETTINGS_ITEM_HEIGHT)
|
||||
// .height(if (summary != null) SETTINGS_ITEM_HEIGHT + 12.dp else SETTINGS_ITEM_HEIGHT)
|
||||
.clickable { onChange(!checked) }
|
||||
.padding(horizontal = 16.dp),
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
.padding(horizontal = 16.dp, vertical = 10.dp),
|
||||
verticalAlignment = Alignment.Top
|
||||
) {
|
||||
Icon(
|
||||
imageVector = icon,
|
||||
@@ -1317,8 +1318,9 @@ fun SwitchSettingItem(
|
||||
Text(
|
||||
text = title,
|
||||
style = MaterialTheme.typography.titleMedium,
|
||||
maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis
|
||||
lineHeight = 20.sp,
|
||||
// maxLines = 1,
|
||||
// overflow = TextOverflow.Ellipsis
|
||||
)
|
||||
if (summary != null) {
|
||||
Spacer(modifier = Modifier.height(2.dp))
|
||||
@@ -1326,8 +1328,9 @@ fun SwitchSettingItem(
|
||||
text = summary,
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
maxLines = 2,
|
||||
overflow = TextOverflow.Ellipsis
|
||||
lineHeight = 16.sp,
|
||||
// maxLines = 2,
|
||||
// overflow = TextOverflow.Ellipsis
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,6 +85,7 @@ fun SettingScreen(navigator: DestinationsNavigator) {
|
||||
}
|
||||
|
||||
Scaffold(
|
||||
// containerColor = MaterialTheme.colorScheme.surfaceBright,
|
||||
topBar = {
|
||||
TopBar(scrollBehavior = scrollBehavior)
|
||||
},
|
||||
@@ -351,7 +352,7 @@ private fun SettingsGroupCard(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = SPACING_LARGE, vertical = SPACING_MEDIUM),
|
||||
colors = getCardColors(MaterialTheme.colorScheme.surfaceContainerHigh),
|
||||
colors = getCardColors(MaterialTheme.colorScheme.surfaceContainerLow),
|
||||
elevation = getCardElevation()
|
||||
) {
|
||||
Column(
|
||||
@@ -360,7 +361,8 @@ private fun SettingsGroupCard(
|
||||
Text(
|
||||
text = title,
|
||||
style = MaterialTheme.typography.titleMedium,
|
||||
modifier = Modifier.padding(horizontal = SPACING_LARGE, vertical = SPACING_MEDIUM)
|
||||
modifier = Modifier.padding(horizontal = SPACING_LARGE, vertical = SPACING_MEDIUM),
|
||||
color = MaterialTheme.colorScheme.primary
|
||||
)
|
||||
content()
|
||||
}
|
||||
@@ -502,7 +504,7 @@ fun SettingItem(
|
||||
.fillMaxWidth()
|
||||
.clickable(onClick = onClick)
|
||||
.padding(horizontal = SPACING_LARGE, vertical = 12.dp),
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
verticalAlignment = Alignment.Top
|
||||
) {
|
||||
Icon(
|
||||
imageVector = icon,
|
||||
@@ -548,7 +550,7 @@ fun SwitchItem(
|
||||
.fillMaxWidth()
|
||||
.clickable { onCheckedChange(!checked) }
|
||||
.padding(horizontal = SPACING_LARGE, vertical = 12.dp),
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
verticalAlignment = Alignment.Top
|
||||
) {
|
||||
Icon(
|
||||
imageVector = icon,
|
||||
@@ -797,4 +799,4 @@ private fun TopBar(
|
||||
windowInsets = WindowInsets.safeDrawing.only(WindowInsetsSides.Top + WindowInsetsSides.Horizontal),
|
||||
scrollBehavior = scrollBehavior
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ object CardConfig {
|
||||
// 卡片亮度
|
||||
var cardDim by mutableFloatStateOf(0f)
|
||||
// 卡片阴影
|
||||
var cardElevation by mutableStateOf(4.dp)
|
||||
var cardElevation by mutableStateOf(0.dp)
|
||||
var isShadowEnabled by mutableStateOf(true)
|
||||
var isCustomAlphaSet by mutableStateOf(false)
|
||||
var isCustomDimSet by mutableStateOf(false)
|
||||
@@ -65,13 +65,7 @@ object CardConfig {
|
||||
*/
|
||||
fun updateShadowEnabled(enabled: Boolean) {
|
||||
isShadowEnabled = enabled
|
||||
cardElevation = if (isCustomBackgroundEnabled) {
|
||||
0.dp
|
||||
} else if (enabled) {
|
||||
4.dp
|
||||
} else {
|
||||
0.dp
|
||||
}
|
||||
cardElevation = 0.dp
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -103,11 +97,11 @@ fun getCardColors(originalColor: Color) = CardDefaults.cardColors(
|
||||
@Composable
|
||||
fun getCardElevation() = CardDefaults.cardElevation(
|
||||
defaultElevation = CardConfig.cardElevation,
|
||||
pressedElevation = if (CardConfig.isCustomBackgroundEnabled) 0.dp else 8.dp,
|
||||
focusedElevation = if (CardConfig.isCustomBackgroundEnabled) 0.dp else 6.dp,
|
||||
hoveredElevation = if (CardConfig.isCustomBackgroundEnabled) 0.dp else 4.dp,
|
||||
draggedElevation = if (CardConfig.isCustomBackgroundEnabled) 0.dp else 8.dp,
|
||||
disabledElevation = 0.dp
|
||||
pressedElevation = CardConfig.cardElevation,
|
||||
focusedElevation = CardConfig.cardElevation,
|
||||
hoveredElevation = CardConfig.cardElevation,
|
||||
draggedElevation = CardConfig.cardElevation,
|
||||
disabledElevation = CardConfig.cardElevation
|
||||
)
|
||||
|
||||
/**
|
||||
|
||||
@@ -294,8 +294,8 @@ private fun createDynamicDarkColorScheme(context: Context): ColorScheme {
|
||||
return scheme.copy(
|
||||
background = if (CardConfig.isCustomBackgroundEnabled) Color.Transparent else scheme.background,
|
||||
surface = if (CardConfig.isCustomBackgroundEnabled) Color.Transparent else scheme.surface,
|
||||
onBackground = Color.White,
|
||||
onSurface = Color.White
|
||||
onBackground = scheme.onBackground,
|
||||
onSurface = scheme.onSurface
|
||||
)
|
||||
}
|
||||
|
||||
@@ -308,7 +308,9 @@ private fun createDynamicLightColorScheme(context: Context): ColorScheme {
|
||||
val scheme = dynamicLightColorScheme(context)
|
||||
return scheme.copy(
|
||||
background = if (CardConfig.isCustomBackgroundEnabled) Color.Transparent else scheme.background,
|
||||
surface = if (CardConfig.isCustomBackgroundEnabled) Color.Transparent else scheme.surface
|
||||
surface = if (CardConfig.isCustomBackgroundEnabled) Color.Transparent else scheme.surface,
|
||||
onBackground = scheme.onBackground,
|
||||
onSurface = scheme.onSurface
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user