From 475b99cba2487873465613c238dd2a31d226f76f Mon Sep 17 00:00:00 2001 From: "ikbae.kim" Date: Thu, 17 Jan 2013 16:29:55 -0800 Subject: [PATCH] Fix for battery temperature display Centi temperature under zero degree is displayed with '-' sign. Fix this using absolute value in centi degree display. Change-Id: If4958d9c75c03d1f3ecfd14436fc80dc2fd57860 --- src/com/android/settings/BatteryInfo.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/com/android/settings/BatteryInfo.java b/src/com/android/settings/BatteryInfo.java index ccad23637ee..3f8827755ad 100644 --- a/src/com/android/settings/BatteryInfo.java +++ b/src/com/android/settings/BatteryInfo.java @@ -63,11 +63,12 @@ public class BatteryInfo extends Activity { /** * Format a number of tenths-units as a decimal string without using a - * conversion to float. E.g. 347 -> "34.7" + * conversion to float. E.g. 347 -> "34.7", -99 -> "-9.9" */ private final String tenthsToFixedString(int x) { int tens = x / 10; - return Integer.toString(tens) + "." + (x - 10 * tens); + // use Math.abs to avoid "-9.-9" about -99 + return Integer.toString(tens) + "." + Math.abs(x - 10 * tens); } /**