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

Commit 453e8f21 authored by d34d's avatar d34d Committed by Clark Scheff
Browse files

SysUI: Fix coloring of battery drawables

The frame color is now correctly tinted based on background color
set by setDarkIntensity()

Battery bolt and percentage text have their alpha set to full opacity
to increase visibility when drawn on a light colored status bar.

Change-Id: I907101ed1465f99b92370332d4839b7f0aad13b2
parent e3ddac3a
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -20,9 +20,10 @@
    android:viewportWidth="24"
    android:viewportHeight="24">

    <!-- Path will be tinted based on dual tone color -->
    <path
        android:name="frame"
        android:strokeColor="@color/batterymeter_frame_color"
        android:strokeColor="#000000"
        android:strokeLineJoin="round"
        android:strokeWidth="3"
        android:pathData="@string/battery_circle_path"/>
+2 −1
Original line number Diff line number Diff line
@@ -24,8 +24,9 @@
        android:name="mask"
        android:pathData="@string/battery_landscape_clip_path" />

    <!-- Path will be tinted based on dual tone color -->
    <path
        android:name="frame"
        android:fillColor="@color/batterymeter_frame_color"
        android:fillColor="#000000"
        android:pathData="M 1 4 H 25 V 20 H 1 V 4 Z" />
</vector>
 No newline at end of file
+2 −1
Original line number Diff line number Diff line
@@ -24,9 +24,10 @@
        android:name="mask"
        android:pathData="@string/battery_portrait_clip_path" />

    <!-- Path will be tinted based on dual tone color -->
    <path
        android:name="frame"
        android:fillColor="@color/batterymeter_frame_color"
        android:fillColor="#000000"
        android:pathData="M19,2v19H5V2H19z" />

</vector>
 No newline at end of file
+5 −2
Original line number Diff line number Diff line
@@ -537,7 +537,9 @@ public class BatteryMeterView extends View implements DemoMode,
        @Override
        public void setDarkIntensity(int backgroundColor, int fillColor) {
            mIconTint = fillColor;
            mBoltDrawable.setTint(fillColor);
            // make bolt drawable tint fully opaque so it stands out
            mBoltDrawable.setTint(0xff000000 | fillColor);
            mFrameDrawable.setTint(backgroundColor);
            updateBoltDrawableLayer(mBatteryDrawable, mBoltDrawable);
            invalidate();
        }
@@ -660,7 +662,8 @@ public class BatteryMeterView extends View implements DemoMode,
                    && (mShowPercent && !(level == 100 && !SHOW_100_PERCENT))) {
                // draw the percentage text
                String pctText = String.valueOf(SINGLE_DIGIT_PERCENT ? (level/10) : level);
                mTextAndBoltPaint.setColor(getColorForLevel(level));
                // make paint color fully opaque so text stands out better
                mTextAndBoltPaint.setColor(0xff000000 | getColorForLevel(level));
                canvas.drawText(pctText, mTextX, mTextY, mTextAndBoltPaint);
            } else if (level <= mCriticalLevel) {
                // draw the warning text