Update battery charge/drain label.

Match UX spec.

Change-Id: If1408458d488ac2ae3a63449e44ff18fc56e08d5
This commit is contained in:
Dianne Hackborn
2014-04-29 11:24:06 -07:00
parent d30acb2eaf
commit 525f2bdfd2
4 changed files with 44 additions and 77 deletions

View File

@@ -444,9 +444,13 @@ public class Utils {
}
public static String getBatteryPercentage(Intent batteryChangedIntent) {
return String.valueOf(getBatteryLevel(batteryChangedIntent)) + "%";
}
public static int getBatteryLevel(Intent batteryChangedIntent) {
int level = batteryChangedIntent.getIntExtra(BatteryManager.EXTRA_LEVEL, 0);
int scale = batteryChangedIntent.getIntExtra(BatteryManager.EXTRA_SCALE, 100);
return String.valueOf(level * 100 / scale) + "%";
return (level * 100) / scale;
}
public static String getBatteryStatus(Resources res, Intent batteryChangedIntent) {