Make QS battery composite color match others.

Change-Id: I2a906cd997d2372f5740532a159f04ad857d393d
This commit is contained in:
John Spurlock
2014-02-04 17:55:47 -05:00
parent 2a1fdefe16
commit 29786fc72d
4 changed files with 12 additions and 2 deletions

View File

@@ -15,6 +15,7 @@
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="top"
@@ -27,6 +28,7 @@
android:layout_height="32dp"
android:padding="3dp"
android:layout_gravity="top|center_horizontal"
systemui:frameColor="@color/qs_batterymeter_frame_color"
/>
<TextView
style="@style/TextAppearance.QuickSettings.TileView"

View File

@@ -42,7 +42,9 @@
<attr name="decayTime" format="integer" />
<attr name="orientation" />
</declare-styleable>
<declare-styleable name="BatteryMeterView">
<attr name="frameColor" format="color" />
</declare-styleable>
<attr name="orientation">
<enum name="horizontal" value="0" />
<enum name="vertical" value="1" />

View File

@@ -35,6 +35,7 @@
<color name="batterymeter_frame_color">#66FFFFFF</color><!-- 40% white -->
<color name="batterymeter_charge_color">#FFFFFFFF</color>
<color name="batterymeter_bolt_color">#FFFFFFFF</color>
<color name="qs_batterymeter_frame_color">#FF404040</color>
<color name="status_bar_clock_color">#FFFFFFFF</color>
<drawable name="notification_item_background_color">#ff111111</drawable>
<drawable name="notification_item_background_color_pressed">#ff454545</drawable>

View File

@@ -177,6 +177,10 @@ public class BatteryMeterView extends View implements DemoMode {
super(context, attrs, defStyle);
final Resources res = context.getResources();
TypedArray atts = context.obtainStyledAttributes(attrs, R.styleable.BatteryMeterView,
defStyle, 0);
final int frameColor = atts.getColor(R.styleable.BatteryMeterView_frameColor,
res.getColor(R.color.batterymeter_frame_color));
TypedArray levels = res.obtainTypedArray(R.array.batterymeter_color_levels);
TypedArray colors = res.obtainTypedArray(R.array.batterymeter_color_values);
@@ -188,6 +192,7 @@ public class BatteryMeterView extends View implements DemoMode {
}
levels.recycle();
colors.recycle();
atts.recycle();
mShowPercent = ENABLE_PERCENT && 0 != Settings.System.getInt(
context.getContentResolver(), "status_bar_show_battery_percent", 0);
if (mShowPercent) {
@@ -196,7 +201,7 @@ public class BatteryMeterView extends View implements DemoMode {
mWarningString = context.getString(R.string.battery_meter_very_low_overlay_symbol);
mFramePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mFramePaint.setColor(res.getColor(R.color.batterymeter_frame_color));
mFramePaint.setColor(frameColor);
mFramePaint.setDither(true);
mFramePaint.setStrokeWidth(0);
mFramePaint.setStyle(Paint.Style.FILL_AND_STROKE);