summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/CredentialManager/src/com/android/credentialmanager/common/ui/SectionHeader.kt14
-rw-r--r--packages/CredentialManager/src/com/android/credentialmanager/createflow/CreateCredentialComponents.kt3
-rw-r--r--packages/CredentialManager/src/com/android/credentialmanager/getflow/GetCredentialComponents.kt27
3 files changed, 35 insertions, 9 deletions
diff --git a/packages/CredentialManager/src/com/android/credentialmanager/common/ui/SectionHeader.kt b/packages/CredentialManager/src/com/android/credentialmanager/common/ui/SectionHeader.kt
index 14bf4f23384b..2df0c7a9b1e8 100644
--- a/packages/CredentialManager/src/com/android/credentialmanager/common/ui/SectionHeader.kt
+++ b/packages/CredentialManager/src/com/android/credentialmanager/common/ui/SectionHeader.kt
@@ -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),
diff --git a/packages/CredentialManager/src/com/android/credentialmanager/createflow/CreateCredentialComponents.kt b/packages/CredentialManager/src/com/android/credentialmanager/createflow/CreateCredentialComponents.kt
index 66d7db896247..4ae3cc6ad843 100644
--- a/packages/CredentialManager/src/com/android/credentialmanager/createflow/CreateCredentialComponents.kt
+++ b/packages/CredentialManager/src/com/android/credentialmanager/createflow/CreateCredentialComponents.kt
@@ -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)
)
diff --git a/packages/CredentialManager/src/com/android/credentialmanager/getflow/GetCredentialComponents.kt b/packages/CredentialManager/src/com/android/credentialmanager/getflow/GetCredentialComponents.kt
index c1ea1d8d1746..2b96007901a7 100644
--- a/packages/CredentialManager/src/com/android/credentialmanager/getflow/GetCredentialComponents.kt
+++ b/packages/CredentialManager/src/com/android/credentialmanager/getflow/GetCredentialComponents.kt
@@ -322,12 +322,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()) {
@@ -335,7 +338,9 @@ fun AllSignInOptionCard(
LockedCredentials(
authenticationEntryList = authenticationEntryList,
onEntrySelected = onEntrySelected,
+ isFirstSection = isFirstSection,
)
+ isFirstSection = false
}
}
// From another device
@@ -345,15 +350,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)
@@ -366,6 +375,7 @@ fun AllSignInOptionCard(
fun ActionChips(
providerInfoList: List<ProviderInfo>,
onEntrySelected: (BaseEntry) -> Unit,
+ isFirstSection: Boolean,
) {
val actionChips = providerInfoList.flatMap { it.actionEntryList }
if (actionChips.isEmpty()) {
@@ -373,7 +383,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)) {
@@ -388,9 +399,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(
@@ -412,9 +425,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(
@@ -432,11 +447,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(