Refine battery text in battery header

1. When there exists estimate time, show it, otherwise
show battery status label.
2. Change the summary based on whether it is charging.
(Estimated time left vs Time to full charge)

Bug: 35328749
Test: RunSettingsRoboTests
Change-Id: I64ee8acd248062b4effcfc58ed908be7d89621a3
This commit is contained in:
jackqdyulei
2017-02-13 17:33:06 -08:00
parent d72b6cc1e9
commit e2fbdfefef
4 changed files with 36 additions and 12 deletions

View File

@@ -60,7 +60,9 @@ public class BatteryHistoryPreference extends Preference {
view.itemView.setClickable(true);
view.setDividerAllowedAbove(true);
((TextView) view.findViewById(R.id.charge)).setText(mBatteryInfo.batteryPercentString);
((TextView) view.findViewById(R.id.estimation)).setText(mBatteryInfo.remainingLabel);
((TextView) view.findViewById(R.id.estimation)).setText(
mBatteryInfo.remainingLabel != null ?
mBatteryInfo.remainingLabel : mBatteryInfo.statusLabel);
UsageView usageView = (UsageView) view.findViewById(R.id.battery_usage);
usageView.findViewById(R.id.label_group).setAlpha(.7f);
mBatteryInfo.bindHistory(usageView);