Loading packages/CredentialManager/wear/res/values/strings.xml +10 −3 Original line number Diff line number Diff line Loading @@ -27,11 +27,11 @@ <!-- Title of a screen prompting if the user would like to sign in with provider [CHAR LIMIT=80] --> <string name="use_password_title">Use password?</string> <!-- Content description for the dismiss button of a screen. [CHAR LIMIT=NONE] --> <!-- Text on this dismiss button of a screen. [CHAR LIMIT=NONE] --> <string name="dialog_dismiss_button">Dismiss</string> <!-- Content description for the continue button of a screen. [CHAR LIMIT=NONE] --> <!-- Text on the continue button of a screen. [CHAR LIMIT=NONE] --> <string name="dialog_continue_button">Continue</string> <!-- Content description for the sign in options button of a screen. [CHAR LIMIT=NONE] --> <!-- Text on the sign in options button of a screen. [CHAR LIMIT=NONE] --> <string name="dialog_sign_in_options_button">Sign-in Options</string> <!-- Title for multiple credentials folded screen. [CHAR LIMIT=NONE] --> <string name="sign_in_options_title">Sign-in Options</string> Loading @@ -41,4 +41,11 @@ <string name="choose_passkey_title">Choose passkey</string> <!-- Title for multiple credentials screen with only passwords. [CHAR LIMIT=NONE] --> <string name="choose_password_title">Choose password</string> <!-- Text on the sign in on phone button [CHAR LIMIT=NONE] --> <string name="sign_in_on_phone_button">Sign in on phone</string> <!-- Text on the locked provider button when unlocked[CHAR LIMIT=NONE] --> <string name="locked_credential_entry_label_subtext_no_sign_in">No sign-in info</string> <!-- Text on the locked provider button when locked[CHAR LIMIT=NONE] --> <string name="locked_credential_entry_label_subtext_tap_to_unlock">Tap to unlock</string> </resources> No newline at end of file packages/CredentialManager/wear/src/com/android/credentialmanager/CredentialSelectorViewModel.kt +2 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import com.android.credentialmanager.model.Request import com.android.credentialmanager.client.CredentialManagerClient import com.android.credentialmanager.model.EntryInfo import com.android.credentialmanager.model.get.ActionEntryInfo import com.android.credentialmanager.model.get.AuthenticationEntryInfo import com.android.credentialmanager.model.get.CredentialEntryInfo import com.android.credentialmanager.ui.mappers.toGet import android.util.Log Loading Loading @@ -114,6 +115,7 @@ sealed class CredentialSelectorUiState { data class MultipleEntry( val accounts: List<PerUserNameEntries>, val actionEntryList: List<ActionEntryInfo>, val authenticationEntryList: List<AuthenticationEntryInfo>, ) : Get() { data class PerUserNameEntries( val userName: String, Loading packages/CredentialManager/wear/src/com/android/credentialmanager/ui/components/CredentialsScreenChip.kt +49 −2 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.credentialmanager.ui.components import android.graphics.drawable.Drawable import androidx.compose.foundation.layout.BoxScope import androidx.compose.foundation.layout.RowScope import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.runtime.Composable Loading @@ -29,12 +30,18 @@ import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import androidx.wear.compose.material.Chip import androidx.core.graphics.drawable.toBitmap import androidx.wear.compose.material.ChipColors import androidx.compose.ui.graphics.asImageBitmap import androidx.compose.ui.graphics.Color import androidx.wear.compose.material.ChipDefaults 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 fun CredentialsScreenChip( label: String, Loading Loading @@ -65,9 +72,15 @@ fun CredentialsScreenChip( } val iconParam: (@Composable BoxScope.() -> Unit)? = icon?.let { icon?.toBitmap()?.asImageBitmap()?.let { { ChipDefaults.IconSize Icon( bitmap = it, // Decorative purpose only. contentDescription = null, modifier = Modifier.size(32.dp), tint = Color.Unspecified ) } } Loading Loading @@ -139,6 +152,40 @@ fun DismissChip(onClick: () -> Unit) { ) } @Composable fun SignInOnPhoneChip(onClick: () -> Unit) { CredentialsScreenChip( label = stringResource(R.string.sign_in_on_phone_button), onClick = onClick, modifier = Modifier .padding(top = TOPPADDING), ) } @Composable fun LockedProviderChip( authenticationEntryInfo: AuthenticationEntryInfo, onClick: () -> Unit ) { val secondaryLabel = stringResource( if (authenticationEntryInfo.isUnlockedAndEmpty) R.string.locked_credential_entry_label_subtext_no_sign_in 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, onClick = onClick, modifier = Modifier.padding(top = TOPPADDING), ) } @Preview @Composable fun DismissChipPreview() { Loading packages/CredentialManager/wear/src/com/android/credentialmanager/ui/components/SignInHeader.kt +5 −1 Original line number Diff line number Diff line Loading @@ -27,10 +27,12 @@ import androidx.compose.ui.graphics.asImageBitmap import androidx.compose.ui.unit.dp import androidx.core.graphics.drawable.toBitmap import androidx.wear.compose.material.Text import androidx.compose.ui.graphics.Color import androidx.compose.material3.Icon import androidx.wear.compose.material.MaterialTheme as WearMaterialTheme import androidx.compose.ui.text.style.TextAlign /* Used as header across Credential Selector screens. */ @Composable fun SignInHeader( icon: Drawable?, Loading @@ -46,7 +48,9 @@ fun SignInHeader( bitmap = icon.toBitmap().asImageBitmap(), modifier = Modifier.size(32.dp), // Decorative purpose only. contentDescription = null contentDescription = null, tint = Color.Unspecified, ) } Loading packages/CredentialManager/wear/src/com/android/credentialmanager/ui/mappers/CredentialSelectorUiStateGetMapper.kt +1 −0 Original line number Diff line number Diff line Loading @@ -47,6 +47,7 @@ fun Request.Get.toGet(isPrimary: Boolean): CredentialSelectorUiState.Get { ) }, actionEntryList = providerInfos.flatMap { it.actionEntryList }, authenticationEntryList = providerInfos.flatMap { it.authenticationEntryList } ) } } Loading Loading
packages/CredentialManager/wear/res/values/strings.xml +10 −3 Original line number Diff line number Diff line Loading @@ -27,11 +27,11 @@ <!-- Title of a screen prompting if the user would like to sign in with provider [CHAR LIMIT=80] --> <string name="use_password_title">Use password?</string> <!-- Content description for the dismiss button of a screen. [CHAR LIMIT=NONE] --> <!-- Text on this dismiss button of a screen. [CHAR LIMIT=NONE] --> <string name="dialog_dismiss_button">Dismiss</string> <!-- Content description for the continue button of a screen. [CHAR LIMIT=NONE] --> <!-- Text on the continue button of a screen. [CHAR LIMIT=NONE] --> <string name="dialog_continue_button">Continue</string> <!-- Content description for the sign in options button of a screen. [CHAR LIMIT=NONE] --> <!-- Text on the sign in options button of a screen. [CHAR LIMIT=NONE] --> <string name="dialog_sign_in_options_button">Sign-in Options</string> <!-- Title for multiple credentials folded screen. [CHAR LIMIT=NONE] --> <string name="sign_in_options_title">Sign-in Options</string> Loading @@ -41,4 +41,11 @@ <string name="choose_passkey_title">Choose passkey</string> <!-- Title for multiple credentials screen with only passwords. [CHAR LIMIT=NONE] --> <string name="choose_password_title">Choose password</string> <!-- Text on the sign in on phone button [CHAR LIMIT=NONE] --> <string name="sign_in_on_phone_button">Sign in on phone</string> <!-- Text on the locked provider button when unlocked[CHAR LIMIT=NONE] --> <string name="locked_credential_entry_label_subtext_no_sign_in">No sign-in info</string> <!-- Text on the locked provider button when locked[CHAR LIMIT=NONE] --> <string name="locked_credential_entry_label_subtext_tap_to_unlock">Tap to unlock</string> </resources> No newline at end of file
packages/CredentialManager/wear/src/com/android/credentialmanager/CredentialSelectorViewModel.kt +2 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import com.android.credentialmanager.model.Request import com.android.credentialmanager.client.CredentialManagerClient import com.android.credentialmanager.model.EntryInfo import com.android.credentialmanager.model.get.ActionEntryInfo import com.android.credentialmanager.model.get.AuthenticationEntryInfo import com.android.credentialmanager.model.get.CredentialEntryInfo import com.android.credentialmanager.ui.mappers.toGet import android.util.Log Loading Loading @@ -114,6 +115,7 @@ sealed class CredentialSelectorUiState { data class MultipleEntry( val accounts: List<PerUserNameEntries>, val actionEntryList: List<ActionEntryInfo>, val authenticationEntryList: List<AuthenticationEntryInfo>, ) : Get() { data class PerUserNameEntries( val userName: String, Loading
packages/CredentialManager/wear/src/com/android/credentialmanager/ui/components/CredentialsScreenChip.kt +49 −2 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.credentialmanager.ui.components import android.graphics.drawable.Drawable import androidx.compose.foundation.layout.BoxScope import androidx.compose.foundation.layout.RowScope import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.runtime.Composable Loading @@ -29,12 +30,18 @@ import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import androidx.wear.compose.material.Chip import androidx.core.graphics.drawable.toBitmap import androidx.wear.compose.material.ChipColors import androidx.compose.ui.graphics.asImageBitmap import androidx.compose.ui.graphics.Color import androidx.wear.compose.material.ChipDefaults 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 fun CredentialsScreenChip( label: String, Loading Loading @@ -65,9 +72,15 @@ fun CredentialsScreenChip( } val iconParam: (@Composable BoxScope.() -> Unit)? = icon?.let { icon?.toBitmap()?.asImageBitmap()?.let { { ChipDefaults.IconSize Icon( bitmap = it, // Decorative purpose only. contentDescription = null, modifier = Modifier.size(32.dp), tint = Color.Unspecified ) } } Loading Loading @@ -139,6 +152,40 @@ fun DismissChip(onClick: () -> Unit) { ) } @Composable fun SignInOnPhoneChip(onClick: () -> Unit) { CredentialsScreenChip( label = stringResource(R.string.sign_in_on_phone_button), onClick = onClick, modifier = Modifier .padding(top = TOPPADDING), ) } @Composable fun LockedProviderChip( authenticationEntryInfo: AuthenticationEntryInfo, onClick: () -> Unit ) { val secondaryLabel = stringResource( if (authenticationEntryInfo.isUnlockedAndEmpty) R.string.locked_credential_entry_label_subtext_no_sign_in 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, onClick = onClick, modifier = Modifier.padding(top = TOPPADDING), ) } @Preview @Composable fun DismissChipPreview() { Loading
packages/CredentialManager/wear/src/com/android/credentialmanager/ui/components/SignInHeader.kt +5 −1 Original line number Diff line number Diff line Loading @@ -27,10 +27,12 @@ import androidx.compose.ui.graphics.asImageBitmap import androidx.compose.ui.unit.dp import androidx.core.graphics.drawable.toBitmap import androidx.wear.compose.material.Text import androidx.compose.ui.graphics.Color import androidx.compose.material3.Icon import androidx.wear.compose.material.MaterialTheme as WearMaterialTheme import androidx.compose.ui.text.style.TextAlign /* Used as header across Credential Selector screens. */ @Composable fun SignInHeader( icon: Drawable?, Loading @@ -46,7 +48,9 @@ fun SignInHeader( bitmap = icon.toBitmap().asImageBitmap(), modifier = Modifier.size(32.dp), // Decorative purpose only. contentDescription = null contentDescription = null, tint = Color.Unspecified, ) } Loading
packages/CredentialManager/wear/src/com/android/credentialmanager/ui/mappers/CredentialSelectorUiStateGetMapper.kt +1 −0 Original line number Diff line number Diff line Loading @@ -47,6 +47,7 @@ fun Request.Get.toGet(isPrimary: Boolean): CredentialSelectorUiState.Get { ) }, actionEntryList = providerInfos.flatMap { it.actionEntryList }, authenticationEntryList = providerInfos.flatMap { it.authenticationEntryList } ) } } Loading