Let battery status icon has consist UI in PowerSummaryPage
Change-Id: Ia82adb4a964cb63c656c70a7277c76991c6b2505 Fixes: 76219062 Test: Manual test & make RunSettingsRoboTests
This commit is contained in:
26
res/drawable/ic_battery_status_bad_24dp.xml
Normal file
26
res/drawable/ic_battery_status_bad_24dp.xml
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<!--
|
||||||
|
Copyright (C) 2018 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.
|
||||||
|
-->
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24.0"
|
||||||
|
android:viewportHeight="24.0">
|
||||||
|
|
||||||
|
<path
|
||||||
|
android:fillColor="?attr/batteryBadColor"
|
||||||
|
android:pathData="M15.78,4h-1.72V2h-4.04v2H8.31C7.61,4,7,4.6,7,5.3v15.3C7,21.4,7.61,22,8.31,22h7.37c0.71,0,1.31-0.6,1.31-1.3V5.3
|
||||||
|
C17.09,4.6,16.48,4,15.78,4z M15,14h-2v2h-2v-2H9v-2h2v-2h2v2h2V14z"/>
|
||||||
|
</vector>
|
26
res/drawable/ic_battery_status_good_24dp.xml
Normal file
26
res/drawable/ic_battery_status_good_24dp.xml
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<!--
|
||||||
|
Copyright (C) 2018 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.
|
||||||
|
-->
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24.0"
|
||||||
|
android:viewportHeight="24.0">
|
||||||
|
|
||||||
|
<path
|
||||||
|
android:fillColor="?attr/batteryGoodColor"
|
||||||
|
android:pathData="M15.78,4h-1.72V2h-4.04v2H8.31C7.61,4,7,4.6,7,5.3v15.3C7,21.4,7.61,22,8.31,22h7.37c0.71,0,1.31-0.6,1.31-1.3V5.3
|
||||||
|
C17.09,4.6,16.48,4,15.78,4z M10.94,16.37l-3.18-3.18l1.42-1.42l1.77,1.76l3.9-3.9l1.42,1.42L10.94,16.37z"/>
|
||||||
|
</vector>
|
26
res/drawable/ic_battery_status_maybe_24dp.xml
Normal file
26
res/drawable/ic_battery_status_maybe_24dp.xml
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<!--
|
||||||
|
Copyright (C) 2018 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.
|
||||||
|
-->
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24.0"
|
||||||
|
android:viewportHeight="24.0">
|
||||||
|
|
||||||
|
<path
|
||||||
|
android:fillColor="?attr/batteryMaybeColor"
|
||||||
|
android:pathData="M15.78,4h-1.72V2h-4.04v2H8.31C7.61,4,7,4.6,7,5.3v15.3C7,21.4,7.61,22,8.31,22h7.37c0.71,0,1.31-0.6,1.31-1.3V5.3
|
||||||
|
C17.09,4.6,16.48,4,15.78,4z M13,17.5h-2v-2h2V17.5z M13,13.5h-2v-5h2V13.5z"/>
|
||||||
|
</vector>
|
@@ -174,4 +174,9 @@
|
|||||||
</declare-styleable>
|
</declare-styleable>
|
||||||
|
|
||||||
<attr name="twoStateButtonPreferenceStyle" format="reference" />
|
<attr name="twoStateButtonPreferenceStyle" format="reference" />
|
||||||
|
|
||||||
|
<attr name="batteryGoodColor" format="color" />
|
||||||
|
<attr name="batteryBadColor" format="color" />
|
||||||
|
<attr name="batteryMaybeColor" format="color" />
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
@@ -130,5 +130,12 @@
|
|||||||
|
|
||||||
<color name="glif_error_color">@*android:color/material_red_A700</color>
|
<color name="glif_error_color">@*android:color/material_red_A700</color>
|
||||||
|
|
||||||
|
<color name="battery_good_color_light">#43a047</color> <!-- Material Green 600 -->
|
||||||
|
<color name="battery_maybe_color_light">#ef6c00</color> <!-- Material Orange 800 -->
|
||||||
|
<color name="battery_bad_color_light">#f44336</color> <!-- Material Red 500 -->
|
||||||
|
<color name="battery_good_color_dark">#4caf50</color> <!-- Material Green 500 -->
|
||||||
|
<color name="battery_maybe_color_dark">#fdd835</color> <!-- Material Yellow 600 -->
|
||||||
|
<color name="battery_bad_color_dark">#f44336</color> <!-- Material Red 500 -->
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
||||||
|
@@ -235,6 +235,11 @@
|
|||||||
<item name="android:alertDialogTheme">@style/Theme.AlertDialog</item>
|
<item name="android:alertDialogTheme">@style/Theme.AlertDialog</item>
|
||||||
|
|
||||||
<item name="*android:lockPatternStyle">@style/LockPatternStyle.Setup</item>
|
<item name="*android:lockPatternStyle">@style/LockPatternStyle.Setup</item>
|
||||||
|
|
||||||
|
<!-- For battery status icons in -->
|
||||||
|
<item name="batteryGoodColor">@color/battery_good_color_light</item>
|
||||||
|
<item name="batteryMaybeColor">@color/battery_maybe_color_light</item>
|
||||||
|
<item name="batteryBadColor">@color/battery_bad_color_light</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="Theme.SubSettings" parent="Theme.Settings">
|
<style name="Theme.SubSettings" parent="Theme.Settings">
|
||||||
|
@@ -58,8 +58,8 @@ public class EarlyWarningTip extends BatteryTip {
|
|||||||
@Override
|
@Override
|
||||||
public int getIconId() {
|
public int getIconId() {
|
||||||
return mState == StateType.HANDLED
|
return mState == StateType.HANDLED
|
||||||
? R.drawable.ic_perm_device_information_green_24dp
|
? R.drawable.ic_battery_status_maybe_24dp
|
||||||
: R.drawable.ic_battery_alert_24dp;
|
: R.drawable.ic_battery_status_bad_24dp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -54,7 +54,7 @@ public class SummaryTip extends BatteryTip {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getIconId() {
|
public int getIconId() {
|
||||||
return R.drawable.ic_check_circle_green_24dp;
|
return R.drawable.ic_battery_status_good_24dp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -69,7 +69,7 @@ public class EarlyWarningTipTest {
|
|||||||
|
|
||||||
assertThat(tip.getTitle(mContext)).isEqualTo("Turn on Battery Saver");
|
assertThat(tip.getTitle(mContext)).isEqualTo("Turn on Battery Saver");
|
||||||
assertThat(tip.getSummary(mContext)).isEqualTo("Battery may run out earlier than usual");
|
assertThat(tip.getSummary(mContext)).isEqualTo("Battery may run out earlier than usual");
|
||||||
assertThat(tip.getIconId()).isEqualTo(R.drawable.ic_battery_alert_24dp);
|
assertThat(tip.getIconId()).isEqualTo(R.drawable.ic_battery_status_bad_24dp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -79,7 +79,7 @@ public class EarlyWarningTipTest {
|
|||||||
|
|
||||||
assertThat(tip.getTitle(mContext)).isEqualTo("Battery Saver is on");
|
assertThat(tip.getTitle(mContext)).isEqualTo("Battery Saver is on");
|
||||||
assertThat(tip.getSummary(mContext)).isEqualTo("Some features may be limited");
|
assertThat(tip.getSummary(mContext)).isEqualTo("Some features may be limited");
|
||||||
assertThat(tip.getIconId()).isEqualTo(R.drawable.ic_perm_device_information_green_24dp);
|
assertThat(tip.getIconId()).isEqualTo(R.drawable.ic_battery_status_maybe_24dp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
Reference in New Issue
Block a user