Fixing boot stall.

Revert "-Added 3D effect to home screen scrolling"

This reverts commit 9415d87eda.

Change-Id: Ib8d6602f5d82884eb1f6cc44c0cc71cc563a3a59
This commit is contained in:
Adam Cohen
2010-09-29 13:02:43 -07:00
parent de7658b5e0
commit 0fb7db5a37
8 changed files with 122 additions and 261 deletions

View File

@@ -26,15 +26,11 @@ public abstract class SmoothPagedView extends PagedView {
private static final float SMOOTHING_SPEED = 0.75f;
private static final float SMOOTHING_CONSTANT = (float) (0.016 / Math.log(SMOOTHING_SPEED));
private float mBaseLineFlingVelocity;
private float mFlingVelocityInfluence;
static final int OVERSHOOT_MODE = 0;
static final int QUINTIC_MODE = 1;
private static final float BASELINE_FLING_VELOCITY = 2500.f;
private static final float FLING_VELOCITY_INFLUENCE = 0.4f;
int mScrollMode;
private Interpolator mScrollInterpolator;
private WorkspaceOvershootInterpolator mScrollInterpolator;
private static class WorkspaceOvershootInterpolator implements Interpolator {
private static final float DEFAULT_TENSION = 1.3f;
@@ -60,16 +56,6 @@ public abstract class SmoothPagedView extends PagedView {
}
}
private static class QuinticInterpolator implements Interpolator {
public QuinticInterpolator() {
}
public float getInterpolation(float t) {
t -= 1.0f;
return t*t*t*t*t + 1;
}
}
/**
* Used to inflate the Workspace from XML.
*
@@ -97,27 +83,14 @@ public abstract class SmoothPagedView extends PagedView {
mDeferScrollUpdate = true;
}
protected int getScrollMode() {
return OVERSHOOT_MODE;
}
/**
* Initializes various states for this workspace.
*/
@Override
protected void init() {
super.init();
mScrollMode = getScrollMode();
if (mScrollMode == QUINTIC_MODE) {
mBaseLineFlingVelocity = 700.0f;
mFlingVelocityInfluence = 0.8f;
mScrollInterpolator = new QuinticInterpolator();
} else { // QUINTIC_MODE
mBaseLineFlingVelocity = 2500.0f;
mFlingVelocityInfluence = 0.4f;
mScrollInterpolator = new WorkspaceOvershootInterpolator();
}
mScrollInterpolator = new WorkspaceOvershootInterpolator();
// overwrite the previous mScroller
mScroller = new Scroller(getContext(), mScrollInterpolator);
}
@@ -139,32 +112,25 @@ public abstract class SmoothPagedView extends PagedView {
final int screenDelta = Math.max(1, Math.abs(whichPage - mCurrentPage));
final int newX = getChildOffset(whichPage) - getRelativeChildOffset(whichPage);
final int delta = newX - mScrollX;
int duration;
if (mScrollMode == OVERSHOOT_MODE) {
duration = (screenDelta + 1) * 100;
} else { // QUINTIC_MODE
duration = Math.round(Math.abs(delta) * 0.6f);
}
int duration = (screenDelta + 1) * 100;
if (!mScroller.isFinished()) {
mScroller.abortAnimation();
}
if (mScrollMode == OVERSHOOT_MODE) {
if (settle) {
((WorkspaceOvershootInterpolator) mScrollInterpolator).setDistance(screenDelta);
} else {
((WorkspaceOvershootInterpolator) mScrollInterpolator).disableSettle();
}
if (settle) {
mScrollInterpolator.setDistance(screenDelta);
} else {
mScrollInterpolator.disableSettle();
}
velocity = Math.abs(velocity);
if (velocity > 0) {
duration += (duration / (velocity / mBaseLineFlingVelocity)) * mFlingVelocityInfluence;
duration += (duration / (velocity / BASELINE_FLING_VELOCITY))
* FLING_VELOCITY_INFLUENCE;
} else {
duration += 100;
}
snapToPage(whichPage, delta, duration);
}