Permalink
Browse files

Fixed formatDecimal so that it won't display, for example, 1.100 inst…

…ead of 2.00; thanks to Aaron Bessey for the patch.

git-svn-id: http://ringdroid.googlecode.com/svn/trunk@32 35bc551c-9c80-11dd-979b-47109e308e52
  • Loading branch information...
1 parent 7c08bd4 commit 18cda458b06ab64bdf880460faf828c27066bbae dmazzoni committed Jun 24, 2009
Showing with 9 additions and 0 deletions.
  1. +9 −0 src/com/ringdroid/RingdroidEditActivity.java
@@ -798,6 +798,15 @@ private String formatTime(int pixels) {
private String formatDecimal(double x) {
int xWhole = (int)x;
int xFrac = (int)(100 * (x - xWhole) + 0.5);
+
+ if (xFrac >= 100) {
+ xWhole++; //Round up
+ xFrac -= 100; //Now we need the remainder after the round up
+ if (xFrac < 10) {
+ xFrac *= 10; //we need a fraction that is 2 digits long
+ }
+ }
+
if (xFrac < 10)
return xWhole + ".0" + xFrac;
else

0 comments on commit 18cda45

Please sign in to comment.