diff options
Diffstat (limited to 'packages')
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java index a0f197d..5e0df49 100644 --- a/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java +++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java @@ -165,19 +165,18 @@ public class RecentsVerticalScrollView extends ScrollView } setLayoutTransition(transitioner); - // Scroll to end after layout. - final ViewTreeObserver observer = getViewTreeObserver(); - + // Scroll to end after initial layout. final OnGlobalLayoutListener updateScroll = new OnGlobalLayoutListener() { public void onGlobalLayout() { mLastScrollPosition = scrollPositionOfMostRecent(); scrollTo(0, mLastScrollPosition); + final ViewTreeObserver observer = getViewTreeObserver(); if (observer.isAlive()) { observer.removeOnGlobalLayoutListener(this); } } }; - observer.addOnGlobalLayoutListener(updateScroll); + getViewTreeObserver().addOnGlobalLayoutListener(updateScroll); } @Override |