summaryrefslogtreecommitdiffstats
path: root/quickstep/src/com
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2017-11-16 15:41:24 -0800
committerSunny Goyal <sunnygoyal@google.com>2017-11-16 16:11:18 -0800
commit1c22aa13707f42bd1bbd974357f515fa4f5d7165 (patch)
treedceeb45a53bb91a8dfb2ad4ae16a6e6d15b134c9 /quickstep/src/com
parent1dc8a1f3ca9bc7ac61858e03f64894a682ab84ec (diff)
downloadandroid_packages_apps_Trebuchet-1c22aa13707f42bd1bbd974357f515fa4f5d7165.tar.gz
android_packages_apps_Trebuchet-1c22aa13707f42bd1bbd974357f515fa4f5d7165.tar.bz2
android_packages_apps_Trebuchet-1c22aa13707f42bd1bbd974357f515fa4f5d7165.zip
Subtracting the touchSlop when dragging the window, to prevent initial jump
Change-Id: I26a79076312d4641693a9610c17cf925d5d104ea
Diffstat (limited to 'quickstep/src/com')
-rw-r--r--quickstep/src/com/android/quickstep/NavBarSwipeInteractionHandler.java9
-rw-r--r--quickstep/src/com/android/quickstep/TouchInteractionService.java4
2 files changed, 8 insertions, 5 deletions
diff --git a/quickstep/src/com/android/quickstep/NavBarSwipeInteractionHandler.java b/quickstep/src/com/android/quickstep/NavBarSwipeInteractionHandler.java
index e03a2ff60..102f85973 100644
--- a/quickstep/src/com/android/quickstep/NavBarSwipeInteractionHandler.java
+++ b/quickstep/src/com/android/quickstep/NavBarSwipeInteractionHandler.java
@@ -61,7 +61,8 @@ public class NavBarSwipeInteractionHandler extends InternalStateHandler {
private static final long RECENTS_VIEW_VISIBILITY_DELAY = 120;
private static final long RECENTS_VIEW_VISIBILITY_DURATION = 150;
- private static final long DEFAULT_SWIPE_DURATION = 200;
+ private static final long MAX_SWIPE_DURATION = 200;
+ private static final long MIN_SWIPE_DURATION = 80;
// Ideal velocity for a smooth transition
private static final float PIXEL_PER_MS = 2f;
@@ -127,8 +128,8 @@ public class NavBarSwipeInteractionHandler extends InternalStateHandler {
new Handler().postDelayed(() -> mStateCallback.setState(STATE_RECENTS_DELAY_COMPLETE),
RECENTS_VIEW_VISIBILITY_DELAY);
- long duration = Math.min(DEFAULT_SWIPE_DURATION,
- Math.max((long) (-mCurrentDisplacement / PIXEL_PER_MS), 0));
+ long duration = Math.min(MAX_SWIPE_DURATION,
+ Math.max((long) (-mCurrentDisplacement / PIXEL_PER_MS), MIN_SWIPE_DURATION));
if (mCurrentShift.getCurrentAnimation() != null) {
ObjectAnimator anim = mCurrentShift.getCurrentAnimation();
long theirDuration = anim.getDuration() - anim.getCurrentPlayTime();
@@ -260,7 +261,7 @@ public class NavBarSwipeInteractionHandler extends InternalStateHandler {
float flingThreshold = res.getDimension(R.dimen.quickstep_fling_threshold_velocity);
boolean isFling = Math.abs(endVelocity) > flingThreshold;
- long duration = DEFAULT_SWIPE_DURATION;
+ long duration = MAX_SWIPE_DURATION;
final float endShift;
if (!isFling) {
endShift = mCurrentShift.value >= MIN_PROGRESS_FOR_OVERVIEW ? 1 : 0;
diff --git a/quickstep/src/com/android/quickstep/TouchInteractionService.java b/quickstep/src/com/android/quickstep/TouchInteractionService.java
index ff26fb39c..b34601de6 100644
--- a/quickstep/src/com/android/quickstep/TouchInteractionService.java
+++ b/quickstep/src/com/android/quickstep/TouchInteractionService.java
@@ -87,6 +87,7 @@ public class TouchInteractionService extends Service {
private int mActivePointerId = INVALID_POINTER_ID;
private VelocityTracker mVelocityTracker;
private int mTouchSlop;
+ private float mStartDisplacement;
private NavBarSwipeInteractionHandler mInteractionHandler;
private ISystemUiProxy mISystemUiProxy;
@@ -183,11 +184,12 @@ public class TouchInteractionService extends Service {
float displacement = ev.getY(pointerIndex) - mDownPos.y;
if (mInteractionHandler == null) {
if (Math.abs(displacement) >= mTouchSlop) {
+ mStartDisplacement = Math.signum(displacement) * mTouchSlop;
startTouchTracking();
}
} else {
// Move
- mInteractionHandler.updateDisplacement(displacement);
+ mInteractionHandler.updateDisplacement(displacement - mStartDisplacement);
}
break;
}