Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6c0665fd authored by Chet Haase's avatar Chet Haase
Browse files

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
parent f6b0c2f3
Loading
Loading
Loading
Loading
+18 −10
Original line number Diff line number Diff line
@@ -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;
    }

    /**