diff options
4 files changed, 21 insertions, 7 deletions
diff --git a/packages/SystemUI/res/drawable/ic_battery_circle_frame.xml b/packages/SystemUI/res/drawable/ic_battery_circle_frame.xml index 8528c00a264..675c0304cb8 100644 --- a/packages/SystemUI/res/drawable/ic_battery_circle_frame.xml +++ b/packages/SystemUI/res/drawable/ic_battery_circle_frame.xml @@ -20,9 +20,10 @@ android:viewportWidth="24" android:viewportHeight="24"> + <!-- Path will be tinted based on light/dark modes --> <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"/> diff --git a/packages/SystemUI/res/drawable/ic_battery_landscape_frame.xml b/packages/SystemUI/res/drawable/ic_battery_landscape_frame.xml index 789316f5bb0..bb667978a0e 100644 --- a/packages/SystemUI/res/drawable/ic_battery_landscape_frame.xml +++ b/packages/SystemUI/res/drawable/ic_battery_landscape_frame.xml @@ -24,8 +24,9 @@ android:name="mask" android:pathData="@string/battery_landscape_clip_path" /> + <!-- Path will be tinted based on light/dark modes --> <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 diff --git a/packages/SystemUI/res/drawable/ic_battery_portrait_frame.xml b/packages/SystemUI/res/drawable/ic_battery_portrait_frame.xml index f530727f3ec..6bf92fb5891 100644 --- a/packages/SystemUI/res/drawable/ic_battery_portrait_frame.xml +++ b/packages/SystemUI/res/drawable/ic_battery_portrait_frame.xml @@ -24,9 +24,10 @@ android:name="mask" android:pathData="@string/battery_portrait_clip_path" /> + <!-- Path will be tinted based on light/dark modes --> <path android:name="frame" - android:fillColor="@color/batterymeter_frame_color" + android:fillColor="#000000" android:pathData="M19,2v19H5V2H19z" /> </vector>
\ No newline at end of file diff --git a/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java b/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java index 7440fc542a7..06c29577d75 100755 --- a/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java +++ b/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java @@ -94,6 +94,9 @@ public class BatteryMeterView extends View implements DemoMode, private BatteryMeterDrawable mBatteryMeterDrawable; private int mIconTint = Color.WHITE; + private int mCurrentBackgroundColor = 0; + private int mCurrentFillColor = 0; + protected class BatteryTracker extends BroadcastReceiver { public static final int UNKNOWN_LEVEL = -1; @@ -395,9 +398,9 @@ public class BatteryMeterView extends View implements DemoMode, public void setDarkIntensity(float darkIntensity) { if (mBatteryMeterDrawable != null) { - int backgroundColor = getBackgroundColor(darkIntensity); - int fillColor = getFillColor(darkIntensity); - mBatteryMeterDrawable.setDarkIntensity(backgroundColor, fillColor); + mCurrentBackgroundColor = getBackgroundColor(darkIntensity); + mCurrentFillColor = getFillColor(darkIntensity); + mBatteryMeterDrawable.setDarkIntensity(mCurrentBackgroundColor, mCurrentFillColor); } } @@ -511,6 +514,9 @@ public class BatteryMeterView extends View implements DemoMode, mTextAndBoltPaint.setTypeface(font); mTextAndBoltPaint.setTextAlign(getPaintAlignmentFromGravity(mTextGravity)); mTextAndBoltPaint.setXfermode(new PorterDuffXfermode(xferMode)); + mTextAndBoltPaint.setColor(mCurrentFillColor != 0 + ? mCurrentFillColor + : res.getColor(R.color.batterymeter_bolt_color)); mWarningTextPaint = new Paint(Paint.ANTI_ALIAS_FLAG); mWarningTextPaint.setColor(mColors[1]); @@ -544,7 +550,9 @@ public class BatteryMeterView extends View implements DemoMode, @Override public void setDarkIntensity(int backgroundColor, int fillColor) { mIconTint = fillColor; - mBoltDrawable.setTint(fillColor); + // Make bolt fully opaque for increased visibility + mBoltDrawable.setTint(0xff000000 | fillColor); + mFrameDrawable.setTint(backgroundColor); updateBoltDrawableLayer(mBatteryDrawable, mBoltDrawable); invalidate(); } @@ -628,6 +636,9 @@ public class BatteryMeterView extends View implements DemoMode, int drawableResId = getBatteryDrawableResourceForMode(mode); mBatteryDrawable = (LayerDrawable) res.getDrawable(drawableResId); mFrameDrawable = mBatteryDrawable.findDrawableByLayerId(R.id.battery_frame); + mFrameDrawable.setTint(mCurrentBackgroundColor != 0 + ? mCurrentBackgroundColor + : res.getColor(R.color.batterymeter_frame_color)); // set the animated vector drawable we will be stop animating Drawable levelDrawable = mBatteryDrawable.findDrawableByLayerId(R.id.battery_fill); mLevelDrawable = new StopMotionVectorDrawable(levelDrawable); |