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

Commit 9dc22f4f authored by Evan Laird's avatar Evan Laird
Browse files

Battery drawable powersave tweaks

- No more fill protection around the plus sign
- slightly smaller plus sign
- fixed colorError in qs_theme

Test: visual
Fixes: 129482847
Change-Id: Ice318ef9be1f587fa7f1ef41196d16be4edb4255
parent 8f4ef3b3
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -3961,7 +3961,7 @@
        M5,17.5 V12 H3 L7,4.5 V10 h2 L5,17.5 z
    </string>
    <string name="config_batterymeterPowersavePath" translatable="false">
		M9.75,10l-2.5,0l0,-2.5l-2.5,0l0,2.5l-2.5,0l0,2.5l2.5,0l0,2.5l2.5,0l0,-2.5l2.5,0z
        M9,10l-2,0l0,-2l-2,0l0,2l-2,0l0,2l2,0l0,2l2,0l0,-2l2,0z
    </string>

    <!-- A dual tone battery meter draws the perimeter path twice - once to define the shape
+4 −9
Original line number Diff line number Diff line
@@ -130,11 +130,12 @@ open class ThemedBatteryDrawable(private val context: Context, frameColor: Int)
    }

    private val errorPaint = Paint(Paint.ANTI_ALIAS_FLAG).also { p ->
        p.color = Utils.getColorErrorDefaultColor(context)
        p.color = Utils.getColorStateListDefaultColor(context, R.color.batterymeter_plus_color)
        p.alpha = 255
        p.isDither = true
        p.strokeWidth = 0f
        p.style = Paint.Style.FILL_AND_STROKE
        p.blendMode = BlendMode.SRC
    }

    // Only used if dualTone is set to true
@@ -201,10 +202,6 @@ open class ThemedBatteryDrawable(private val context: Context, frameColor: Int)
            if (!invertFillIcon) {
                c.drawPath(scaledBolt, fillPaint)
            }
        } else if (powerSaveEnabled) {
            // Clip out the plus shape
            unifiedPath.op(scaledPlus, Path.Op.DIFFERENCE)
            c.drawPath(scaledPlus, errorPaint)
        }

        if (dualTone) {
@@ -243,10 +240,8 @@ open class ThemedBatteryDrawable(private val context: Context, frameColor: Int)
        } else if (powerSaveEnabled) {
            // If power save is enabled draw the perimeter path with colorError
            c.drawPath(scaledPerimeter, errorPaint)

            // But always put path protection around the plus sign
            c.clipOutPath(scaledPlus)
            c.drawPath(scaledPlus, fillColorStrokeProtection)
            // And draw the plus sign on top of the fill
            c.drawPath(scaledPlus, errorPaint)
        }
    }

+1 −0
Original line number Diff line number Diff line
@@ -316,6 +316,7 @@
    <style name="qs_theme" parent="@*android:style/Theme.DeviceDefault.QuickSettings">
        <item name="lightIconTheme">@style/QSIconTheme</item>
        <item name="darkIconTheme">@style/QSIconTheme</item>
        <item name="android:colorError">@*android:color/error_color_material_dark</item>
        <item name="android:windowIsFloating">true</item>
    </style>