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

Commit 817d37c1 authored by George Mount's avatar George Mount Committed by android-build-merger
Browse files

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

am: 70c1e51b

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


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