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

Commit 622656f8 authored by Michael W's avatar Michael W Committed by Joey Rizzoli
Browse files

SystemUI: Improve battery icons

* When the battery saver is on, always show the percentage (if option is
  set)
* Change color of exclamation mark when the battery saver is on so it's
  visible

Change-Id: Ia7e6bc05225b131aaa62370314b035f2b874b5ec
parent 43d2ed5e
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -195,7 +195,6 @@ public class BatteryMeterDrawable extends Drawable implements
                ? mCurrentFillColor : res.getColor(R.color.batterymeter_bolt_color));

        mWarningTextPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
        mWarningTextPaint.setColor(mColors[1]);
        font = Typeface.create("sans-serif", Typeface.BOLD);
        mWarningTextPaint.setTypeface(font);
        mWarningTextPaint.setTextAlign(getPaintAlignmentFromGravity(mTextGravity));
@@ -634,13 +633,16 @@ public class BatteryMeterDrawable extends Drawable implements

    private void drawPercentageText(Canvas canvas) {
        final int level = mLevel;
        if (level > mCriticalLevel && mShowPercent && level != 100) {
        if ((level > mCriticalLevel || mPowerSaveEnabled) && mShowPercent && level != 100) {
            // Draw the percentage text
            String pctText = String.valueOf(SINGLE_DIGIT_PERCENT ? (level / 10) : level);
            mTextAndBoltPaint.setColor(getColorForLevel(level));
            canvas.drawText(pctText, mTextX, mTextY, mTextAndBoltPaint);
        } else if (level <= mCriticalLevel) {
            // Draw the warning text
            mWarningTextPaint.setColor(mPowerSaveEnabled
                    ? mColors[mColors.length - 1]
                    : mColors[1]);
            canvas.drawText(mWarningString, mTextX, mTextY, mWarningTextPaint);
        }
    }