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

Commit a1bab878 authored by DvTonder's avatar DvTonder
Browse files

Fix battery % always showing at < 100%

Change-Id: I9ce697e824e1f85becfd0e53519d3ae36fc65758
parent 8df5ba9c
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -2894,6 +2894,12 @@ public final class Settings {
         */
        public static final String EGG_MODE = "egg_mode";

        /**
         * Status bar battery %
         * @hide
         */
        public static final String STATUS_BAR_SHOW_BATTERY_PERCENT = "status_bar_show_battery_percent";

        /**
         * Settings to backup. This is here so that it's in the same place as the settings
         * keys and easy to update.
@@ -2966,6 +2972,7 @@ public final class Settings {
            PHONE_BLACKLIST_PRIVATE_NUMBER_MODE,
            PHONE_BLACKLIST_UNKNOWN_NUMBER_MODE,
            PHONE_BLACKLIST_REGEX_ENABLED,
            STATUS_BAR_SHOW_BATTERY_PERCENT,
        };

        /**
+2 −2
Original line number Diff line number Diff line
@@ -158,7 +158,7 @@ public class BatteryMeterView extends View implements DemoMode,
    private ContentObserver mObserver = new ContentObserver(new Handler()) {
        public void onChange(boolean selfChange, Uri uri) {
            mShowPercent = ENABLE_PERCENT && 0 != Settings.System.getInt(
                getContext().getContentResolver(), "status_bar_show_battery_percent", 0);
                getContext().getContentResolver(), Settings.System.STATUS_BAR_SHOW_BATTERY_PERCENT, 0);
            postInvalidate();
        }
    };
@@ -412,7 +412,7 @@ public class BatteryMeterView extends View implements DemoMode,
        float pctX = 0, pctY = 0;
        String pctText = null;
        if (!tracker.plugged && level > mCriticalLevel && (mShowPercent
                || !(tracker.level == 100 && !SHOW_100_PERCENT))) {
                && !(tracker.level == 100 && !SHOW_100_PERCENT))) {
            mTextPaint.setColor(getColorForLevel(level));
            mTextPaint.setTextSize(height *
                    (SINGLE_DIGIT_PERCENT ? 0.75f