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

Commit 64fab229 authored by burakov's avatar burakov
Browse files

[flexiglass] Adjust the battery estimate text color based on the theme.

This is conditional on the `notification_shade_blur` flag, as the shade
color prior to that flag is a constant dark color.

Fix: 414751194
Test: Manually tested by opening the shade on both light and dark modes,
 and observing that the estimate text color changed appropriately.
Flag: com.android.systemui.scene_container
Flag: com.android.systemui.notification_shade_blur
Change-Id: I90a0b702089b20297117440fb6820e40deff6152
parent 80ce70aa
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -248,6 +248,7 @@ fun ContentScope.CollapsedShadeHeader(
                            showIcon = true,
                            useExpandedFormat = useExpandedTextFormat,
                            modifier = Modifier.padding(vertical = 8.dp),
                            textColor = Color.White, // Single shade is always in Dark theme
                        )
                    }
                }
@@ -321,6 +322,7 @@ fun ContentScope.ExpandedShadeHeader(
                        viewModel = viewModel,
                        showIcon = true,
                        useExpandedFormat = useExpandedFormat,
                        textColor = Color.White, // Single shade is always in Dark theme
                    )
                }
            }
@@ -550,6 +552,7 @@ private fun BatteryInfo(
    useExpandedFormat: Boolean,
    modifier: Modifier = Modifier,
    isHighlighted: Boolean = false,
    textColor: Color = MaterialTheme.colorScheme.onSurface,
) {
    if (NewStatusBarIcons.isEnabled) {
        BatteryWithEstimate(
@@ -557,6 +560,7 @@ private fun BatteryInfo(
            isDarkProvider = { viewModel.isShadeAreaDark },
            showIcon = showIcon,
            showEstimate = useExpandedFormat,
            textColor = textColor,
            modifier = modifier,
        )
    } else {
+7 −3
Original line number Diff line number Diff line
@@ -24,7 +24,6 @@ import android.app.StatusBarManager
import android.content.Context
import android.content.Intent
import android.content.res.Configuration
import android.graphics.Color
import android.graphics.Insets
import android.os.Bundle
import android.os.Trace
@@ -37,8 +36,10 @@ import android.view.WindowInsets
import android.widget.TextView
import androidx.annotation.VisibleForTesting
import androidx.compose.foundation.layout.wrapContentSize
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.getValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.ComposeView
import androidx.constraintlayout.motion.widget.MotionLayout
import androidx.core.view.doOnLayout
@@ -402,14 +403,14 @@ constructor(
        if (notificationShadeBlur()) {
            header.context.getColor(com.android.internal.R.color.materialColorSurfaceDim)
        } else {
            Color.BLACK
            android.graphics.Color.BLACK
        }

    private fun getFgColor() =
        if (notificationShadeBlur()) {
            header.context.getColor(com.android.internal.R.color.materialColorOnSurface)
        } else {
            Color.WHITE
            android.graphics.Color.WHITE
        }

    private fun createBatteryComposeView(): ComposeView {
@@ -440,6 +441,9 @@ constructor(
                            modifier = Modifier.wrapContentSize(),
                            viewModelFactory = unifiedBatteryViewModelFactory,
                            isDarkProvider = { IsAreaDark { true } },
                            textColor =
                                if (notificationShadeBlur()) MaterialTheme.colorScheme.onSurface
                                else Color.White,
                            showEstimate = showBatteryEstimate,
                        )
                    }
+2 −1
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ import com.android.systemui.statusbar.pipeline.battery.ui.viewmodel.UnifiedBatte
fun BatteryWithEstimate(
    viewModelFactory: UnifiedBatteryViewModel.Factory,
    isDarkProvider: () -> IsAreaDark,
    textColor: Color,
    showEstimate: Boolean,
    modifier: Modifier = Modifier,
    showIcon: Boolean = true,
@@ -64,7 +65,7 @@ fun BatteryWithEstimate(
            viewModel.batteryTimeRemainingEstimate?.let {
                Text(
                    text = it,
                    color = Color.White,
                    color = textColor,
                    style = MaterialTheme.typography.bodyMediumEmphasized,
                    maxLines = 1,
                )