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

Commit b4c703b8 authored by Evan Laird's avatar Evan Laird
Browse files

Turn off LAYER_TYPE_SOFTWARE on BatteryMeterView

We still need to save a layer for the BlendMode.CLEAR paint to do the
right thing. But with this we can save just the layer needed to draw the
battery instead of the whole battery meter view.

Test: visual
Change-Id: I9d5844440250ccd9174e6c001e051c9adf62a2d0
parent d9246ef1
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -172,6 +172,7 @@ open class ThemedBatteryDrawable(private val context: Context, frameColor: Int)
    }

    override fun draw(c: Canvas) {
        c.saveLayer(null, null)
        unifiedPath.reset()
        levelPath.reset()
        levelRect.set(fillRect)
@@ -248,6 +249,7 @@ open class ThemedBatteryDrawable(private val context: Context, frameColor: Int)
            c.clipOutPath(scaledPlus)
            c.drawPath(scaledPlus, fillColorStrokeProtection)
        }
        c.restore()
    }

    private fun batteryColorForLevel(level: Int): Int {
+0 −4
Original line number Diff line number Diff line
@@ -176,10 +176,6 @@ public class BatteryMeterView extends LinearLayout implements
        setClipChildren(false);
        setClipToPadding(false);
        Dependency.get(ConfigurationController.class).observe(viewAttachLifecycle(this), this);

        // Needed for PorderDuff.Mode.CLEAR operations to work properly, but redraws don't happen
        // enough to justify a hardware layer.
        setLayerType(LAYER_TYPE_SOFTWARE, null);
    }

    private void setupLayoutTransition() {