am a206daae: Related to #1444844. Caps fling velocity on Home.

Merge commit 'a206daaed1318005d1534cca2e4eeec56144d104'

* commit 'a206daaed1318005d1534cca2e4eeec56144d104':
  Related to #1444844. Caps fling velocity on Home.
This commit is contained in:
Romain Guy 2009-07-06 13:12:33 -07:00 committed by The Android Open Source Project
commit eb5b16dbda
1 changed files with 5 additions and 2 deletions

View File

@ -106,6 +106,7 @@ public class Workspace extends ViewGroup implements DropTarget, DragSource, Drag
private boolean mLocked; private boolean mLocked;
private int mTouchSlop; private int mTouchSlop;
private int mMaximumVelocity;
final Rect mDrawerBounds = new Rect(); final Rect mDrawerBounds = new Rect();
final Rect mClipBounds = new Rect(); final Rect mClipBounds = new Rect();
@ -150,7 +151,9 @@ public class Workspace extends ViewGroup implements DropTarget, DragSource, Drag
mPaint = new Paint(); mPaint = new Paint();
mPaint.setDither(false); mPaint.setDither(false);
mTouchSlop = ViewConfiguration.get(getContext()).getScaledTouchSlop(); final ViewConfiguration configuration = ViewConfiguration.get(getContext());
mTouchSlop = configuration.getScaledTouchSlop();
mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
} }
/** /**
@ -813,7 +816,7 @@ public class Workspace extends ViewGroup implements DropTarget, DragSource, Drag
case MotionEvent.ACTION_UP: case MotionEvent.ACTION_UP:
if (mTouchState == TOUCH_STATE_SCROLLING) { if (mTouchState == TOUCH_STATE_SCROLLING) {
final VelocityTracker velocityTracker = mVelocityTracker; final VelocityTracker velocityTracker = mVelocityTracker;
velocityTracker.computeCurrentVelocity(1000); velocityTracker.computeCurrentVelocity(1000, mMaximumVelocity);
int velocityX = (int) velocityTracker.getXVelocity(); int velocityX = (int) velocityTracker.getXVelocity();
if (velocityX > SNAP_VELOCITY && mCurrentScreen > 0) { if (velocityX > SNAP_VELOCITY && mCurrentScreen > 0) {