Loading packages/CredentialManager/wear/src/com/android/credentialmanager/ui/components/CredentialsScreenChip.kt +22 −11 Original line number Diff line number Diff line Loading @@ -15,6 +15,8 @@ */ package com.android.credentialmanager.ui.components import androidx.compose.foundation.layout.Row import androidx.compose.material3.Icon import android.graphics.drawable.Drawable import androidx.compose.foundation.layout.BoxScope import androidx.compose.foundation.layout.RowScope Loading @@ -25,7 +27,6 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clipToBounds import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp Loading @@ -39,7 +40,6 @@ import androidx.wear.compose.material.Text import com.android.credentialmanager.R import com.android.credentialmanager.model.get.AuthenticationEntryInfo import com.android.credentialmanager.ui.components.CredentialsScreenChip.TOPPADDING import androidx.compose.material3.Icon /* Used as credential suggestion or user action chip. */ @Composable Loading @@ -48,6 +48,7 @@ fun CredentialsScreenChip( onClick: () -> Unit, secondaryLabel: String? = null, icon: Drawable? = null, isAuthenticationEntryLocked: Boolean = false, modifier: Modifier = Modifier, colors: ChipColors = ChipDefaults.secondaryChipColors(), ) { Loading @@ -63,11 +64,24 @@ fun CredentialsScreenChip( val secondaryLabelParam: (@Composable RowScope.() -> Unit)? = secondaryLabel?.let { { Row { Text( text = secondaryLabel, overflow = TextOverflow.Ellipsis, maxLines = 1, ) if (isAuthenticationEntryLocked) // TODO(b/324465527) change this to lock icon and correct size once figma mocks are // updated Icon( bitmap = checkNotNull(icon?.toBitmap()?.asImageBitmap()), // Decorative purpose only. contentDescription = null, modifier = Modifier.size(20.dp), tint = Color.Unspecified ) } } } Loading Loading @@ -173,14 +187,11 @@ fun LockedProviderChip( else R.string.locked_credential_entry_label_subtext_tap_to_unlock ) if (!authenticationEntryInfo.isUnlockedAndEmpty) { // TODO(b/324465527) need to draw a lock icon here. may need to switch over from using chip } CredentialsScreenChip( label = authenticationEntryInfo.title, icon = authenticationEntryInfo.icon, secondaryLabel = secondaryLabel, isAuthenticationEntryLocked = !authenticationEntryInfo.isUnlockedAndEmpty, onClick = onClick, modifier = Modifier.padding(top = TOPPADDING), ) Loading Loading
packages/CredentialManager/wear/src/com/android/credentialmanager/ui/components/CredentialsScreenChip.kt +22 −11 Original line number Diff line number Diff line Loading @@ -15,6 +15,8 @@ */ package com.android.credentialmanager.ui.components import androidx.compose.foundation.layout.Row import androidx.compose.material3.Icon import android.graphics.drawable.Drawable import androidx.compose.foundation.layout.BoxScope import androidx.compose.foundation.layout.RowScope Loading @@ -25,7 +27,6 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clipToBounds import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp Loading @@ -39,7 +40,6 @@ import androidx.wear.compose.material.Text import com.android.credentialmanager.R import com.android.credentialmanager.model.get.AuthenticationEntryInfo import com.android.credentialmanager.ui.components.CredentialsScreenChip.TOPPADDING import androidx.compose.material3.Icon /* Used as credential suggestion or user action chip. */ @Composable Loading @@ -48,6 +48,7 @@ fun CredentialsScreenChip( onClick: () -> Unit, secondaryLabel: String? = null, icon: Drawable? = null, isAuthenticationEntryLocked: Boolean = false, modifier: Modifier = Modifier, colors: ChipColors = ChipDefaults.secondaryChipColors(), ) { Loading @@ -63,11 +64,24 @@ fun CredentialsScreenChip( val secondaryLabelParam: (@Composable RowScope.() -> Unit)? = secondaryLabel?.let { { Row { Text( text = secondaryLabel, overflow = TextOverflow.Ellipsis, maxLines = 1, ) if (isAuthenticationEntryLocked) // TODO(b/324465527) change this to lock icon and correct size once figma mocks are // updated Icon( bitmap = checkNotNull(icon?.toBitmap()?.asImageBitmap()), // Decorative purpose only. contentDescription = null, modifier = Modifier.size(20.dp), tint = Color.Unspecified ) } } } Loading Loading @@ -173,14 +187,11 @@ fun LockedProviderChip( else R.string.locked_credential_entry_label_subtext_tap_to_unlock ) if (!authenticationEntryInfo.isUnlockedAndEmpty) { // TODO(b/324465527) need to draw a lock icon here. may need to switch over from using chip } CredentialsScreenChip( label = authenticationEntryInfo.title, icon = authenticationEntryInfo.icon, secondaryLabel = secondaryLabel, isAuthenticationEntryLocked = !authenticationEntryInfo.isUnlockedAndEmpty, onClick = onClick, modifier = Modifier.padding(top = TOPPADDING), ) Loading