Tweak battery usage to match red lines.

Most of this is done, the main thing missing is the color
of the bars which seems like a framework issue.

Note that this introduces a change to the global theme
making colorControlActivated the specified blue color,
which impacts all of the settings UI.  (Except apparently
progress bars, and thus the bug.)

Change-Id: I4a5ca8c3b94dc23b8f065f60fe697ee0e76ff47d
This commit is contained in:
Dianne Hackborn
2014-05-30 17:59:27 -07:00
parent a391d9c6ac
commit 7158e62992
12 changed files with 237 additions and 130 deletions

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2011 The Android Open Source Project
<!-- Copyright (C) 2014 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -16,22 +16,19 @@
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background">
<shape>
<solid android:color="#ff28262c" />
</shape>
<nine-patch android:src="@*android:drawable/progress_qntm_alpha"
android:tint="@color/quantum_empty_color_light" />
</item>
<item android:id="@android:id/secondaryProgress">
<clip>
<shape>
<solid android:color="#c050ade5" />
</shape>
</clip>
<scale android:scaleWidth="100%">
<nine-patch android:src="@*android:drawable/progress_qntm_alpha"
android:tint="?android:attr/colorControlActivated" />
</scale>
</item>
<item android:id="@android:id/progress">
<clip>
<shape>
<solid android:color="#c050ade5" />
</shape>
</clip>
<scale android:scaleWidth="100%">
<nine-patch android:src="@*android:drawable/progress_primary_qntm_alpha"
android:tint="?android:attr/colorControlActivated" />
</scale>
</item>
</layer-list>

View File

@@ -45,16 +45,16 @@
<TextView
android:id="@android:id/text1"
android:layout_marginStart="8dip"
android:layout_marginStart="6dip"
android:layout_marginTop="2dip"
android:textAppearance="?android:attr/textAppearanceSmall" />
<ProgressBar
android:id="@android:id/progress"
android:layout_height="12dip"
android:layout_height="8dip"
android:layout_columnSpan="2"
android:layout_gravity="fill_horizontal|top"
android:layout_marginTop="4dip"
android:layout_marginTop="8dip"
android:max="100"
android:progressDrawable="@drawable/data_usage_bar"
style="?android:attr/progressBarStyleHorizontal" />
@@ -64,7 +64,7 @@
android:layout_width="0dip"
android:layout_gravity="fill_horizontal|top"
android:layout_columnSpan="2"
android:layout_marginTop="4dip"
android:layout_marginTop="6dip"
android:visibility="gone"
android:maxLines="2"
android:textAppearance="?android:attr/textAppearanceSmall" />

View File

@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2014 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<com.android.settings.fuelgauge.BatteryHistoryChart
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res/com.android.settings"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:id="@+android:id/battery_history_chart"
android:paddingEnd="?android:attr/scrollbarSize"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#ff000000"
app:headerAppearance="?android:attr/textAppearanceMedium"
android:shadowRadius="4"
android:shadowColor="?android:attr/colorBackground"
android:shadowDx="2"
android:shadowDy="2"
app:barPrimaryColor="?android:attr/colorControlActivated"
app:barPredictionColor="@color/quantum_empty_color_light"
app:chartMinHeight="@dimen/battery_history_chart_height">
</com.android.settings.fuelgauge.BatteryHistoryChart>

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2010 The Android Open Source Project
<!-- Copyright (C) 2014 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -14,19 +14,18 @@
limitations under the License.
-->
<com.android.settings.fuelgauge.BatteryHistoryChart
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res/com.android.settings"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="@dimen/battery_history_chart_height"
android:gravity="center_vertical"
android:id="@+android:id/battery_history_chart"
android:paddingEnd="?android:attr/scrollbarSize"
android:textAppearance="?android:attr/textAppearanceSmall"
app:headerAppearance="?android:attr/textAppearanceMedium"
android:shadowRadius="4"
android:shadowColor="?android:attr/colorBackground"
android:shadowDx="2"
android:shadowDy="2">
</com.android.settings.fuelgauge.BatteryHistoryChart>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:minHeight="@dimen/battery_history_chart_height"
android:paddingEnd="?android:attr/scrollbarSize">
<include layout="@layout/battery_history_chart" />
<TextView android:id="@+id/labelsHeader"
android:layout_width="match_parent" android:layout_height="48dp"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="14sp"
android:textColor="?android:attr/colorControlActivated"
android:gravity="left|center_vertical"
android:text="@string/power_usage_list_summary" />
</LinearLayout>

