Adjust the spacing and size of interface elements to optimize the layout effect
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
package com.sukisu.ultra.ui.screen
|
package com.sukisu.ultra.ui.screen
|
||||||
|
|
||||||
import android.R.attr.layerType
|
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
@@ -126,9 +125,9 @@ fun HomeScreen(navigator: DestinationsNavigator) {
|
|||||||
.disableOverscroll()
|
.disableOverscroll()
|
||||||
.nestedScroll(scrollBehavior.nestedScrollConnection)
|
.nestedScroll(scrollBehavior.nestedScrollConnection)
|
||||||
.verticalScroll(rememberScrollState())
|
.verticalScroll(rememberScrollState())
|
||||||
.padding(top = 16.dp)
|
.padding(top = 12.dp)
|
||||||
.padding(horizontal = 16.dp),
|
.padding(horizontal = 16.dp),
|
||||||
verticalArrangement = Arrangement.spacedBy(16.dp)
|
verticalArrangement = Arrangement.spacedBy(12.dp)
|
||||||
) {
|
) {
|
||||||
if (shouldTriggerRestart) {
|
if (shouldTriggerRestart) {
|
||||||
WarningCard(message = "zakozako")
|
WarningCard(message = "zakozako")
|
||||||
@@ -411,7 +410,7 @@ private fun StatusCard(
|
|||||||
Icons.Outlined.CheckCircle,
|
Icons.Outlined.CheckCircle,
|
||||||
contentDescription = stringResource(R.string.home_working),
|
contentDescription = stringResource(R.string.home_working),
|
||||||
tint = MaterialTheme.colorScheme.primary,
|
tint = MaterialTheme.colorScheme.primary,
|
||||||
modifier = Modifier.size(40.dp)
|
modifier = Modifier.size(24.dp)
|
||||||
)
|
)
|
||||||
|
|
||||||
Column(Modifier.padding(start = 20.dp)) {
|
Column(Modifier.padding(start = 20.dp)) {
|
||||||
@@ -482,7 +481,7 @@ private fun StatusCard(
|
|||||||
Icons.Outlined.Warning,
|
Icons.Outlined.Warning,
|
||||||
contentDescription = stringResource(R.string.home_not_installed),
|
contentDescription = stringResource(R.string.home_not_installed),
|
||||||
tint = MaterialTheme.colorScheme.error,
|
tint = MaterialTheme.colorScheme.error,
|
||||||
modifier = Modifier.size(40.dp)
|
modifier = Modifier.size(24.dp)
|
||||||
)
|
)
|
||||||
|
|
||||||
Column(Modifier.padding(start = 20.dp)) {
|
Column(Modifier.padding(start = 20.dp)) {
|
||||||
@@ -506,7 +505,7 @@ private fun StatusCard(
|
|||||||
Icons.Outlined.Block,
|
Icons.Outlined.Block,
|
||||||
contentDescription = stringResource(R.string.home_unsupported),
|
contentDescription = stringResource(R.string.home_unsupported),
|
||||||
tint = MaterialTheme.colorScheme.error,
|
tint = MaterialTheme.colorScheme.error,
|
||||||
modifier = Modifier.size(40.dp)
|
modifier = Modifier.size(24.dp)
|
||||||
)
|
)
|
||||||
|
|
||||||
Column(Modifier.padding(start = 20.dp)) {
|
Column(Modifier.padding(start = 20.dp)) {
|
||||||
@@ -581,6 +580,7 @@ fun ContributionCard() {
|
|||||||
elevation = CardDefaults.cardElevation(defaultElevation = 0.dp),
|
elevation = CardDefaults.cardElevation(defaultElevation = 0.dp),
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
|
.wrapContentHeight()
|
||||||
.clip(MaterialTheme.shapes.large)
|
.clip(MaterialTheme.shapes.large)
|
||||||
.shadow(
|
.shadow(
|
||||||
elevation = 0.dp,
|
elevation = 0.dp,
|
||||||
@@ -604,7 +604,7 @@ fun ContributionCard() {
|
|||||||
tint = MaterialTheme.colorScheme.onTertiaryContainer,
|
tint = MaterialTheme.colorScheme.onTertiaryContainer,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.padding(end = 16.dp)
|
.padding(end = 16.dp)
|
||||||
.size(28.dp)
|
.size(24.dp)
|
||||||
)
|
)
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
@@ -657,7 +657,7 @@ fun LearnMoreCard() {
|
|||||||
tint = MaterialTheme.colorScheme.onPrimaryContainer,
|
tint = MaterialTheme.colorScheme.onPrimaryContainer,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.padding(end = 16.dp)
|
.padding(end = 16.dp)
|
||||||
.size(28.dp)
|
.size(24.dp)
|
||||||
)
|
)
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
@@ -709,7 +709,7 @@ fun DonateCard() {
|
|||||||
tint = MaterialTheme.colorScheme.onSecondaryContainer,
|
tint = MaterialTheme.colorScheme.onSecondaryContainer,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.padding(end = 16.dp)
|
.padding(end = 16.dp)
|
||||||
.size(28.dp)
|
.size(24.dp)
|
||||||
)
|
)
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
@@ -761,21 +761,29 @@ private fun InfoCard() {
|
|||||||
fun InfoCardItem(
|
fun InfoCardItem(
|
||||||
label: String,
|
label: String,
|
||||||
content: String,
|
content: String,
|
||||||
icon: ImageVector = Icons.Default.Info
|
icon: ImageVector = Icons.Default.Info,
|
||||||
|
maxLines: Int = 2,
|
||||||
|
overflow: TextOverflow = TextOverflow.Ellipsis
|
||||||
) {
|
) {
|
||||||
contents.appendLine(label).appendLine(content).appendLine()
|
contents.appendLine(label).appendLine(content).appendLine()
|
||||||
Row(
|
Row(
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
modifier = Modifier.padding(vertical = 8.dp)
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.padding(vertical = 8.dp)
|
||||||
) {
|
) {
|
||||||
Icon(
|
Icon(
|
||||||
imageVector = icon,
|
imageVector = icon,
|
||||||
contentDescription = label,
|
contentDescription = label,
|
||||||
modifier = Modifier.size(28.dp),
|
modifier = Modifier.size(24.dp),
|
||||||
tint = MaterialTheme.colorScheme.primary
|
tint = MaterialTheme.colorScheme.primary
|
||||||
)
|
)
|
||||||
Spacer(modifier = Modifier.width(16.dp))
|
Spacer(modifier = Modifier.width(16.dp))
|
||||||
Column {
|
Column(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.weight(1f)
|
||||||
|
){
|
||||||
Text(
|
Text(
|
||||||
text = label,
|
text = label,
|
||||||
style = MaterialTheme.typography.labelLarge,
|
style = MaterialTheme.typography.labelLarge,
|
||||||
@@ -785,8 +793,7 @@ private fun InfoCard() {
|
|||||||
text = content,
|
text = content,
|
||||||
style = MaterialTheme.typography.bodyMedium,
|
style = MaterialTheme.typography.bodyMedium,
|
||||||
color = MaterialTheme.colorScheme.onSurface,
|
color = MaterialTheme.colorScheme.onSurface,
|
||||||
maxLines = 1,
|
softWrap = true
|
||||||
overflow = TextOverflow.Ellipsis
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -795,7 +802,7 @@ private fun InfoCard() {
|
|||||||
InfoCardItem(
|
InfoCardItem(
|
||||||
stringResource(R.string.home_kernel),
|
stringResource(R.string.home_kernel),
|
||||||
uname.release,
|
uname.release,
|
||||||
icon = Icons.Default.Memory
|
icon = Icons.Default.Memory,
|
||||||
)
|
)
|
||||||
|
|
||||||
if (!isSimpleMode) {
|
if (!isSimpleMode) {
|
||||||
@@ -803,7 +810,7 @@ private fun InfoCard() {
|
|||||||
InfoCardItem(
|
InfoCardItem(
|
||||||
stringResource(R.string.home_android_version),
|
stringResource(R.string.home_android_version),
|
||||||
androidVersion,
|
androidVersion,
|
||||||
icon = Icons.Default.Android
|
icon = Icons.Default.Android,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -811,20 +818,20 @@ private fun InfoCard() {
|
|||||||
InfoCardItem(
|
InfoCardItem(
|
||||||
stringResource(R.string.home_device_model),
|
stringResource(R.string.home_device_model),
|
||||||
deviceModel,
|
deviceModel,
|
||||||
icon = Icons.Default.PhoneAndroid
|
icon = Icons.Default.PhoneAndroid,
|
||||||
)
|
)
|
||||||
|
|
||||||
val managerVersion = getManagerVersion(context)
|
val managerVersion = getManagerVersion(context)
|
||||||
InfoCardItem(
|
InfoCardItem(
|
||||||
stringResource(R.string.home_manager_version),
|
stringResource(R.string.home_manager_version),
|
||||||
"${managerVersion.first} (${managerVersion.second})",
|
"${managerVersion.first} (${managerVersion.second})",
|
||||||
icon = Icons.Default.Settings
|
icon = Icons.Default.Settings,
|
||||||
)
|
)
|
||||||
|
|
||||||
InfoCardItem(
|
InfoCardItem(
|
||||||
stringResource(R.string.home_selinux_status),
|
stringResource(R.string.home_selinux_status),
|
||||||
getSELinuxStatus(),
|
getSELinuxStatus(),
|
||||||
icon = Icons.Default.Security
|
icon = Icons.Default.Security,
|
||||||
)
|
)
|
||||||
|
|
||||||
if (!isSimpleMode) {
|
if (!isSimpleMode) {
|
||||||
@@ -846,7 +853,9 @@ private fun InfoCard() {
|
|||||||
InfoCardItem(
|
InfoCardItem(
|
||||||
stringResource(R.string.home_kpm_version),
|
stringResource(R.string.home_kpm_version),
|
||||||
displayVersion,
|
displayVersion,
|
||||||
icon = Icons.Default.Code
|
icon = Icons.Default.Code,
|
||||||
|
Int.MAX_VALUE,
|
||||||
|
TextOverflow.Clip
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -874,7 +883,9 @@ private fun InfoCard() {
|
|||||||
InfoCardItem(
|
InfoCardItem(
|
||||||
stringResource(R.string.home_susfs_version),
|
stringResource(R.string.home_susfs_version),
|
||||||
infoText,
|
infoText,
|
||||||
icon = Icons.Default.Storage
|
icon = Icons.Default.Storage,
|
||||||
|
Int.MAX_VALUE,
|
||||||
|
TextOverflow.Clip
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -892,7 +903,7 @@ fun getManagerVersion(context: Context): Pair<String, Long> {
|
|||||||
@Preview
|
@Preview
|
||||||
@Composable
|
@Composable
|
||||||
private fun StatusCardPreview() {
|
private fun StatusCardPreview() {
|
||||||
Column(verticalArrangement = Arrangement.spacedBy(16.dp)) {
|
Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||||
StatusCard(KernelVersion(5, 10, 101), 1, null)
|
StatusCard(KernelVersion(5, 10, 101), 1, null)
|
||||||
StatusCard(KernelVersion(5, 10, 101), 20000, true)
|
StatusCard(KernelVersion(5, 10, 101), 20000, true)
|
||||||
StatusCard(KernelVersion(5, 10, 101), null, true)
|
StatusCard(KernelVersion(5, 10, 101), null, true)
|
||||||
@@ -903,7 +914,7 @@ private fun StatusCardPreview() {
|
|||||||
@Preview
|
@Preview
|
||||||
@Composable
|
@Composable
|
||||||
private fun WarningCardPreview() {
|
private fun WarningCardPreview() {
|
||||||
Column(verticalArrangement = Arrangement.spacedBy(16.dp)) {
|
Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||||
WarningCard(message = "Warning message")
|
WarningCard(message = "Warning message")
|
||||||
WarningCard(
|
WarningCard(
|
||||||
message = "Warning message ",
|
message = "Warning message ",
|
||||||
|
|||||||
@@ -314,12 +314,7 @@ fun KpmScreen(
|
|||||||
},
|
},
|
||||||
containerColor = cardColor,
|
containerColor = cardColor,
|
||||||
contentColor = MaterialTheme.colorScheme.onPrimaryContainer,
|
contentColor = MaterialTheme.colorScheme.onPrimaryContainer,
|
||||||
elevation = FloatingActionButtonDefaults.elevation(
|
|
||||||
defaultElevation = 0.dp,
|
|
||||||
pressedElevation = 0.dp
|
|
||||||
),
|
|
||||||
expanded = true,
|
expanded = true,
|
||||||
modifier = Modifier.padding(16.dp)
|
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
snackbarHost = { SnackbarHost(snackBarHost) }
|
snackbarHost = { SnackbarHost(snackBarHost) }
|
||||||
|
|||||||
@@ -7,8 +7,6 @@ import android.net.Uri
|
|||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import androidx.activity.compose.rememberLauncherForActivityResult
|
import androidx.activity.compose.rememberLauncherForActivityResult
|
||||||
import androidx.activity.result.contract.ActivityResultContracts
|
import androidx.activity.result.contract.ActivityResultContracts
|
||||||
import androidx.compose.animation.*
|
|
||||||
import androidx.compose.animation.core.*
|
|
||||||
import androidx.compose.foundation.*
|
import androidx.compose.foundation.*
|
||||||
import androidx.compose.foundation.interaction.MutableInteractionSource
|
import androidx.compose.foundation.interaction.MutableInteractionSource
|
||||||
import androidx.compose.foundation.layout.*
|
import androidx.compose.foundation.layout.*
|
||||||
@@ -356,12 +354,7 @@ fun ModuleScreen(navigator: DestinationsNavigator) {
|
|||||||
},
|
},
|
||||||
containerColor = cardColor,
|
containerColor = cardColor,
|
||||||
contentColor = MaterialTheme.colorScheme.onPrimaryContainer,
|
contentColor = MaterialTheme.colorScheme.onPrimaryContainer,
|
||||||
elevation = FloatingActionButtonDefaults.elevation(
|
|
||||||
defaultElevation = 0.dp,
|
|
||||||
pressedElevation = 0.dp
|
|
||||||
),
|
|
||||||
expanded = true,
|
expanded = true,
|
||||||
modifier = Modifier.padding(16.dp)
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user