Add animation for battery asyncLoader.

When battery asyncLoader is loading batterystats, show a battery
placeholder(critical level) and animate to real status once data is
loaded.

Bug: 35917699
Test: RunSettingsRoboTests
Change-Id: Ie4ff73ff2cc0b9e17b4541e3284bf2ac34da42c4
Merged-In: Ie4ff73ff2cc0b9e17b4541e3284bf2ac34da42c4
This commit is contained in:
jackqdyulei
2017-04-21 13:12:06 -07:00
parent b296697e8e
commit a3c528f64d
3 changed files with 116 additions and 6 deletions

View File

@@ -38,6 +38,8 @@ public class BatteryMeterView extends ImageView {
@VisibleForTesting
ColorFilter mAccentColorFilter;
private int mLevel;
public BatteryMeterView(Context context) {
this(context, null, 0);
}
@@ -64,6 +66,7 @@ public class BatteryMeterView extends ImageView {
}
public void setBatteryLevel(int level) {
mLevel = level;
mDrawable.setBatteryLevel(level);
if (level < mDrawable.getCriticalLevel()) {
mDrawable.setBatteryColorFilter(mErrorColorFilter);
@@ -72,6 +75,10 @@ public class BatteryMeterView extends ImageView {
}
}
public int getBatteryLevel() {
return mLevel;
}
public void setCharging(boolean charging) {
mDrawable.setCharging(charging);
}