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

Commit 0df0cd3c authored by Tenghui Zhu's avatar Tenghui Zhu Committed by Android (Google) Code Review
Browse files

Merge "Don't show the background when pressed and focus"

parents 342cab74 ac4c063e
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -268,7 +268,7 @@ public class RippleDrawable extends LayerDrawable {

        setRippleActive(focused || (enabled && pressed));

        setBackgroundActive(hovered || focused || (enabled && pressed), focused || hovered);
        setBackgroundActive(hovered, hovered);

        return changed;
    }
@@ -694,7 +694,9 @@ public class RippleDrawable extends LayerDrawable {
        // have a mask or content and the ripple bounds if we're projecting.
        final Rect bounds = getDirtyBounds();
        final int saveCount = canvas.save(Canvas.CLIP_SAVE_FLAG);
        if (isBounded()) {
            canvas.clipRect(bounds);
        }

        drawContent(canvas);
        drawBackgroundAndRipples(canvas);
+6 −33
Original line number Diff line number Diff line
@@ -80,9 +80,6 @@ class RippleForeground extends RippleComponent {
    private float mTweenX = 0;
    private float mTweenY = 0;

    /** Whether this ripple is bounded. */
    private boolean mIsBounded;

    /** Whether this ripple has finished its exit animation. */
    private boolean mHasFinishedExit;

@@ -90,7 +87,6 @@ class RippleForeground extends RippleComponent {
            boolean isBounded, boolean forceSoftware) {
        super(owner, bounds, forceSoftware);

        mIsBounded = isBounded;
        mStartingX = startingX;
        mStartingY = startingY;

@@ -210,31 +206,15 @@ class RippleForeground extends RippleComponent {
        return (int) (1000 * mOpacity / WAVE_OPACITY_DECAY_VELOCITY + 0.5f);
    }

    /**
     * Compute target values that are dependent on bounding.
     */
    private void computeBoundedTargetValues() {
        mTargetX = (mClampedStartingX - mBounds.exactCenterX()) * .7f;
        mTargetY = (mClampedStartingY - mBounds.exactCenterY()) * .7f;
        mTargetRadius = mBoundedRadius;
    }

    @Override
    protected Animator createSoftwareExit() {
        final int radiusDuration;
        final int originDuration;
        final int opacityDuration;
        if (mIsBounded) {
            computeBoundedTargetValues();

            radiusDuration = BOUNDED_RADIUS_EXIT_DURATION;
            originDuration = BOUNDED_ORIGIN_EXIT_DURATION;
            opacityDuration = BOUNDED_OPACITY_EXIT_DURATION;
        } else {
        radiusDuration = getRadiusExitDuration();
        originDuration = radiusDuration;
        opacityDuration = getOpacityExitDuration();
        }

        final ObjectAnimator tweenRadius = ObjectAnimator.ofFloat(this, TWEEN_RADIUS, 1);
        tweenRadius.setAutoCancel(true);
@@ -263,17 +243,10 @@ class RippleForeground extends RippleComponent {
        final int radiusDuration;
        final int originDuration;
        final int opacityDuration;
        if (mIsBounded) {
            computeBoundedTargetValues();

            radiusDuration = BOUNDED_RADIUS_EXIT_DURATION;
            originDuration = BOUNDED_ORIGIN_EXIT_DURATION;
            opacityDuration = BOUNDED_OPACITY_EXIT_DURATION;
        } else {
        radiusDuration = getRadiusExitDuration();
        originDuration = radiusDuration;
        opacityDuration = getOpacityExitDuration();
        }

        final float startX = getCurrentX();
        final float startY = getCurrentY();