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

Commit 92577269 authored by Stefano Angeleri's avatar Stefano Angeleri
Browse files

Fixed regression: fully charged battery shows as depleted.

The regression was introduced by Change Id9fc63f4: Update BatteryMiniIcon code.
This fixes it so the battery shows as full when it's charged entirely and the device
is connected to external power.

Additionally removes a variable which has become useless with the refactory
done in the change Id9fc63f4

Change-Id: I19d634cb174d2dedd1a450e521e4774f07919f51
parent 4b07670f
Loading
Loading
Loading
Loading
+6 −8
Original line number Diff line number Diff line
@@ -66,11 +66,8 @@ public class CmBatteryMiniIcon extends ImageView {
    // weather to show this battery widget or not
    private boolean mShowCmBattery = false;

    // used for animation
    private long mLastMillis = 0;

    // used for animation
    private int mCurrentFrame;
    // used for animation and still values when not charging/fully charged
    private int mCurrentFrame = 0;

    private boolean mAttached;

@@ -177,6 +174,9 @@ public class CmBatteryMiniIcon extends ImageView {

    private void stopTimer() {
        mHandler.removeCallbacks(onFakeTimer);
        // As the battery is charged or it's not charging
        // apply the current status of the battery.
        mCurrentFrame = mBatteryLevel / 10;
        invalidate();
    }

@@ -220,9 +220,7 @@ public class CmBatteryMiniIcon extends ImageView {
        if (!mAttached || !mShowCmBattery)
            return;

        int frame = (mBatteryPlugged ? mCurrentFrame : mBatteryLevel / 10);

        canvas.drawBitmap(mMiniIconCache[frame], mMatrix, mPaint);
        canvas.drawBitmap(mMiniIconCache[mCurrentFrame], mMatrix, mPaint);
    }

    private int getBatResourceID(int level) {