aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/ui/CompassView.java
diff options
context:
space:
mode:
Diffstat (limited to 'main/src/cgeo/geocaching/ui/CompassView.java')
-rw-r--r--main/src/cgeo/geocaching/ui/CompassView.java11
1 files changed, 5 insertions, 6 deletions
diff --git a/main/src/cgeo/geocaching/ui/CompassView.java b/main/src/cgeo/geocaching/ui/CompassView.java
index eaaf711..f7111f7 100644
--- a/main/src/cgeo/geocaching/ui/CompassView.java
+++ b/main/src/cgeo/geocaching/ui/CompassView.java
@@ -16,7 +16,6 @@ import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.PaintFlagsDrawFilter;
import android.util.AttributeSet;
-import android.util.FloatMath;
import android.view.View;
import java.util.concurrent.TimeUnit;
@@ -158,19 +157,19 @@ public class CompassView extends View {
* @return the new value
*/
static protected float smoothUpdate(float goal, float actual) {
- final float diff = AngleUtils.difference(actual, goal);
+ final double diff = AngleUtils.difference(actual, goal);
- float offset = 0;
+ double offset = 0;
// If the difference is smaller than 1 degree, do nothing as it
// causes the arrow to vibrate. Round away from 0.
if (diff > 1.0) {
- offset = FloatMath.ceil(diff / 10.0f); // for larger angles, rotate faster
+ offset = Math.ceil(diff / 10.0); // for larger angles, rotate faster
} else if (diff < 1.0) {
- offset = FloatMath.floor(diff / 10.0f);
+ offset = Math.floor(diff / 10.0);
}
- return AngleUtils.normalize(actual + offset);
+ return AngleUtils.normalize((float) (actual + offset));
}
@Override