Merge "Make quick switch track finger 1:1" into sc-v2-dev

This commit is contained in:
Alex Chau
2021-06-03 19:44:55 +00:00
committed by Android (Google) Code Review
2 changed files with 17 additions and 3 deletions
@@ -342,6 +342,8 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
private static final float ADDITIONAL_DISMISS_TRANSLATION_INTERPOLATION_OFFSET = 0.05f; private static final float ADDITIONAL_DISMISS_TRANSLATION_INTERPOLATION_OFFSET = 0.05f;
private static final float ANIMATION_DISMISS_PROGRESS_MIDPOINT = 0.5f; private static final float ANIMATION_DISMISS_PROGRESS_MIDPOINT = 0.5f;
private static final float SIGNIFICANT_MOVE_THRESHOLD_TABLET = 0.15f;
protected final RecentsOrientedState mOrientationState; protected final RecentsOrientedState mOrientationState;
protected final BaseActivityInterface<STATE_TYPE, ACTIVITY_TYPE> mSizeStrategy; protected final BaseActivityInterface<STATE_TYPE, ACTIVITY_TYPE> mSizeStrategy;
protected RecentsAnimationController mRecentsAnimationController; protected RecentsAnimationController mRecentsAnimationController;
@@ -975,6 +977,12 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
} }
} }
@Override
protected float getSignificantMoveThreshold() {
return mActivity.getDeviceProfile().isTablet ? SIGNIFICANT_MOVE_THRESHOLD_TABLET
: super.getSignificantMoveThreshold();
}
@Override @Override
public boolean onTouchEvent(MotionEvent ev) { public boolean onTouchEvent(MotionEvent ev) {
super.onTouchEvent(ev); super.onTouchEvent(ev);
+9 -3
View File
@@ -1147,6 +1147,10 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
mAllowOverScroll = enable; mAllowOverScroll = enable;
} }
protected float getSignificantMoveThreshold() {
return SIGNIFICANT_MOVE_THRESHOLD;
}
@Override @Override
public boolean onTouchEvent(MotionEvent ev) { public boolean onTouchEvent(MotionEvent ev) {
// Skip touch handling if there are no pages to swipe // Skip touch handling if there are no pages to swipe
@@ -1218,6 +1222,7 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
} }
delta -= consumed; delta -= consumed;
} }
delta /= mOrientationHandler.getPrimaryScale(this);
// Only scroll and update mLastMotionX if we have moved some discrete amount. We // 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 // keep the remainder because we are actually testing if we've moved from the last
@@ -1270,11 +1275,12 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
int velocity = (int) mOrientationHandler.getPrimaryVelocity(velocityTracker, int velocity = (int) mOrientationHandler.getPrimaryVelocity(velocityTracker,
mActivePointerId); mActivePointerId);
int delta = (int) (primaryDirection - mDownMotionPrimary); float delta = primaryDirection - mDownMotionPrimary;
delta /= mOrientationHandler.getPrimaryScale(this);
int pageOrientedSize = mOrientationHandler.getMeasuredSize(getPageAt(mCurrentPage)); int pageOrientedSize = mOrientationHandler.getMeasuredSize(getPageAt(mCurrentPage));
boolean isSignificantMove = Math.abs(delta) > pageOrientedSize * boolean isSignificantMove = Math.abs(delta)
SIGNIFICANT_MOVE_THRESHOLD; > pageOrientedSize * getSignificantMoveThreshold();
mTotalMotion += Math.abs(mLastMotion + mLastMotionRemainder - primaryDirection); mTotalMotion += Math.abs(mLastMotion + mLastMotionRemainder - primaryDirection);
boolean passedSlop = mAllowEasyFling || mTotalMotion > mPageSlop; boolean passedSlop = mAllowEasyFling || mTotalMotion > mPageSlop;