Bug 716673 - Collapse unused WAITING_TO_SNAP and SNAPPING flingstates into STOPPED. r=pcwalton

This commit is contained in:
Kartikaya Gupta 2012-01-10 10:05:55 -05:00
Родитель 45e0c4fb28
Коммит cb0894c39b
1 изменённых файлов: 6 добавлений и 16 удалений

Просмотреть файл

@ -464,7 +464,6 @@ public class PanZoomController
} }
mState = PanZoomState.FLING; mState = PanZoomState.FLING;
mX.setFlingState(Axis.FlingStates.SNAPPING); mY.setFlingState(Axis.FlingStates.SNAPPING);
Log.d(LOGTAG, "end bounce at " + metrics); Log.d(LOGTAG, "end bounce at " + metrics);
startAnimationTimer(new BounceRunnable(bounceStartMetrics, metrics)); startAnimationTimer(new BounceRunnable(bounceStartMetrics, metrics));
@ -690,8 +689,6 @@ public class PanZoomController
STOPPED, STOPPED,
PANNING, PANNING,
FLINGING, FLINGING,
WAITING_TO_SNAP,
SNAPPING,
} }
public enum Overscroll { public enum Overscroll {
@ -716,10 +713,7 @@ public class PanZoomController
public float displacement; public float displacement;
private int mSnapFrame; public Axis() {}
private float mSnapPos, mSnapEndPos;
public Axis() { mSnapFrame = -1; }
public FlingStates getFlingState() { return mFlingState; } public FlingStates getFlingState() { return mFlingState; }
@ -808,15 +802,11 @@ public class PanZoomController
} }
public void startFling(boolean stopped) { public void startFling(boolean stopped) {
if (!stopped) { if (stopped) {
setFlingState(FlingStates.FLINGING);
return;
}
if (disableSnap || FloatUtils.fuzzyEquals(getExcess(), 0.0f))
setFlingState(FlingStates.STOPPED); setFlingState(FlingStates.STOPPED);
else } else {
setFlingState(FlingStates.WAITING_TO_SNAP); setFlingState(FlingStates.FLINGING);
}
} }
/* Advances a fling animation by one step. */ /* Advances a fling animation by one step. */
@ -847,7 +837,7 @@ public class PanZoomController
if (Math.abs(velocity) < 0.3f) { if (Math.abs(velocity) < 0.3f) {
velocity = 0.0f; velocity = 0.0f;
setFlingState(FlingStates.WAITING_TO_SNAP); setFlingState(FlingStates.STOPPED);
} }
} }