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

Commit 16c25962 authored by Jeffrey Young's avatar Jeffrey Young
Browse files

Set clock and date color in ShadeHeader

Clock and date color should be:

Collapsed:
Light theme: black
Dark theme: white

Expanded:
colorScheme.onSurface

The underlying scrim will provide enough contrast for the time/date to
always be visible against the user's wallpaper.

This is currently broken when Quick Settings is fully expanded in light
theme, as the underlying scrim is not properly visible. See: b/399112904

Bug: 433932732
Test: clock/date text color is set correctly in quick settings
Flag: com.android.systemui.scene_container
Change-Id: Ie289d14ac38d6eb984c06c3d41926c81ac493d5e
parent 0e796427
Loading
Loading
Loading
Loading
+9 −6
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import androidx.compose.animation.core.Animatable
import androidx.compose.animation.core.CubicBezierEasing
import androidx.compose.animation.core.tween
import androidx.compose.foundation.clickable
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
@@ -72,7 +73,6 @@ import com.android.compose.animation.scene.ValueKey
import com.android.compose.animation.scene.animateElementFloatAsState
import com.android.compose.animation.scene.content.state.TransitionState
import com.android.compose.modifiers.thenIf
import com.android.compose.theme.colorAttr
import com.android.internal.policy.SystemBarUtils
import com.android.settingslib.Utils
import com.android.systemui.battery.BatteryMeterView
@@ -192,6 +192,8 @@ fun ContentScope.CollapsedShadeHeader(
            }
        }

    val textColor = if (isSystemInDarkTheme()) Color.White else Color.Black

    // This layout assumes it is globally positioned at (0, 0) and is the same size as the screen.
    CutoutAwareShadeHeader(
        modifier = modifier.sysuiResTag(ShadeHeader.TestTags.Root),
@@ -201,11 +203,11 @@ fun ContentScope.CollapsedShadeHeader(
                horizontalArrangement = Arrangement.spacedBy(5.dp),
                modifier = Modifier.padding(horizontal = horizontalPadding),
            ) {
                Clock(onClick = viewModel::onClockClicked)
                Clock(onClick = viewModel::onClockClicked, textColor = textColor)
                VariableDayDate(
                    longerDateText = viewModel.longerDateText,
                    shorterDateText = viewModel.shorterDateText,
                    textColor = colorAttr(android.R.attr.textColorPrimary),
                    textColor = textColor,
                    modifier = Modifier.element(ShadeHeader.Elements.CollapsedContentStart),
                )
            }
@@ -251,7 +253,7 @@ fun ContentScope.CollapsedShadeHeader(
                            showIcon = true,
                            useExpandedFormat = useExpandedTextFormat,
                            modifier = Modifier.padding(vertical = 8.dp),
                            textColor = Color.White, // Single shade is always in Dark theme
                            textColor = textColor,
                        )
                    }
                }
@@ -291,6 +293,7 @@ fun ContentScope.ExpandedShadeHeader(
                    onClick = viewModel::onClockClicked,
                    modifier = Modifier.align(Alignment.CenterStart),
                    scale = 2.57f,
                    textColor = MaterialTheme.colorScheme.onSurface,
                )
                Box(
                    modifier =
@@ -310,7 +313,7 @@ fun ContentScope.ExpandedShadeHeader(
                VariableDayDate(
                    longerDateText = viewModel.longerDateText,
                    shorterDateText = viewModel.shorterDateText,
                    textColor = colorAttr(android.R.attr.textColorPrimary),
                    textColor = MaterialTheme.colorScheme.onSurface,
                    modifier = Modifier.widthIn(max = 90.dp),
                )
                ShadeHighlightChip {
@@ -327,7 +330,7 @@ fun ContentScope.ExpandedShadeHeader(
                        viewModel = viewModel,
                        showIcon = true,
                        useExpandedFormat = useExpandedFormat,
                        textColor = Color.White, // Single shade is always in Dark theme
                        textColor = MaterialTheme.colorScheme.onSurface,
                    )
                }
            }