summaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorJustin Harrison <astyrrian@google.com>2014-12-04 17:37:53 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-12-04 17:37:55 +0000
commit21af21ca07cd07d7164bf7b7d70513c193785247 (patch)
treeb392eb30673723f5d5987c2f6811296074ad3361 /packages
parent54daab1009e7be849fa1dcbf4ee3f9d0ba40d732 (diff)
parent3f7dac5a1ccf5d464070c1a067d1d50741bdbd0e (diff)
downloadframeworks_base-21af21ca07cd07d7164bf7b7d70513c193785247.zip
frameworks_base-21af21ca07cd07d7164bf7b7d70513c193785247.tar.gz
frameworks_base-21af21ca07cd07d7164bf7b7d70513c193785247.tar.bz2
Merge "Revert "Improve fling physics for recents"" into lmp-mr1-dev
Diffstat (limited to 'packages')
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/views/SwipeHelper.java4
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewTouchHandler.java19
2 files changed, 16 insertions, 7 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/SwipeHelper.java b/packages/SystemUI/src/com/android/systemui/recents/views/SwipeHelper.java
index 0428b48..fa44551 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/SwipeHelper.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/SwipeHelper.java
@@ -50,6 +50,7 @@ public class SwipeHelper {
private float SWIPE_ESCAPE_VELOCITY = 100f; // dp/sec
private int DEFAULT_ESCAPE_ANIMATION_DURATION = 75; // ms
private int MAX_ESCAPE_ANIMATION_DURATION = 150; // ms
+ private int MAX_DISMISS_VELOCITY = 2000; // dp/sec
private static final int SNAP_ANIM_LEN = SLOW_ANIMATIONS ? 1000 : 250; // ms
public static float ALPHA_FADE_START = 0.15f; // fraction of thumbnail width
@@ -349,7 +350,8 @@ public class SwipeHelper {
}
private void endSwipe(VelocityTracker velocityTracker) {
- velocityTracker.computeCurrentVelocity(1000 /* px/sec */);
+ float maxVelocity = MAX_DISMISS_VELOCITY * mDensityScale;
+ velocityTracker.computeCurrentVelocity(1000 /* px/sec */, maxVelocity);
float velocity = getVelocity(velocityTracker);
float perpendicularVelocity = getPerpendicularVelocity(velocityTracker);
float escapeVelocity = SWIPE_ESCAPE_VELOCITY * mDensityScale;
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewTouchHandler.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewTouchHandler.java
index c59f82c..2b173a9 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewTouchHandler.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewTouchHandler.java
@@ -143,21 +143,22 @@ class TaskStackViewTouchHandler implements SwipeHelper.Callback {
// Initialize the velocity tracker
initOrResetVelocityTracker();
mVelocityTracker.addMovement(createMotionEventForStackScroll(ev));
+ // Check if the scroller is finished yet
+ mIsScrolling = mScroller.isScrolling();
break;
}
case MotionEvent.ACTION_MOVE: {
if (mActivePointerId == INACTIVE_POINTER_ID) break;
- // Initialize the velocity tracker if necessary
- initVelocityTrackerIfNotExists();
- mVelocityTracker.addMovement(createMotionEventForStackScroll(ev));
-
int activePointerIndex = ev.findPointerIndex(mActivePointerId);
int y = (int) ev.getY(activePointerIndex);
int x = (int) ev.getX(activePointerIndex);
if (Math.abs(y - mInitialMotionY) > mScrollTouchSlop) {
// Save the touch move info
mIsScrolling = true;
+ // Initialize the velocity tracker if necessary
+ initVelocityTrackerIfNotExists();
+ mVelocityTracker.addMovement(createMotionEventForStackScroll(ev));
// Disallow parents from intercepting touch events
final ViewParent parent = mSv.getParent();
if (parent != null) {
@@ -236,8 +237,6 @@ class TaskStackViewTouchHandler implements SwipeHelper.Callback {
case MotionEvent.ACTION_MOVE: {
if (mActivePointerId == INACTIVE_POINTER_ID) break;
- mVelocityTracker.addMovement(createMotionEventForStackScroll(ev));
-
int activePointerIndex = ev.findPointerIndex(mActivePointerId);
int x = (int) ev.getX(activePointerIndex);
int y = (int) ev.getY(activePointerIndex);
@@ -247,6 +246,9 @@ class TaskStackViewTouchHandler implements SwipeHelper.Callback {
if (!mIsScrolling) {
if (yTotal > mScrollTouchSlop) {
mIsScrolling = true;
+ // Initialize the velocity tracker
+ initOrResetVelocityTracker();
+ mVelocityTracker.addMovement(createMotionEventForStackScroll(ev));
// Disallow parents from intercepting touch events
final ViewParent parent = mSv.getParent();
if (parent != null) {
@@ -265,6 +267,11 @@ class TaskStackViewTouchHandler implements SwipeHelper.Callback {
/ maxOverScroll));
}
mScroller.setStackScroll(curStackScroll + deltaP);
+ if (mScroller.isScrollOutOfBounds()) {
+ mVelocityTracker.clear();
+ } else {
+ mVelocityTracker.addMovement(createMotionEventForStackScroll(ev));
+ }
}
mLastMotionX = x;
mLastMotionY = y;