Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 279661f0 authored by Helen Qin's avatar Helen Qin Committed by Android (Google) Code Review
Browse files

Merge "[CredManUi] Bottom sheet color change" into udc-dev

parents 0cf4143f e7d98867
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<resources>
  <style name="Theme.CredentialSelector" parent="@android:style/ThemeOverlay.Material">
  <style name="Theme.CredentialSelector" parent="@*android:style/ThemeOverlay.DeviceDefault.Accent.DayNight">
    <item name="android:windowContentOverlay">@null</item>
    <item name="android:windowNoTitle">true</item>
    <item name="android:windowBackground">@android:color/transparent</item>
+2 −4
Original line number Diff line number Diff line
@@ -18,7 +18,6 @@ package com.android.credentialmanager.common.ui

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.ColumnScope
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.ui.Modifier
@@ -27,6 +26,7 @@ import com.android.credentialmanager.common.material.ModalBottomSheetLayout
import com.android.credentialmanager.common.material.ModalBottomSheetValue
import com.android.credentialmanager.common.material.rememberModalBottomSheetState
import com.android.credentialmanager.ui.theme.EntryShape
import com.android.credentialmanager.ui.theme.LocalAndroidColorScheme

/** Draws a modal bottom sheet with the same styles and effects shared by various flows. */
@Composable
@@ -39,9 +39,7 @@ fun ModalBottomSheet(
        skipHalfExpanded = true
    )
    ModalBottomSheetLayout(
        sheetBackgroundColor = MaterialTheme.colorScheme.surfaceColorAtElevation(
            ElevationTokens.Level1
        ),
        sheetBackgroundColor = LocalAndroidColorScheme.current.colorSurfaceBright,
        modifier = Modifier.background(Color.Transparent),
        sheetState = state,
        sheetContent = sheetContent,
+2 −4
Original line number Diff line number Diff line
@@ -25,13 +25,13 @@ import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.LazyListScope
import androidx.compose.material3.Card
import androidx.compose.material3.CardDefaults
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
import com.android.credentialmanager.ui.theme.Shapes
import com.android.credentialmanager.ui.theme.LocalAndroidColorScheme

/**
 * Container card for the whole sheet.
@@ -50,9 +50,7 @@ fun SheetContainerCard(
        modifier = modifier.fillMaxWidth().wrapContentHeight(),
        border = null,
        colors = CardDefaults.cardColors(
            containerColor = MaterialTheme.colorScheme.surfaceColorAtElevation(
                ElevationTokens.Level1
            ),
            containerColor = LocalAndroidColorScheme.current.colorSurfaceBright,
        ),
    ) {
        if (topAppBar != null) {
+0 −30
Original line number Diff line number Diff line
/*
 * Copyright (C) 2023 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.credentialmanager.common.ui

import androidx.compose.material3.ColorScheme
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.compositeOver
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import kotlin.math.ln

fun ColorScheme.surfaceColorAtElevation(elevation: Dp): Color {
    if (elevation == 0.dp) return surface
    val alpha = ((4.5f * ln(elevation.value + 1)) + 2f) / 100f
    return surfaceTint.copy(alpha = alpha).compositeOver(surface)
}
 No newline at end of file
+0 −29
Original line number Diff line number Diff line
/*
 * Copyright (C) 2023 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.credentialmanager.common.ui

import androidx.compose.ui.unit.dp

/** Copied from androidx.compose.material3.tokens. */
internal object ElevationTokens {
    val Level0 = 0.0.dp
    val Level1 = 1.0.dp
    val Level2 = 3.0.dp
    val Level3 = 6.0.dp
    val Level4 = 8.0.dp
    val Level5 = 12.0.dp
}
 No newline at end of file
Loading