Passing all events to RecentsView instead of passing the calculated velocity
Velocity tracker is able to calculate the velocity using cached copy of motionEvent as long as the event as correct timeStamp Change-Id: I2b0f612e010fdfcf144d5bed928c5a96b36f3ac7
This commit is contained in:
1 parent
7b4215d633
commit
4bb8b06ef3
6 files changed
+94
-60
No files matched your search
@@ -1134,7 +1134,9 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
|
||||
final int activePointerId = mActivePointerId;
|
||||
final int pointerIndex = ev.findPointerIndex(activePointerId);
|
||||
final float x = ev.getX(pointerIndex);
|
||||
int velocityX = computeXVelocity();
|
||||
final VelocityTracker velocityTracker = mVelocityTracker;
|
||||
velocityTracker.computeCurrentVelocity(1000, mMaximumVelocity);
|
||||
int velocityX = (int) velocityTracker.getXVelocity(mActivePointerId);
|
||||
final int deltaX = (int) (x - mDownMotionX);
|
||||
final int pageWidth = getPageAt(mCurrentPage).getMeasuredWidth();
|
||||
boolean isSignificantMove = Math.abs(deltaX) > pageWidth *
|
||||
@@ -1238,12 +1240,6 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
|
||||
return true;
|
||||
}
|
||||
|
||||
protected int computeXVelocity() {
|
||||
final VelocityTracker velocityTracker = mVelocityTracker;
|
||||
velocityTracker.computeCurrentVelocity(1000, mMaximumVelocity);
|
||||
return (int) velocityTracker.getXVelocity(mActivePointerId);
|
||||
}
|
||||
|
||||
protected boolean shouldFlingForVelocity(int velocityX) {
|
||||
return Math.abs(velocityX) > mFlingThresholdVelocity;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user