View File

@@ -43,6 +43,12 @@
<attr name="android:shadowRadius" />
<!-- Text color, typeface, size, and style of header. -->
<attr name="headerAppearance" format="reference" />
<!-- Primary color of chart. -->
<attr name="barPrimaryColor" format="color|reference" />
<!-- Color of predicted future use part of chart. -->
<attr name="barPredictionColor" format="color|reference" />
<!-- Minimum height of the chart itself. -->
<attr name="chartMinHeight" format="dimension|reference" />
</declare-styleable>
<declare-styleable name="PercentageBarChart">

View File

@@ -57,6 +57,10 @@
<color name="quantum_orange_A200">#ffffab40</color>
<color name="quantum_orange_A400">#ffff9100</color>
<color name="quantum_accent_color_light">#FF009688</color>
<color name="quantum_accent_color_dark">#FF80CBC4</color>
<color name="quantum_empty_color_light">#FFCED7DB</color>
<color name="actionbar_background_color">#ff263238</color>
<color name="dashboard_background_color">#ffe1e1e0</color>
<color name="switch_bar_background_color">#ff384248</color>

View File

@@ -3529,8 +3529,18 @@
<xliff:g id="state">%2$s</xliff:g></string>
<!-- [CHAR_LIMIT=40] Label for battery level chart when charging with duration -->
<string name="power_charging_duration"><xliff:g id="level">%1$d</xliff:g>%% -
<xliff:g id="state">%2$s</xliff:g>
(<xliff:g id="time">%3$s</xliff:g> until full)</string>
<xliff:g id="time">%2$s</xliff:g> until full</string>
<!-- [CHAR_LIMIT=40] Label for battery level chart when charging with duration -->
<string name="power_charging_duration_ac"><xliff:g id="level">%1$d</xliff:g>%% -
<xliff:g id="time">%2$s</xliff:g> until full on AC</string>
<!-- [CHAR_LIMIT=40] Label for battery level chart when charging with duration -->
<string name="power_charging_duration_usb"><xliff:g id="level">%1$d</xliff:g>%% -
<xliff:g id="time">%2$s</xliff:g> until full over USB</string>
<!-- [CHAR_LIMIT=40] Label for battery level chart when charging with duration -->
<string name="power_charging_duration_wireless"><xliff:g id="level">%1$d</xliff:g>%% -
<xliff:g id="time">%2$s</xliff:g> until full from wireless</string>
<!-- [CHAR_LIMIT=40] Label for list of apps using battery in power use UI -->
<string name="power_usage_list_summary">Use since last full charge</string>
<!-- Battery usage since unplugged -->
<string name="battery_since_unplugged">Battery use since unplugged</string>
<!-- Battery usage since user reset the stats -->

View File

@@ -91,6 +91,8 @@
<item name="android:colorAccent">@color/quantum_orange_A200</item>
<!-- Redefine the ActionBar style for contentInsetStart -->
<item name="android:actionBarStyle">@style/Theme.ActionBar</item>
<!-- Redefine control activited color for progress bars and the like -->
<item name="android:colorControlActivated">@color/quantum_accent_color_light</item>
</style>
<style name="Theme.ActionBar" parent="@android:style/Widget.Quantum.Light.ActionBar.Solid">