Animator: animation end event

This commit is contained in:
Hannes Janetzek 2014-10-13 22:20:06 +02:00
parent 8626aa2f53
commit dfc1aeb98f
2 changed files with 13 additions and 8 deletions

View File

@ -211,11 +211,8 @@ public class Animator {
long millisLeft = mAnimEnd - MapRenderer.frametime;
//boolean changed = false;
ViewController v = mMap.viewport();
//synchronized (v) {
/* cancel animation when position was changed since last
* update, i.e. when it was modified outside the animator. */
if (v.getMapPosition(mCurPos)) {
@ -293,5 +290,10 @@ public class Animator {
mState = ANIM_NONE;
mPivot.x = 0;
mPivot.y = 0;
mMap.events.fire(Map.ANIM_END, mMap.mMapPosition);
}
public boolean isActive() {
return mState != ANIM_NONE;
}
}

View File

@ -66,30 +66,33 @@ public abstract class Map implements TaskQueue {
/**
* UpdateListener event. Map position has changed.
*/
public static Event POSITION_EVENT = new Event();
public static final Event POSITION_EVENT = new Event();
/**
* UpdateLister event. Delivered on main-thread when updateMap() was called
* and no CLEAR_EVENT or POSITION_EVENT was triggered.
*/
public static Event UPDATE_EVENT = new Event();
public static final Event UPDATE_EVENT = new Event();
/**
* UpdateListerner event. Map state has changed in a way that all layers
* should clear their state e.g. the theme or the TilesSource has changed.
* TODO should have an event-source to only clear affected layers.
*/
public static Event CLEAR_EVENT = new Event();
public static final Event CLEAR_EVENT = new Event();
public static final Event ANIM_END = new Event();
public final EventDispatcher<InputListener, MotionEvent> input;
public final EventDispatcher<UpdateListener, MapPosition> events;
private final Layers mLayers;
private final ViewController mViewport;
protected final Animator mAnimator;
private final MapPosition mMapPosition;
private final AsyncExecutor mAsyncExecutor;
protected final Animator mAnimator;
protected final MapPosition mMapPosition;
protected final MapEventLayer mEventLayer;
protected GestureDetector mGestureDetector;