summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/CredentialManager/wear/src/com/android/credentialmanager/ui/components/CredentialsScreenChip.kt33
1 files changed, 22 insertions, 11 deletions
diff --git a/packages/CredentialManager/wear/src/com/android/credentialmanager/ui/components/CredentialsScreenChip.kt b/packages/CredentialManager/wear/src/com/android/credentialmanager/ui/components/CredentialsScreenChip.kt
index 5ea9d3cf0697..8e5a8666621f 100644
--- a/packages/CredentialManager/wear/src/com/android/credentialmanager/ui/components/CredentialsScreenChip.kt
+++ b/packages/CredentialManager/wear/src/com/android/credentialmanager/ui/components/CredentialsScreenChip.kt
@@ -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
@@ -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
@@ -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
@@ -48,6 +48,7 @@ fun CredentialsScreenChip(
onClick: () -> Unit,
secondaryLabel: String? = null,
icon: Drawable? = null,
+ isAuthenticationEntryLocked: Boolean = false,
modifier: Modifier = Modifier,
colors: ChipColors = ChipDefaults.secondaryChipColors(),
) {
@@ -63,11 +64,24 @@ fun CredentialsScreenChip(
val secondaryLabelParam: (@Composable RowScope.() -> Unit)? =
secondaryLabel?.let {
{
- Text(
- text = secondaryLabel,
- overflow = TextOverflow.Ellipsis,
- maxLines = 1,
- )
+ 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
+ )
+ }
}
}
@@ -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),
)