From 67b03701b633c293fd960435cd97fc0835e44568 Mon Sep 17 00:00:00 2001 From: Michael Jurka Date: Fri, 15 Feb 2013 17:35:48 +0100 Subject: [PATCH] Fix one cause of slow scrolling in Recents Bug: 8208782 Change-Id: I8153001d1cea0c01f929d3091a722fed842038fa --- .../src/com/android/systemui/SwipeHelper.java | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/SwipeHelper.java b/packages/SystemUI/src/com/android/systemui/SwipeHelper.java index ceb86540d6df8..8e1773ada5460 100644 --- a/packages/SystemUI/src/com/android/systemui/SwipeHelper.java +++ b/packages/SystemUI/src/com/android/systemui/SwipeHelper.java @@ -154,6 +154,13 @@ public class SwipeHelper implements Gefingerpoken { return Math.max(mMinAlpha, result); } + private void updateAlphaFromOffset(View animView, boolean dismissable) { + if (FADE_OUT_DURING_SWIPE && dismissable) { + animView.setAlpha(getAlphaForOffset(animView)); + } + invalidateGlobalRegion(animView); + } + // invalidate the view's own bounds all the way up the view hierarchy public static void invalidateGlobalRegion(View view) { invalidateGlobalRegion( @@ -290,10 +297,7 @@ public class SwipeHelper implements Gefingerpoken { }); anim.addUpdateListener(new AnimatorUpdateListener() { public void onAnimationUpdate(ValueAnimator animation) { - if (FADE_OUT_DURING_SWIPE && canAnimViewBeDismissed) { - animView.setAlpha(getAlphaForOffset(animView)); - } - invalidateGlobalRegion(animView); + updateAlphaFromOffset(animView, canAnimViewBeDismissed); } }); anim.start(); @@ -307,10 +311,12 @@ public class SwipeHelper implements Gefingerpoken { anim.setDuration(duration); anim.addUpdateListener(new AnimatorUpdateListener() { public void onAnimationUpdate(ValueAnimator animation) { - if (FADE_OUT_DURING_SWIPE && canAnimViewBeDismissed) { - animView.setAlpha(getAlphaForOffset(animView)); - } - invalidateGlobalRegion(animView); + updateAlphaFromOffset(animView, canAnimViewBeDismissed); + } + }); + anim.addListener(new AnimatorListenerAdapter() { + public void onAnimationEnd(Animator animator) { + updateAlphaFromOffset(animView, canAnimViewBeDismissed); } }); anim.start(); @@ -347,10 +353,8 @@ public class SwipeHelper implements Gefingerpoken { } } setTranslation(mCurrAnimView, delta); - if (FADE_OUT_DURING_SWIPE && mCanCurrViewBeDimissed) { - mCurrAnimView.setAlpha(getAlphaForOffset(mCurrAnimView)); - } - invalidateGlobalRegion(mCurrView); + + updateAlphaFromOffset(mCurrAnimView, mCanCurrViewBeDimissed); } break; case MotionEvent.ACTION_UP: