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

Commit 70c1e51b authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Protect shared element transitions from removed views." into oc-dev

parents 256794f0 e06b816e
Loading
Loading
Loading
Loading
+16 −12
Original line number Diff line number Diff line
@@ -570,8 +570,10 @@ abstract class ActivityTransitionCoordinator extends ResultReceiver {
            // Find the location in the view's parent
            ViewGroup parent = (ViewGroup) view.getParent();
            Matrix matrix = new Matrix();
            if (parent != null) {
                parent.transformMatrixToLocal(matrix);
                matrix.postTranslate(parent.getScrollX(), parent.getScrollY());
            }
            mSharedElementParentMatrices.add(matrix);
        }
    }
@@ -861,6 +863,7 @@ abstract class ActivityTransitionCoordinator extends ResultReceiver {
            Matrix tempMatrix = new Matrix();
            for (int i = 0; i < numSharedElements; i++) {
                View view = mSharedElements.get(i);
                if (view.isAttachedToWindow()) {
                    tempMatrix.reset();
                    mSharedElementParentMatrices.get(i).invert(tempMatrix);
                    GhostView.addGhost(view, decor, tempMatrix);
@@ -874,6 +877,7 @@ abstract class ActivityTransitionCoordinator extends ResultReceiver {
                }
            }
        }
    }

    protected boolean moveSharedElementWithParent() {
        return true;
@@ -1065,7 +1069,7 @@ abstract class ActivityTransitionCoordinator extends ResultReceiver {
        @Override
        public boolean onPreDraw() {
            GhostView ghostView = GhostView.getGhost(mView);
            if (ghostView == null) {
            if (ghostView == null || !mView.isAttachedToWindow()) {
                removeListener();
            } else {
                GhostView.calculateMatrix(mView, mDecor, mMatrix);