Revamp battery Ui in low battery mode

This cl refine battery icon ui in low battery mode:
1. Should show indicator(fixed in ag/2035178)
2. Show bolt icon when charging
3. When battery is low, set battery background as red and indicator
as white.

This cl also includes the field updates for battery.

Bug: 36862496
Test: RunSettingsRoboTests
Change-Id: Ifb2ed339742119bbff78712df09288b895756b1f
This commit is contained in:
jackqdyulei
2017-04-04 10:03:14 -07:00
parent 66871d8531
commit f8e6f43425
7 changed files with 138 additions and 27 deletions

View File

@@ -568,14 +568,15 @@ public class PowerUsageSummary extends PowerUsageBase {
.findViewById(R.id.battery_header_icon);
final TextView timeText = (TextView) mBatteryLayoutPref.findViewById(R.id.battery_percent);
final TextView summary1 = (TextView) mBatteryLayoutPref.findViewById(R.id.summary1);
timeText.setText(Utils.formatPercentage(info.mBatteryLevel));
timeText.setText(Utils.formatPercentage(info.batteryLevel));
if (info.remainingLabel == null ) {
summary1.setText(info.statusLabel);
} else {
summary1.setText(info.remainingLabel);
}
batteryView.setBatteryInfo(info.mBatteryLevel);
batteryView.setBatteryLevel(info.batteryLevel);
batteryView.setCharging(!info.discharging);
}
@VisibleForTesting
@@ -736,7 +737,7 @@ public class PowerUsageSummary extends PowerUsageBase {
BatteryInfo.getBatteryInfo(mContext, new BatteryInfo.Callback() {
@Override
public void onBatteryInfoLoaded(BatteryInfo info) {
mLoader.setSummary(SummaryProvider.this, info.mChargeLabelString);
mLoader.setSummary(SummaryProvider.this, info.chargeLabelString);
}
});
}