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

Commit 1dddc057 authored by George Mount's avatar George Mount Committed by Android (Google) Code Review
Browse files

Merge "Use transparent instead of null background during Activity Transitions"

parents df68c911 96eb6ca7
Loading
Loading
Loading
Loading
+13 −2
Original line number Diff line number Diff line
@@ -19,6 +19,8 @@ import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ObjectAnimator;
import android.app.SharedElementCallback.OnSharedElementsReadyListener;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.ResultReceiver;
@@ -61,6 +63,7 @@ class EnterTransitionCoordinator extends ActivityTransitionCoordinator {
    private Transition mEnterViewsTransition;
    private OneShotPreDrawListener mViewsReadyListener;
    private final boolean mIsCrossTask;
    private Drawable mReplacedBackground;

    public EnterTransitionCoordinator(Activity activity, ResultReceiver resultReceiver,
            ArrayList<String> sharedElementNames, boolean isReturning, boolean isCrossTask) {
@@ -332,12 +335,15 @@ class EnterTransitionCoordinator extends ActivityTransitionCoordinator {
        if (!mIsReturning) {
            mWasOpaque = mActivity.convertToTranslucent(null, null);
            Drawable background = decorView.getBackground();
            if (background != null) {
            if (background == null) {
                background = new ColorDrawable(Color.TRANSPARENT);
                mReplacedBackground = background;
            } else {
                getWindow().setBackgroundDrawable(null);
                background = background.mutate();
                background.setAlpha(0);
                getWindow().setBackgroundDrawable(background);
            }
            getWindow().setBackgroundDrawable(background);
        } else {
            mActivity = null; // all done with it now.
        }
@@ -553,6 +559,11 @@ class EnterTransitionCoordinator extends ActivityTransitionCoordinator {
        final ViewGroup decorView = getDecor();
        if (decorView != null) {
            decorView.sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED);

            Window window = getWindow();
            if (window != null && mReplacedBackground == decorView.getBackground()) {
                window.setBackgroundDrawable(null);
            }
        }
    }

+1 −1
Original line number Diff line number Diff line
@@ -236,7 +236,7 @@ class ExitTransitionCoordinator extends ActivityTransitionCoordinator {
            delayCancel();
            moveSharedElementsToOverlay();
            if (decorView != null && decorView.getBackground() == null) {
                getWindow().setBackgroundDrawable(new ColorDrawable(Color.BLACK));
                getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
            }
            final boolean targetsM = decorView == null || decorView.getContext()
                    .getApplicationInfo().targetSdkVersion >= VERSION_CODES.M;