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

Commit 0914f46f authored by Robert Burns's avatar Robert Burns
Browse files

Fix battery status on the lockscreen

- The low battery icon wasn't being displayed properly
- Changed the term "Discharging" to "Battery", not sure why I didn't do this to begin with

Change-Id: I3eb5862742664f4c02486f3a6fd37c8c73845ac0
parent ec458821
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1495,7 +1495,7 @@
    <!-- When the lock screen is showing and the phone plugged in, and the battery
         is not fully charged, show the current charge %.  -->
    <string name="lockscreen_plugged_in">Charging (<xliff:g id="number">%d</xliff:g><xliff:g id="percent">%%</xliff:g>)</string>
    <string name="lockscreen_discharging">Discharging (<xliff:g id="number">%d</xliff:g><xliff:g id="percent">%%</xliff:g>)</string>
    <string name="lockscreen_discharging">Battery (<xliff:g id="number">%d</xliff:g><xliff:g id="percent">%%</xliff:g>)</string>
    <!-- When the lock screen is showing, the phone is plugged in and the battery is fully
         charged, say that it is charged. -->
    <string name="lockscreen_charged">Charged.</string>
+4 −6
Original line number Diff line number Diff line
@@ -654,12 +654,6 @@ class LockScreen extends LinearLayout implements KeyguardScreen, KeyguardUpdateM
        if (mPluggedIn) {
            mChargingIcon =
                getContext().getResources().getDrawable(R.drawable.ic_lock_idle_charging);
        } else {
            mChargingIcon =
                getContext().getResources().getDrawable(R.drawable.ic_lock_idle_discharging);
        }

        if (mPluggedIn) {
            if (mBatteryLevel >= 100) {
                mCharging = getContext().getString(R.string.lockscreen_charged);
            } else {
@@ -667,8 +661,12 @@ class LockScreen extends LinearLayout implements KeyguardScreen, KeyguardUpdateM
            }
        } else {
            if (mBatteryLevel <= 20) {
                mChargingIcon =
                    getContext().getResources().getDrawable(R.drawable.ic_lock_idle_low_battery);
                mCharging = getContext().getString(R.string.lockscreen_low_battery, mBatteryLevel);
            } else {
                mChargingIcon =
                    getContext().getResources().getDrawable(R.drawable.ic_lock_idle_discharging);
                mCharging = getContext().getString(R.string.lockscreen_discharging, mBatteryLevel);
            }
        }