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

Commit 6b5e4305 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Add gradient to PIP dismiss target, per mocks." into rvc-dev am: 3e29cb85 am: 3ff8830b

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11795070

Change-Id: I44ccfb9be23768a58fd33ab2e1b6bc74723e3350
parents 6e0a0a0e 3ff8830b
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ import android.graphics.PixelFormat;
import android.graphics.Point;
import android.graphics.PointF;
import android.graphics.Rect;
import android.graphics.drawable.TransitionDrawable;
import android.os.Handler;
import android.os.RemoteException;
import android.util.Log;
@@ -76,6 +77,9 @@ import java.io.PrintWriter;
public class PipTouchHandler {
    private static final String TAG = "PipTouchHandler";

    /** Duration of the dismiss scrim fading in/out. */
    private static final int DISMISS_TRANSITION_DURATION_MS = 200;

    // Allow dragging the PIP to a location to close it
    private final boolean mEnableDismissDragToEdge;
    // Allow PIP to resize to a slightly bigger state upon touch
@@ -249,6 +253,8 @@ public class PipTouchHandler {

        mTargetView = new DismissCircleView(context);
        mTargetViewContainer = new FrameLayout(context);
        mTargetViewContainer.setBackgroundDrawable(
                context.getDrawable(R.drawable.floating_dismiss_gradient_transition));
        mTargetViewContainer.setClipChildren(false);
        mTargetViewContainer.addView(mTargetView);

@@ -553,6 +559,9 @@ public class PipTouchHandler {
            mMagneticTargetAnimator
                    .spring(DynamicAnimation.TRANSLATION_Y, 0f, mTargetSpringConfig)
                    .start();

            ((TransitionDrawable) mTargetViewContainer.getBackground()).startTransition(
                    DISMISS_TRANSITION_DURATION_MS);
        }
    }

@@ -565,6 +574,9 @@ public class PipTouchHandler {
                        mTargetSpringConfig)
                .withEndActions(() ->  mTargetViewContainer.setVisibility(View.GONE))
                .start();

        ((TransitionDrawable) mTargetViewContainer.getBackground()).reverseTransition(
                DISMISS_TRANSITION_DURATION_MS);
    }

    /**