Make quick switch track finger 1:1
- When calculating motion delta, it should consider the scale of pagedView
- Adjust significant threshold of tablet quick switch to 15% of page width (roughly 100dp)
Fixes: 188786242
Test: manual on quick switch
Change-Id: Idaa6c5b721decb573e97158c5fbcd67fa224f9d1
diff --git a/src/com/android/launcher3/PagedView.java b/src/com/android/launcher3/PagedView.java
index 97a44c1..d2dfb7b 100644
--- a/src/com/android/launcher3/PagedView.java
+++ b/src/com/android/launcher3/PagedView.java
@@ -1147,6 +1147,10 @@
mAllowOverScroll = enable;
}
+ protected float getSignificantMoveThreshold() {
+ return SIGNIFICANT_MOVE_THRESHOLD;
+ }
+
@Override
public boolean onTouchEvent(MotionEvent ev) {
// Skip touch handling if there are no pages to swipe
@@ -1218,6 +1222,7 @@
}
delta -= consumed;
}
+ delta /= mOrientationHandler.getPrimaryScale(this);
// Only scroll and update mLastMotionX if we have moved some discrete amount. We
// keep the remainder because we are actually testing if we've moved from the last
@@ -1270,11 +1275,12 @@
int velocity = (int) mOrientationHandler.getPrimaryVelocity(velocityTracker,
mActivePointerId);
- int delta = (int) (primaryDirection - mDownMotionPrimary);
+ float delta = primaryDirection - mDownMotionPrimary;
+ delta /= mOrientationHandler.getPrimaryScale(this);
int pageOrientedSize = mOrientationHandler.getMeasuredSize(getPageAt(mCurrentPage));
- boolean isSignificantMove = Math.abs(delta) > pageOrientedSize *
- SIGNIFICANT_MOVE_THRESHOLD;
+ boolean isSignificantMove = Math.abs(delta)
+ > pageOrientedSize * getSignificantMoveThreshold();
mTotalMotion += Math.abs(mLastMotion + mLastMotionRemainder - primaryDirection);
boolean passedSlop = mAllowEasyFling || mTotalMotion > mPageSlop;