Give disappearing children a chance to recreate DisplayLists

Views which are on the secondary "disappearingChildren" list in a
ViewGroup can be displayed and animated, but are unable to properly
update their underlying DisplayLists. This change processes these
children the same as other children in a ViewGroup, enabling changes
in those children to be reflected in their DisplayLists.

Issue #11551606 disappearing views don't invalidate/redraw correctly

Change-Id: I8d016ada7b73f6a5e74c2f21c979c0b6f84703b1
This commit is contained in:
Chet Haase
2014-08-01 13:32:27 -07:00
parent f6b0c2f31b
commit 6c0665fd0f

View File

@@ -3265,21 +3265,29 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
final View child = children[i];
if (((child.mViewFlags & VISIBILITY_MASK) == VISIBLE || child.getAnimation() != null) &&
child.hasStaticLayer()) {
child.mRecreateDisplayList = (child.mPrivateFlags & PFLAG_INVALIDATED)
== PFLAG_INVALIDATED;
child.mPrivateFlags &= ~PFLAG_INVALIDATED;
child.getDisplayList();
child.mRecreateDisplayList = false;
recreateChildDisplayList(child);
}
}
if (mOverlay != null) {
View overlayView = mOverlay.getOverlayView();
overlayView.mRecreateDisplayList = (overlayView.mPrivateFlags & PFLAG_INVALIDATED)
== PFLAG_INVALIDATED;
overlayView.mPrivateFlags &= ~PFLAG_INVALIDATED;
overlayView.getDisplayList();
overlayView.mRecreateDisplayList = false;
recreateChildDisplayList(overlayView);
}
if (mDisappearingChildren != null) {
final ArrayList<View> disappearingChildren = mDisappearingChildren;
final int disappearingCount = disappearingChildren.size();
for (int i = 0; i < disappearingCount; ++i) {
final View child = disappearingChildren.get(i);
recreateChildDisplayList(child);
}
}
}
private void recreateChildDisplayList(View child) {
child.mRecreateDisplayList = (child.mPrivateFlags & PFLAG_INVALIDATED)
== PFLAG_INVALIDATED;
child.mPrivateFlags &= ~PFLAG_INVALIDATED;
child.getDisplayList();
child.mRecreateDisplayList = false;
}
/**