Using common fling detection logic for notification and all-apps

> Refactoring SwipeDetector to both allow vertical and horizontal swipes
> Using SwipeDetector and common overscroll effect for notification swipes
  instead of a separate logic

Change-Id: Ib706ee179811ade59ddb68184e1c202365d147c4
This commit is contained in:
Sunny Goyal
2017-07-14 00:02:27 -07:00
parent f567ee8f42
commit b72d8b2c8b
12 changed files with 276 additions and 1256 deletions

View File

@@ -107,8 +107,7 @@ public class AllAppsTransitionController implements TouchController, SwipeDetect
public AllAppsTransitionController(Launcher l) {
mLauncher = l;
mDetector = new SwipeDetector(l);
mDetector.setListener(this);
mDetector = new SwipeDetector(l, this, SwipeDetector.VERTICAL);
mShiftRange = DEFAULT_SHIFT_RANGE;
mProgress = 1f;
@@ -137,15 +136,15 @@ public class AllAppsTransitionController implements TouchController, SwipeDetect
if (mDetector.isIdleState()) {
if (mLauncher.isAllAppsVisible()) {
directionsToDetectScroll |= SwipeDetector.DIRECTION_DOWN;
directionsToDetectScroll |= SwipeDetector.DIRECTION_NEGATIVE;
} else {
directionsToDetectScroll |= SwipeDetector.DIRECTION_UP;
directionsToDetectScroll |= SwipeDetector.DIRECTION_POSITIVE;
}
} else {
if (isInDisallowRecatchBottomZone()) {
directionsToDetectScroll |= SwipeDetector.DIRECTION_UP;
directionsToDetectScroll |= SwipeDetector.DIRECTION_POSITIVE;
} else if (isInDisallowRecatchTopZone()) {
directionsToDetectScroll |= SwipeDetector.DIRECTION_DOWN;
directionsToDetectScroll |= SwipeDetector.DIRECTION_NEGATIVE;
} else {
directionsToDetectScroll |= SwipeDetector.DIRECTION_BOTH;
ignoreSlopWhenSettling = true;
@@ -368,7 +367,7 @@ public class AllAppsTransitionController implements TouchController, SwipeDetect
}
private void calculateDuration(float velocity, float disp) {
mAnimationDuration = mDetector.calculateDuration(velocity, disp / mShiftRange);
mAnimationDuration = SwipeDetector.calculateDuration(velocity, disp / mShiftRange);
}
public boolean animateToAllApps(AnimatorSet animationOut, long duration) {