Merge "Remove the 8dp padding between more option bar and the first subheader" into udc-dev

This commit is contained in:
Helen Qin
2023-04-11 18:01:42 +00:00
committed by Android (Google) Code Review
3 changed files with 35 additions and 9 deletions

View File

@@ -27,8 +27,12 @@ import androidx.compose.ui.unit.dp
import com.android.credentialmanager.ui.theme.LocalAndroidColorScheme
@Composable
fun CredentialListSectionHeader(text: String) {
InternalSectionHeader(text, LocalAndroidColorScheme.current.colorOnSurfaceVariant)
fun CredentialListSectionHeader(text: String, isFirstSection: Boolean) {
InternalSectionHeader(
text = text,
color = LocalAndroidColorScheme.current.colorOnSurfaceVariant,
applyTopPadding = !isFirstSection
)
}
@Composable
@@ -37,8 +41,10 @@ fun MoreAboutPasskeySectionHeader(text: String) {
}
@Composable
private fun InternalSectionHeader(text: String, color: Color) {
Row(modifier = Modifier.fillMaxWidth().wrapContentHeight().padding(top = 8.dp)) {
private fun InternalSectionHeader(text: String, color: Color, applyTopPadding: Boolean = false) {
Row(modifier = Modifier.fillMaxWidth().wrapContentHeight().padding(
top = if (applyTopPadding) 8.dp else 0.dp
)) {
SectionHeaderText(
text,
modifier = Modifier.padding(top = 20.dp, bottom = 8.dp),

View File

@@ -633,6 +633,7 @@ fun MoreAboutPasskeysIntroCard(
}
}
item {
Divider(thickness = 8.dp, color = Color.Transparent)
MoreAboutPasskeySectionHeader(
text = stringResource(R.string.public_key_cryptography_title)
)
@@ -641,6 +642,7 @@ fun MoreAboutPasskeysIntroCard(
}
}
item {
Divider(thickness = 8.dp, color = Color.Transparent)
MoreAboutPasskeySectionHeader(
text = stringResource(R.string.improved_account_security_title)
)
@@ -649,6 +651,7 @@ fun MoreAboutPasskeysIntroCard(
}
}
item {
Divider(thickness = 8.dp, color = Color.Transparent)
MoreAboutPasskeySectionHeader(
text = stringResource(R.string.seamless_transition_title)
)

View File

@@ -323,12 +323,15 @@ fun AllSignInOptionCard(
bottomPadding = 0.dp,
)
}) {
var isFirstSection = true
// For username
items(sortedUserNameToCredentialEntryList) { item ->
PerUserNameCredentials(
perUserNameCredentialEntryList = item,
onEntrySelected = onEntrySelected,
isFirstSection = isFirstSection,
)
isFirstSection = false
}
// Locked password manager
if (authenticationEntryList.isNotEmpty()) {
@@ -336,7 +339,9 @@ fun AllSignInOptionCard(
LockedCredentials(
authenticationEntryList = authenticationEntryList,
onEntrySelected = onEntrySelected,
isFirstSection = isFirstSection,
)
isFirstSection = false
}
}
// From another device
@@ -346,15 +351,19 @@ fun AllSignInOptionCard(
RemoteEntryCard(
remoteEntry = remoteEntry,
onEntrySelected = onEntrySelected,
isFirstSection = isFirstSection,
)
isFirstSection = false
}
}
// Manage sign-ins (action chips)
item {
ActionChips(
providerInfoList = providerInfoList,
onEntrySelected = onEntrySelected
onEntrySelected = onEntrySelected,
isFirstSection = isFirstSection,
)
isFirstSection = false
}
}
onLog(GetCredentialEvent.CREDMAN_GET_CRED_ALL_SIGN_IN_OPTION_CARD)
@@ -367,6 +376,7 @@ fun AllSignInOptionCard(
fun ActionChips(
providerInfoList: List<ProviderInfo>,
onEntrySelected: (BaseEntry) -> Unit,
isFirstSection: Boolean,
) {
val actionChips = providerInfoList.flatMap { it.actionEntryList }
if (actionChips.isEmpty()) {
@@ -374,7 +384,8 @@ fun ActionChips(
}
CredentialListSectionHeader(
text = stringResource(R.string.get_dialog_heading_manage_sign_ins)
text = stringResource(R.string.get_dialog_heading_manage_sign_ins),
isFirstSection = isFirstSection,
)
CredentialContainerCard {
Column(verticalArrangement = Arrangement.spacedBy(2.dp)) {
@@ -389,9 +400,11 @@ fun ActionChips(
fun RemoteEntryCard(
remoteEntry: RemoteEntryInfo,
onEntrySelected: (BaseEntry) -> Unit,
isFirstSection: Boolean,
) {
CredentialListSectionHeader(
text = stringResource(R.string.get_dialog_heading_from_another_device)
text = stringResource(R.string.get_dialog_heading_from_another_device),
isFirstSection = isFirstSection,
)
CredentialContainerCard {
Column(
@@ -413,9 +426,11 @@ fun RemoteEntryCard(
fun LockedCredentials(
authenticationEntryList: List<AuthenticationEntryInfo>,
onEntrySelected: (BaseEntry) -> Unit,
isFirstSection: Boolean,
) {
CredentialListSectionHeader(
text = stringResource(R.string.get_dialog_heading_locked_password_managers)
text = stringResource(R.string.get_dialog_heading_locked_password_managers),
isFirstSection = isFirstSection,
)
CredentialContainerCard {
Column(
@@ -433,11 +448,13 @@ fun LockedCredentials(
fun PerUserNameCredentials(
perUserNameCredentialEntryList: PerUserNameCredentialEntryList,
onEntrySelected: (BaseEntry) -> Unit,
isFirstSection: Boolean,
) {
CredentialListSectionHeader(
text = stringResource(
R.string.get_dialog_heading_for_username, perUserNameCredentialEntryList.userName
)
),
isFirstSection = isFirstSection,
)
CredentialContainerCard {
Column(