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

Commit a667d5dc authored by George Mount's avatar George Mount Committed by Android Git Automerger
Browse files

am 04a96bca: Merge "Fix NPE when shared element listener is null." into lmp-dev

* commit '04a96bcad89cf917a57980cb77a90763f43b5b94':
  Fix NPE when shared element listener is null.
parents eadf58d5 a1e7d53b
Loading
Loading
Loading
Loading
+17 −6
Original line number Diff line number Diff line
@@ -219,7 +219,9 @@ abstract class ActivityTransitionCoordinator extends ResultReceiver {

    protected void viewsReady(ArrayMap<String, View> sharedElements) {
        sharedElements.retainAll(mAllSharedElementNames);
        if (mListener != null) {
            mListener.onMapSharedElements(mAllSharedElementNames, sharedElements);
        }
        mSharedElementNames.addAll(sharedElements.keySet());
        mSharedElements.addAll(sharedElements.values());
        if (getViewsTransition() != null && mTransitioningViews != null) {
@@ -461,7 +463,8 @@ abstract class ActivityTransitionCoordinator extends ResultReceiver {
        if (sharedElementState != null) {
            Matrix tempMatrix = new Matrix();
            RectF tempRect = new RectF();
            for (int i = 0; i < mSharedElementNames.size(); i++) {
            final int numSharedElements = mSharedElements.size();
            for (int i = 0; i < numSharedElements; i++) {
                View sharedElement = mSharedElements.get(i);
                String name = mSharedElementNames.get(i);
                SharedElementOriginalState originalState = getOldSharedElementState(sharedElement,
@@ -471,13 +474,17 @@ abstract class ActivityTransitionCoordinator extends ResultReceiver {
                        tempMatrix, tempRect, null);
            }
        }
        if (mListener != null) {
            mListener.onSharedElementStart(mSharedElementNames, mSharedElements, snapshots);
        }
        return originalImageState;
    }

    protected void notifySharedElementEnd(ArrayList<View> snapshots) {
        if (mListener != null) {
            mListener.onSharedElementEnd(mSharedElementNames, mSharedElements, snapshots);
        }
    }

    protected void scheduleSetSharedElementEnd(final ArrayList<View> snapshots) {
        final View decorView = getDecor();
@@ -544,7 +551,7 @@ abstract class ActivityTransitionCoordinator extends ResultReceiver {
            if (sharedElementBundle != null) {
                Parcelable parcelable = sharedElementBundle.getParcelable(KEY_SNAPSHOT);
                View snapshot = null;
                if (parcelable != null) {
                if (parcelable != null && mListener != null) {
                    snapshot = mListener.onCreateSnapshotView(context, parcelable);
                }
                if (snapshot != null) {
@@ -659,7 +666,11 @@ abstract class ActivityTransitionCoordinator extends ResultReceiver {
        sharedElementBundle.putFloat(KEY_TRANSLATION_Z, view.getTranslationZ());
        sharedElementBundle.putFloat(KEY_ELEVATION, view.getElevation());

        Parcelable bitmap = mListener.onCaptureSharedElementSnapshot(view, tempMatrix, tempBounds);
        Parcelable bitmap = null;
        if (mListener != null) {
            bitmap = mListener.onCaptureSharedElementSnapshot(view, tempMatrix, tempBounds);
        }

        if (bitmap != null) {
            sharedElementBundle.putParcelable(KEY_SNAPSHOT, bitmap);
        }
+3 −1
Original line number Diff line number Diff line
@@ -306,7 +306,9 @@ class EnterTransitionCoordinator extends ActivityTransitionCoordinator {
        ArrayList<String> rejectedNames = new ArrayList<String>(mAllSharedElementNames);
        rejectedNames.removeAll(mSharedElementNames);
        ArrayList<View> rejectedSnapshots = createSnapshots(sharedElementState, rejectedNames);
        if (mListener != null) {
            mListener.onRejectSharedElements(rejectedSnapshots);
        }
        startRejectedAnimations(rejectedSnapshots);

        // Now start shared element transition
+4 −1
Original line number Diff line number Diff line
@@ -181,7 +181,10 @@ class ExitTransitionCoordinator extends ActivityTransitionCoordinator {
                });
        setGhostVisibility(View.INVISIBLE);
        scheduleGhostVisibilityChange(View.INVISIBLE);
        mListener.onSharedElementEnd(mSharedElementNames, mSharedElements, sharedElementSnapshots);
        if (mListener != null) {
            mListener.onSharedElementEnd(mSharedElementNames, mSharedElements,
                    sharedElementSnapshots);
        }
        TransitionManager.beginDelayedTransition(decorView, transition);
        scheduleGhostVisibilityChange(View.VISIBLE);
        setGhostVisibility(View.VISIBLE);