Merge "Fix jump cut when dismissing items in Recents" into jb-mr1-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
fb4a113a29
@@ -156,19 +156,19 @@ public class RecentsHorizontalScrollView extends HorizontalScrollView
|
|||||||
}
|
}
|
||||||
setLayoutTransition(transitioner);
|
setLayoutTransition(transitioner);
|
||||||
|
|
||||||
// Scroll to end after layout.
|
// Scroll to end after initial layout.
|
||||||
final ViewTreeObserver observer = getViewTreeObserver();
|
|
||||||
|
|
||||||
final OnGlobalLayoutListener updateScroll = new OnGlobalLayoutListener() {
|
final OnGlobalLayoutListener updateScroll = new OnGlobalLayoutListener() {
|
||||||
public void onGlobalLayout() {
|
public void onGlobalLayout() {
|
||||||
mLastScrollPosition = scrollPositionOfMostRecent();
|
mLastScrollPosition = scrollPositionOfMostRecent();
|
||||||
scrollTo(mLastScrollPosition, 0);
|
scrollTo(mLastScrollPosition, 0);
|
||||||
|
final ViewTreeObserver observer = getViewTreeObserver();
|
||||||
if (observer.isAlive()) {
|
if (observer.isAlive()) {
|
||||||
observer.removeOnGlobalLayoutListener(this);
|
observer.removeOnGlobalLayoutListener(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
observer.addOnGlobalLayoutListener(updateScroll);
|
getViewTreeObserver().addOnGlobalLayoutListener(updateScroll);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user