refactor: clean up InstalledItemCard

This commit is contained in:
rushiiMachine 2025-01-25 12:25:29 -08:00
parent 0c43b3f0b6
commit 00ec8fadc9
No known key found for this signature in database
GPG key ID: DCBE5952BB3B6420
2 changed files with 10 additions and 38 deletions

View file

@ -13,7 +13,6 @@ import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.*
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import com.aliucord.manager.R
@ -57,7 +56,11 @@ fun InstalledItemCard(
Column {
Text(
text = "\"${data.name}\"",
text = if (data.name.contains(' ')) {
stringResource(R.string.installs_item_quoted_title, data.name)
} else {
data.name
},
fontWeight = FontWeight.SemiBold,
color = MaterialTheme.colorScheme.onSurfaceVariant.copy(alpha = .94f),
)
@ -76,24 +79,13 @@ fun InstalledItemCard(
Spacer(Modifier.weight(1f, fill = true))
Column(
verticalArrangement = Arrangement.spacedBy(2.dp),
horizontalAlignment = Alignment.End,
VersionDisplay(
version = data.version,
prefix = { append("v") },
modifier = Modifier
.alpha(.6f)
.padding(end = 4.dp),
) {
VersionDisplay(
version = data.version,
prefix = { append("v") },
)
// TODO: display install core commit version
// Text(
// text = data.commit,
// style = MaterialTheme.typography.labelLarge,
// )
}
)
}
Row(
@ -132,24 +124,3 @@ fun InstalledItemCard(
}
}
}
@Composable
private fun LabelTextItem(
label: String,
value: String,
modifier: Modifier = Modifier,
) {
Text(
text = buildAnnotatedString {
withStyle(SpanStyle(fontWeight = FontWeight.Bold)) {
append("• ")
append(label)
}
append(" ")
append(value)
},
style = MaterialTheme.typography.bodyMedium,
color = MaterialTheme.colorScheme.onSurfaceVariant.copy(alpha = .9f),
modifier = modifier,
)
}

View file

@ -35,6 +35,7 @@
<string name="permissions_grant_body">In order for Aliucord Manager to function, file permissions are required. Since shared data is stored in ~/Aliucord, permissions are required in order to access it.</string>
<string name="installs_no_installs">No installations found!</string>
<string name="installs_item_quoted_title">\"%s\"</string>
<string name="launch_aliucord_fail">Failed to launch Aliucord</string>
<string name="settings_theme">Theme</string>