diff options
| author | 2023-04-07 00:52:32 +0000 | |
|---|---|---|
| committer | 2023-04-07 00:52:32 +0000 | |
| commit | e9a05ea390f60f7e2bf9a108fd3fa460456a0a17 (patch) | |
| tree | 016a912604fd83eff8e95ad60937b1faf7dbb146 | |
| parent | b504082e1795c073ca9689018eee041f3e24d8ee (diff) | |
| parent | 91daf590321ee161c9049f71ec9c50a5c9e9d4a6 (diff) | |
Merge "Change M3 tokens to the framework counterparts" into udc-dev
8 files changed, 27 insertions, 25 deletions
diff --git a/packages/CredentialManager/src/com/android/credentialmanager/CredentialManagerRepo.kt b/packages/CredentialManager/src/com/android/credentialmanager/CredentialManagerRepo.kt index dd4419bc6540..e53e956c317c 100644 --- a/packages/CredentialManager/src/com/android/credentialmanager/CredentialManagerRepo.kt +++ b/packages/CredentialManager/src/com/android/credentialmanager/CredentialManagerRepo.kt @@ -65,8 +65,8 @@ class CredentialManagerRepo( ) val originName: String? = when (requestInfo?.type) { - RequestInfo.TYPE_CREATE -> requestInfo?.createCredentialRequest?.origin - RequestInfo.TYPE_GET -> requestInfo?.getCredentialRequest?.origin + RequestInfo.TYPE_CREATE -> requestInfo.createCredentialRequest?.origin + RequestInfo.TYPE_GET -> requestInfo.getCredentialRequest?.origin else -> null } diff --git a/packages/CredentialManager/src/com/android/credentialmanager/DataConverter.kt b/packages/CredentialManager/src/com/android/credentialmanager/DataConverter.kt index 7bf1d1993906..ca891294576b 100644 --- a/packages/CredentialManager/src/com/android/credentialmanager/DataConverter.kt +++ b/packages/CredentialManager/src/com/android/credentialmanager/DataConverter.kt @@ -245,7 +245,7 @@ class GetFlowUtils { userName = credentialEntry.username.toString(), displayName = credentialEntry.displayName?.toString(), icon = credentialEntry.icon.loadDrawable(context), - shouldTintIcon = credentialEntry.isDefaultIcon ?: false, + shouldTintIcon = credentialEntry.isDefaultIcon, lastUsedTimeMillis = credentialEntry.lastUsedTime, isAutoSelectable = credentialEntry.isAutoSelectAllowed && credentialEntry.autoSelectAllowedFromOption, diff --git a/packages/CredentialManager/src/com/android/credentialmanager/common/material/ModalBottomSheet.kt b/packages/CredentialManager/src/com/android/credentialmanager/common/material/ModalBottomSheet.kt index 307d95313ec8..10a75d436a5b 100644 --- a/packages/CredentialManager/src/com/android/credentialmanager/common/material/ModalBottomSheet.kt +++ b/packages/CredentialManager/src/com/android/credentialmanager/common/material/ModalBottomSheet.kt @@ -316,7 +316,7 @@ fun ModalBottomSheetLayout( rememberModalBottomSheetState(Hidden), sheetShape: Shape = MaterialTheme.shapes.large, sheetElevation: Dp = ModalBottomSheetDefaults.Elevation, - sheetBackgroundColor: Color = MaterialTheme.colorScheme.surface, + sheetBackgroundColor: Color, sheetContentColor: Color = contentColorFor(sheetBackgroundColor), content: @Composable () -> Unit ) { diff --git a/packages/CredentialManager/src/com/android/credentialmanager/common/ui/Entry.kt b/packages/CredentialManager/src/com/android/credentialmanager/common/ui/Entry.kt index 7a720b1e858b..0623ff629812 100644 --- a/packages/CredentialManager/src/com/android/credentialmanager/common/ui/Entry.kt +++ b/packages/CredentialManager/src/com/android/credentialmanager/common/ui/Entry.kt @@ -32,7 +32,6 @@ import androidx.compose.material.icons.outlined.Lock import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Icon import androidx.compose.material3.IconButton -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.SuggestionChip import androidx.compose.material3.SuggestionChipDefaults import androidx.compose.material3.TopAppBar @@ -155,7 +154,7 @@ fun Entry( // Decorative purpose only. contentDescription = null, modifier = Modifier.size(24.dp), - tint = MaterialTheme.colorScheme.onSurfaceVariant, + tint = LocalAndroidColorScheme.current.colorOnSurfaceVariant, ) } } @@ -169,7 +168,7 @@ fun Entry( Icon( modifier = iconSize, bitmap = iconImageBitmap, - tint = MaterialTheme.colorScheme.onSurfaceVariant, + tint = LocalAndroidColorScheme.current.colorOnSurfaceVariant, // Decorative purpose only. contentDescription = null, ) @@ -193,7 +192,7 @@ fun Entry( Icon( modifier = iconSize, imageVector = iconImageVector, - tint = MaterialTheme.colorScheme.onSurfaceVariant, + tint = LocalAndroidColorScheme.current.colorOnSurfaceVariant, // Decorative purpose only. contentDescription = null, ) @@ -205,7 +204,7 @@ fun Entry( Icon( modifier = iconSize, painter = iconPainter, - tint = MaterialTheme.colorScheme.onSurfaceVariant, + tint = LocalAndroidColorScheme.current.colorOnSurfaceVariant, // Decorative purpose only. contentDescription = null, ) @@ -217,9 +216,8 @@ fun Entry( border = null, colors = SuggestionChipDefaults.suggestionChipColors( containerColor = LocalAndroidColorScheme.current.colorSurfaceContainerHigh, - // TODO: remove? - labelColor = MaterialTheme.colorScheme.onSurfaceVariant, - iconContentColor = MaterialTheme.colorScheme.onSurfaceVariant, + labelColor = LocalAndroidColorScheme.current.colorOnSurfaceVariant, + iconContentColor = LocalAndroidColorScheme.current.colorOnSurfaceVariant, ), ) } @@ -282,7 +280,7 @@ fun PasskeyBenefitRow( Icon( modifier = Modifier.size(24.dp), painter = leadingIconPainter, - tint = MaterialTheme.colorScheme.onSurfaceVariant, + tint = LocalAndroidColorScheme.current.colorOnSurfaceVariant, // Decorative purpose only. contentDescription = null, ) @@ -341,7 +339,7 @@ fun MoreOptionTopAppBar( R.string.accessibility_back_arrow_button ), modifier = Modifier.size(24.dp).autoMirrored(), - tint = MaterialTheme.colorScheme.onSurfaceVariant, + tint = LocalAndroidColorScheme.current.colorOnSurfaceVariant, ) } } 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 358122809985..14bf4f23384b 100644 --- a/packages/CredentialManager/src/com/android/credentialmanager/common/ui/SectionHeader.kt +++ b/packages/CredentialManager/src/com/android/credentialmanager/common/ui/SectionHeader.kt @@ -20,20 +20,20 @@ import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.wrapContentHeight -import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.unit.dp +import com.android.credentialmanager.ui.theme.LocalAndroidColorScheme @Composable fun CredentialListSectionHeader(text: String) { - InternalSectionHeader(text, MaterialTheme.colorScheme.onSurfaceVariant) + InternalSectionHeader(text, LocalAndroidColorScheme.current.colorOnSurfaceVariant) } @Composable fun MoreAboutPasskeySectionHeader(text: String) { - InternalSectionHeader(text, MaterialTheme.colorScheme.onSurface) + InternalSectionHeader(text, LocalAndroidColorScheme.current.colorOnSurface) } @Composable diff --git a/packages/CredentialManager/src/com/android/credentialmanager/common/ui/Texts.kt b/packages/CredentialManager/src/com/android/credentialmanager/common/ui/Texts.kt index 22871bcbe767..61c03b4041f5 100644 --- a/packages/CredentialManager/src/com/android/credentialmanager/common/ui/Texts.kt +++ b/packages/CredentialManager/src/com/android/credentialmanager/common/ui/Texts.kt @@ -24,6 +24,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextOverflow +import com.android.credentialmanager.ui.theme.LocalAndroidColorScheme /** * The headline for a screen. E.g. "Create a passkey for X", "Choose a saved sign-in for X". @@ -35,7 +36,7 @@ fun HeadlineText(text: String, modifier: Modifier = Modifier) { Text( modifier = modifier.wrapContentSize(), text = text, - color = MaterialTheme.colorScheme.onSurface, + color = LocalAndroidColorScheme.current.colorOnSurface, textAlign = TextAlign.Center, style = MaterialTheme.typography.headlineSmall, ) @@ -49,7 +50,7 @@ fun BodyMediumText(text: String, modifier: Modifier = Modifier) { Text( modifier = modifier.wrapContentSize(), text = text, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = LocalAndroidColorScheme.current.colorOnSurfaceVariant, style = MaterialTheme.typography.bodyMedium, ) } @@ -62,7 +63,7 @@ fun BodySmallText(text: String, modifier: Modifier = Modifier, enforceOneLine: B Text( modifier = modifier.wrapContentSize(), text = text, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = LocalAndroidColorScheme.current.colorOnSurfaceVariant, style = MaterialTheme.typography.bodySmall, overflow = TextOverflow.Ellipsis, maxLines = if (enforceOneLine) 1 else Int.MAX_VALUE @@ -77,7 +78,7 @@ fun LargeTitleText(text: String, modifier: Modifier = Modifier) { Text( modifier = modifier.wrapContentSize(), text = text, - color = MaterialTheme.colorScheme.onSurface, + color = LocalAndroidColorScheme.current.colorOnSurface, style = MaterialTheme.typography.titleLarge, ) } @@ -90,7 +91,7 @@ fun SmallTitleText(text: String, modifier: Modifier = Modifier, enforceOneLine: Text( modifier = modifier.wrapContentSize(), text = text, - color = MaterialTheme.colorScheme.onSurface, + color = LocalAndroidColorScheme.current.colorOnSurface, style = MaterialTheme.typography.titleSmall, overflow = TextOverflow.Ellipsis, maxLines = if (enforceOneLine) 1 else Int.MAX_VALUE @@ -145,7 +146,7 @@ fun LargeLabelTextOnSurfaceVariant(text: String, modifier: Modifier = Modifier) modifier = modifier.wrapContentSize(), text = text, textAlign = TextAlign.Center, - color = MaterialTheme.colorScheme.onSurfaceVariant, + color = LocalAndroidColorScheme.current.colorOnSurfaceVariant, style = MaterialTheme.typography.labelLarge, ) } diff --git a/packages/CredentialManager/src/com/android/credentialmanager/createflow/CreateCredentialComponents.kt b/packages/CredentialManager/src/com/android/credentialmanager/createflow/CreateCredentialComponents.kt index 648d83268541..66d7db896247 100644 --- a/packages/CredentialManager/src/com/android/credentialmanager/createflow/CreateCredentialComponents.kt +++ b/packages/CredentialManager/src/com/android/credentialmanager/createflow/CreateCredentialComponents.kt @@ -30,7 +30,6 @@ import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.wrapContentHeight import androidx.compose.material3.Divider -import androidx.compose.material3.MaterialTheme import androidx.compose.material.icons.Icons import androidx.compose.material.icons.outlined.NewReleases import androidx.compose.material.icons.filled.Add @@ -67,6 +66,7 @@ import com.android.credentialmanager.common.ui.SheetContainerCard import com.android.credentialmanager.common.ui.PasskeyBenefitRow import com.android.credentialmanager.common.ui.HeadlineText import com.android.credentialmanager.logging.CreateCredentialEvent +import com.android.credentialmanager.ui.theme.LocalAndroidColorScheme import com.android.internal.logging.UiEventLogger.UiEventEnum @Composable @@ -559,7 +559,7 @@ fun CreationSelectionCard( item { Divider( thickness = 1.dp, - color = MaterialTheme.colorScheme.outlineVariant, + color = LocalAndroidColorScheme.current.colorOutlineVariant, modifier = Modifier.padding(vertical = 16.dp) ) } diff --git a/packages/CredentialManager/src/com/android/credentialmanager/ui/theme/AndroidColorScheme.kt b/packages/CredentialManager/src/com/android/credentialmanager/ui/theme/AndroidColorScheme.kt index 8928e1869838..a33904d30393 100644 --- a/packages/CredentialManager/src/com/android/credentialmanager/ui/theme/AndroidColorScheme.kt +++ b/packages/CredentialManager/src/com/android/credentialmanager/ui/theme/AndroidColorScheme.kt @@ -42,6 +42,9 @@ val LocalAndroidColorScheme = class AndroidColorScheme internal constructor(context: Context) { val colorSurfaceBright = getColor(context, R.attr.materialColorSurfaceBright) val colorSurfaceContainerHigh = getColor(context, R.attr.materialColorSurfaceContainerHigh) + val colorOutlineVariant = getColor(context, R.attr.materialColorOutlineVariant) + val colorOnSurface = getColor(context, R.attr.materialColorOnSurface) + val colorOnSurfaceVariant = getColor(context, R.attr.materialColorOnSurfaceVariant) companion object { fun getColor(context: Context, attr: Int): Color { |