Merge "Use alpha instead of invisible for views below shelf to skip redraw" into sc-dev am: 27a1fdb018
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15331191 Change-Id: Ie9ece86634d0131b2515ec1b78f12c9260ae472e
This commit is contained in:
@@ -154,15 +154,21 @@ public class StackScrollAlgorithm {
|
|||||||
|
|
||||||
shelf.updateState(algorithmState, ambientState);
|
shelf.updateState(algorithmState, ambientState);
|
||||||
|
|
||||||
// After the shelf has updated its yTranslation,
|
// After the shelf has updated its yTranslation, explicitly set alpha=0 for view below shelf
|
||||||
// explicitly hide views below the shelf to skip rendering them in the hardware layer.
|
// to skip rendering them in the hardware layer. We do not set them invisible because that
|
||||||
|
// runs invalidate & onDraw when these views return onscreen, which is more expensive.
|
||||||
final float shelfTop = shelf.getViewState().yTranslation;
|
final float shelfTop = shelf.getViewState().yTranslation;
|
||||||
|
|
||||||
for (ExpandableView view : algorithmState.visibleChildren) {
|
for (ExpandableView view : algorithmState.visibleChildren) {
|
||||||
|
if (view instanceof ExpandableNotificationRow) {
|
||||||
|
ExpandableNotificationRow row = (ExpandableNotificationRow) view;
|
||||||
|
if (row.isHeadsUp() || row.isHeadsUpAnimatingAway()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
final float viewTop = view.getViewState().yTranslation;
|
final float viewTop = view.getViewState().yTranslation;
|
||||||
|
|
||||||
if (viewTop >= shelfTop) {
|
if (viewTop >= shelfTop) {
|
||||||
view.getViewState().hidden = true;
|
view.getViewState().alpha = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user