diff options
author | Chet Haase <chet@google.com> | 2011-08-10 13:53:43 -0700 |
---|---|---|
committer | Chet Haase <chet@google.com> | 2011-08-11 07:18:20 -0700 |
commit | 81abe87dcc829c4c01473126c8664aa03385dc7c (patch) | |
tree | 90ebb77d33232f84ad1f6f4bb57863b92b500af4 /packages | |
parent | 5e3f4000a98eb494e3c896de7af97b1b85bbad42 (diff) | |
download | frameworks_base-81abe87dcc829c4c01473126c8664aa03385dc7c.zip frameworks_base-81abe87dcc829c4c01473126c8664aa03385dc7c.tar.gz frameworks_base-81abe87dcc829c4c01473126c8664aa03385dc7c.tar.bz2 |
Fix Recent Apps jumping artifact
When removing an item from the Recents list such that the list went from
larger than the screen to smaller (bringing the first item completely into view)
there was an artifact where the list would jump briefly, just prior to running
the transition to animate the remaining items into place.
The problem was that the custom ScrollView classes in the Recents app were
manipulating the scrollX/Y values of the items as a side-effect of any resize
of the list. Meanwhile, the LayoutTransition was manipulating both the size and
the scroll position of the list. The transition's scroll values would get clobbered by
the app's side-effect operation, causing the jump that we'd see on the screen.
The fix was to disable the side-effect operation during a layout transition.
Change-Id: I17f3f05d0e8a792e41bd46869ee700f128e63216
Diffstat (limited to 'packages')
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java | 14 | ||||
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java | 14 |
2 files changed, 26 insertions, 2 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java index 14efdd0..36f1659 100644 --- a/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java +++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java @@ -165,6 +165,13 @@ public class RecentsHorizontalScrollView extends HorizontalScrollView @Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); + + // Skip this work if a transition is running; it sets the scroll values independently + // and should not have those animated values clobbered by this logic + LayoutTransition transition = mLinearLayout.getLayoutTransition(); + if (transition != null && transition.isRunning()) { + return; + } // Keep track of the last visible item in the list so we can restore it // to the bottom when the orientation changes. mLastScrollPosition = scrollPositionOfMostRecent(); @@ -172,7 +179,12 @@ public class RecentsHorizontalScrollView extends HorizontalScrollView // This has to happen post-layout, so run it "in the future" post(new Runnable() { public void run() { - scrollTo(mLastScrollPosition, 0); + // Make sure we're still not clobbering the transition-set values, since this + // runnable launches asynchronously + LayoutTransition transition = mLinearLayout.getLayoutTransition(); + if (transition == null || !transition.isRunning()) { + scrollTo(mLastScrollPosition, 0); + } } }); } diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java index 1bcc413..89900a1 100644 --- a/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java +++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java @@ -166,6 +166,13 @@ public class RecentsVerticalScrollView extends ScrollView implements SwipeHelper @Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); + + // Skip this work if a transition is running; it sets the scroll values independently + // and should not have those animated values clobbered by this logic + LayoutTransition transition = mLinearLayout.getLayoutTransition(); + if (transition != null && transition.isRunning()) { + return; + } // Keep track of the last visible item in the list so we can restore it // to the bottom when the orientation changes. mLastScrollPosition = scrollPositionOfMostRecent(); @@ -173,7 +180,12 @@ public class RecentsVerticalScrollView extends ScrollView implements SwipeHelper // This has to happen post-layout, so run it "in the future" post(new Runnable() { public void run() { - scrollTo(0, mLastScrollPosition); + // Make sure we're still not clobbering the transition-set values, since this + // runnable launches asynchronously + LayoutTransition transition = mLinearLayout.getLayoutTransition(); + if (transition == null || !transition.isRunning()) { + scrollTo(0, mLastScrollPosition); + } } }); } |