Add state parameter to all animateTo methods which called animStart with a hardcoded state. (#373)

Preserve old API which now calls the extended animateTo methods.
This commit is contained in:
Wolfgang Schramm 2017-07-08 16:46:43 +02:00 committed by Emux
parent ad2348631a
commit 9f7fe2577b

View File

@ -3,6 +3,7 @@
* Copyright 2016 Stephan Leuschner
* Copyright 2016 devemux86
* Copyright 2016 Izumi Kawashima
* Copyright 2017 Wolfgang Schramm
*
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
*
@ -39,12 +40,12 @@ import static org.oscim.utils.FastMath.clamp;
public class Animator {
static final Logger log = LoggerFactory.getLogger(Animator.class);
private final static int ANIM_NONE = 0;
private final static int ANIM_MOVE = 1 << 0;
private final static int ANIM_SCALE = 1 << 1;
private final static int ANIM_ROTATE = 1 << 2;
private final static int ANIM_TILT = 1 << 3;
private final static int ANIM_FLING = 1 << 4;
public final static int ANIM_NONE = 0;
public final static int ANIM_MOVE = 1 << 0;
public final static int ANIM_SCALE = 1 << 1;
public final static int ANIM_ROTATE = 1 << 2;
public final static int ANIM_TILT = 1 << 3;
public final static int ANIM_FLING = 1 << 4;
private final Map mMap;
@ -71,6 +72,10 @@ public class Animator {
}
public synchronized void animateTo(long duration, BoundingBox bbox, Easing.Type easingType) {
animateTo(duration, bbox, easingType, ANIM_MOVE | ANIM_SCALE | ANIM_ROTATE | ANIM_TILT);
}
public synchronized void animateTo(long duration, BoundingBox bbox, Easing.Type easingType, int state) {
ThreadUtils.assertMainThread();
mMap.getMapPosition(mStartPos);
@ -97,7 +102,7 @@ public class Animator {
-mStartPos.bearing,
-mStartPos.tilt);
animStart(duration, ANIM_MOVE | ANIM_SCALE | ANIM_ROTATE | ANIM_TILT, easingType);
animStart(duration, state, easingType);
}
public void animateTo(BoundingBox bbox) {
@ -128,6 +133,21 @@ public class Animator {
*/
public void animateTo(long duration, GeoPoint geoPoint,
double scale, boolean relative, Easing.Type easingType) {
animateTo(duration, geoPoint, scale, relative, easingType, ANIM_MOVE | ANIM_SCALE);
}
/**
* Animate to GeoPoint
*
* @param duration in ms
* @param geoPoint
* @param scale
* @param relative alter scale relative to current scale
* @param easingType easing function
* @param state animation state
*/
public void animateTo(long duration, GeoPoint geoPoint,
double scale, boolean relative, Easing.Type easingType, int state) {
ThreadUtils.assertMainThread();
mMap.getMapPosition(mStartPos);
@ -142,7 +162,7 @@ public class Animator {
scale - mStartPos.scale,
0, 0);
animStart(duration, ANIM_MOVE | ANIM_SCALE, easingType);
animStart(duration, state, easingType);
}
public void animateTo(GeoPoint p) {
@ -154,6 +174,10 @@ public class Animator {
}
public void animateTo(long duration, MapPosition pos, Easing.Type easingType) {
animateTo(duration, pos, easingType, ANIM_MOVE | ANIM_SCALE | ANIM_ROTATE | ANIM_TILT);
}
public void animateTo(long duration, MapPosition pos, Easing.Type easingType, int state) {
ThreadUtils.assertMainThread();
mMap.getMapPosition(mStartPos);
@ -166,7 +190,7 @@ public class Animator {
pos.bearing - mStartPos.bearing,
mMap.viewport().limitTilt(pos.tilt) - mStartPos.tilt);
animStart(duration, ANIM_MOVE | ANIM_SCALE | ANIM_ROTATE | ANIM_TILT, easingType);
animStart(duration, state, easingType);
}
public void animateZoom(long duration, double scaleBy,