mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-19 10:48:19 +00:00
Passing proper velocity information when simulating touch events on recents view
Change-Id: I488b8d61c47e49dbdc65b16e2470b171912efc3f
This commit is contained in:
@@ -1134,9 +1134,7 @@ 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);
|
||||
final VelocityTracker velocityTracker = mVelocityTracker;
|
||||
velocityTracker.computeCurrentVelocity(1000, mMaximumVelocity);
|
||||
int velocityX = (int) velocityTracker.getXVelocity(activePointerId);
|
||||
int velocityX = computeXVelocity();
|
||||
final int deltaX = (int) (x - mDownMotionX);
|
||||
final int pageWidth = getPageAt(mCurrentPage).getMeasuredWidth();
|
||||
boolean isSignificantMove = Math.abs(deltaX) > pageWidth *
|
||||
@@ -1240,6 +1238,12 @@ 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