am 7b8b6618
: Merge "Fix for battery temperature display"
* commit '7b8b6618219a2a9e1402858b513cf19628033204': Fix for battery temperature display
This commit is contained in:
@@ -63,11 +63,12 @@ public class BatteryInfo extends Activity {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Format a number of tenths-units as a decimal string without using a
|
* 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) {
|
private final String tenthsToFixedString(int x) {
|
||||||
int tens = x / 10;
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user