mirror of
https://github.com/revanced/revanced-manager-compose-old.git
synced 2025-04-29 22:14:28 +02:00
feat: improve patch card
This commit is contained in:
parent
74318f30fb
commit
45829d00bb
@ -34,54 +34,44 @@ fun PatchCard(patchClass: PatchClass, isSelected: Boolean, onSelected: () -> Uni
|
|||||||
enabled = !patchClass.unsupported,
|
enabled = !patchClass.unsupported,
|
||||||
onClick = onSelected
|
onClick = onSelected
|
||||||
) {
|
) {
|
||||||
Column(modifier = Modifier.padding(12.dp, 0.dp, 12.dp, 12.dp)) {
|
Column(modifier = Modifier.padding(16.dp, 12.dp, 16.dp, 16.dp)) {
|
||||||
Row {
|
Row(
|
||||||
Column(
|
verticalAlignment = Alignment.CenterVertically
|
||||||
Modifier
|
) {
|
||||||
.align(Alignment.CenterVertically)
|
Text(
|
||||||
) {
|
text = name.replace("-", " ").split(" ")
|
||||||
Text(
|
.joinToString(" ") { it.replaceFirstChar(Char::uppercase) },
|
||||||
text = name.replace("-", " ").split(" ")
|
style = MaterialTheme.typography.titleMedium
|
||||||
.joinToString(" ") { it.replaceFirstChar(Char::uppercase) },
|
)
|
||||||
style = MaterialTheme.typography.titleMedium
|
|
||||||
)
|
|
||||||
}
|
|
||||||
Spacer(Modifier.width(4.dp))
|
Spacer(Modifier.width(4.dp))
|
||||||
Row(
|
Text(
|
||||||
Modifier
|
text = patch.version ?: "unknown",
|
||||||
.align(Alignment.CenterVertically)
|
style = Typography.bodySmall
|
||||||
) {
|
)
|
||||||
Text(
|
|
||||||
text = patch.version ?: "unknown",
|
|
||||||
style = Typography.bodySmall
|
|
||||||
)
|
|
||||||
}
|
|
||||||
Spacer(Modifier.weight(1f, true))
|
Spacer(Modifier.weight(1f, true))
|
||||||
Column(modifier = Modifier.padding(0.dp, 6.dp)) {
|
Row(
|
||||||
Row(
|
horizontalArrangement = Arrangement.SpaceBetween,
|
||||||
horizontalArrangement = Arrangement.SpaceBetween,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
modifier = Modifier.padding(4.dp)
|
||||||
modifier = Modifier.padding(4.dp)
|
) {
|
||||||
) {
|
if (patchClass.patch.options != null) {
|
||||||
if (patchClass.patch.options != null) {
|
CompositionLocalProvider(LocalMinimumTouchTargetEnforcement provides false) {
|
||||||
CompositionLocalProvider(LocalMinimumTouchTargetEnforcement provides false) {
|
IconButton(onClick = { }, modifier = Modifier.size(24.dp)) {
|
||||||
IconButton(onClick = { }, modifier = Modifier.size(24.dp)) {
|
Icon(
|
||||||
Icon(
|
Icons.Outlined.Settings,
|
||||||
Icons.Outlined.Settings,
|
contentDescription = "Patch Options"
|
||||||
contentDescription = "Patch Options"
|
)
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Spacer(Modifier.width(8.dp))
|
}
|
||||||
CompositionLocalProvider(LocalMinimumTouchTargetEnforcement provides false) {
|
Spacer(Modifier.width(8.dp))
|
||||||
Checkbox(
|
CompositionLocalProvider(LocalMinimumTouchTargetEnforcement provides false) {
|
||||||
enabled = !patchClass.unsupported,
|
Checkbox(
|
||||||
|
enabled = !patchClass.unsupported,
|
||||||
checked = isSelected,
|
checked = isSelected,
|
||||||
onCheckedChange = { onSelected() }
|
onCheckedChange = { onSelected() }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var isExpanded by remember { mutableStateOf(false) }
|
var isExpanded by remember { mutableStateOf(false) }
|
||||||
@ -89,10 +79,11 @@ fun PatchCard(patchClass: PatchClass, isSelected: Boolean, onSelected: () -> Uni
|
|||||||
Text(
|
Text(
|
||||||
text = desc,
|
text = desc,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.padding(0.dp, 8.dp, 22.dp, 8.dp)
|
.padding(0.dp, 4.dp, 30.dp, 4.dp)
|
||||||
.clickable { isExpanded = !isExpanded },
|
.clickable { isExpanded = !isExpanded },
|
||||||
maxLines = if (isExpanded) Int.MAX_VALUE else 1,
|
maxLines = if (isExpanded) Int.MAX_VALUE else 1,
|
||||||
overflow = TextOverflow.Ellipsis,
|
overflow = TextOverflow.Ellipsis,
|
||||||
|
softWrap = true,
|
||||||
style = MaterialTheme.typography.bodyMedium
|
style = MaterialTheme.typography.bodyMedium
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user