mirror of
https://github.com/whyorean/AuroraStore.git
synced 2026-06-15 19:20:53 -04:00
style(updates): separate accounts in the update accordion
Add an inset divider between each account row in the per-app "update — choose account" accordion so the entries read distinctly. (Also carries the accordion layout tweaks: a leading divider/spacer and showing the account e-mail on non-default rows.)
This commit is contained in:
@@ -17,6 +17,7 @@ import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.navigationBarsPadding
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.requiredSize
|
||||
@@ -121,6 +122,26 @@ fun AppUpdateSheet(
|
||||
}
|
||||
)
|
||||
|
||||
// Per-app update override: only meaningful with more than one account. The primary
|
||||
// update button keeps using the default (or the app's existing binding).
|
||||
if (accounts.size > 1) {
|
||||
HorizontalDivider(
|
||||
modifier = Modifier.padding(
|
||||
vertical = dimensionResource(R.dimen.spacing_small)
|
||||
)
|
||||
)
|
||||
|
||||
AccountAccordion(
|
||||
expanded = showAccounts,
|
||||
onToggle = { showAccounts = !showAccounts },
|
||||
accounts = accounts,
|
||||
onSelect = { account ->
|
||||
viewModel.updateWithAccount(update, account.id)
|
||||
onDismiss()
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
HorizontalDivider(
|
||||
modifier = Modifier.padding(
|
||||
vertical = dimensionResource(R.dimen.spacing_small)
|
||||
@@ -148,20 +169,6 @@ fun AppUpdateSheet(
|
||||
}
|
||||
)
|
||||
|
||||
// Per-app update override: only meaningful with more than one account. The primary
|
||||
// update button keeps using the default (or the app's existing binding).
|
||||
if (accounts.size > 1) {
|
||||
AccountAccordion(
|
||||
expanded = showAccounts,
|
||||
onToggle = { showAccounts = !showAccounts },
|
||||
accounts = accounts,
|
||||
onSelect = { account ->
|
||||
viewModel.updateWithAccount(update, account.id)
|
||||
onDismiss()
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
Item(
|
||||
label = stringResource(R.string.action_uninstall),
|
||||
onClick = {
|
||||
@@ -288,6 +295,8 @@ private fun AccountAccordion(
|
||||
)
|
||||
}
|
||||
|
||||
Spacer(Modifier.height(dimensionResource(R.dimen.spacing_xsmall)))
|
||||
|
||||
AnimatedVisibility(
|
||||
visible = expanded,
|
||||
enter = expandVertically() + fadeIn(),
|
||||
@@ -301,17 +310,27 @@ private fun AccountAccordion(
|
||||
.background(MaterialTheme.colorScheme.surfaceContainerHighest)
|
||||
.padding(vertical = dimensionResource(R.dimen.spacing_xsmall))
|
||||
) {
|
||||
accounts.forEach { account ->
|
||||
accounts.forEachIndexed { index, account ->
|
||||
if (index > 0) {
|
||||
HorizontalDivider(
|
||||
modifier = Modifier.padding(
|
||||
horizontal = dimensionResource(R.dimen.spacing_large)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
val suffix = if (account.isDefault) {
|
||||
" · " + stringResource(R.string.account_default)
|
||||
} else {
|
||||
""
|
||||
" · " + account.email
|
||||
}
|
||||
|
||||
val name = if (account.isAnonymous) {
|
||||
stringResource(R.string.account_anonymous)
|
||||
} else {
|
||||
account.displayName ?: account.email
|
||||
}
|
||||
|
||||
Text(
|
||||
text = name + suffix,
|
||||
style = MaterialTheme.typography.bodyLarge,
|
||||
|
||||
Reference in New Issue
Block a user