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:
@@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user