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

Commit 1c30cc0e authored by Danny Baumann's avatar Danny Baumann
Browse files

Fix percentage bar not appearing on first try to enable it.

parent b026ff71
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -210,9 +210,14 @@ public class CmBatteryMiniIcon extends ImageView {
    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        final int height = MeasureSpec.getSize(heightMeasureSpec);

        setMeasuredDimension(mWidthPx + mMarginRightPx, height);
    }

    @Override
    protected boolean setFrame(int l, int t, int r, int b) {
        boolean changed = super.setFrame(l, t, r, b);
        updateMatrix();
        return changed;
    }

    @Override
@@ -300,6 +305,7 @@ public class CmBatteryMiniIcon extends ImageView {
    public void updateMatrix() {
        mMatrix.reset();
        mMatrix.setTranslate(0, 0);

        float scaleFactor = getHeight() / (float)(mMiniIconCache[0].getHeight());
        mMatrix.postScale(mWidthPx, scaleFactor);
    }