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

Unverified Commit 188fd0d8 authored by LuK1337's avatar LuK1337
Browse files

fixup! SystemUI: Bring back good ol' circle battery style once again

Color arc red if level <= 20 and charging/powersave isn't active to
match 23.0.

Fixes: https://gitlab.com/LineageOS/issues/android/-/issues/9866
Change-Id: I40c15fca2413f52609b7184d87a77d1e04b41241
parent 89d94788
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.systemui.statusbar.pipeline.battery.ui.composable
import android.graphics.Rect
import androidx.compose.foundation.Canvas
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableFloatStateOf
@@ -427,6 +428,7 @@ fun CircleBatteryBody(
    modifier: Modifier = Modifier,
    contentDescription: String = "",
) {
    val colorError = MaterialTheme.colorScheme.error
    val textMeasurer = rememberTextMeasurer()

    Canvas(modifier = modifier, contentDescription = contentDescription) {
@@ -445,7 +447,11 @@ fun CircleBatteryBody(
        // Draw colored arc representing charge level
        if (level != null && level > 0) {
            drawArc(
                colors.attribution,
                if (level <= 20 && attr !is BatteryGlyph.Bolt && attr !is BatteryGlyph.Plus) {
                    colorError
                } else {
                    colors.attribution
                },
                270f,
                3.6f * level,
                useCenter = false,