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

Commit 0671f05f authored by Alan Viverette's avatar Alan Viverette
Browse files

Revert ripple background fast-enter behavior to M style

No longer fast-enters the background for unbounded ripples.

Bug: 25602850
Change-Id: I3250505c1de04a72fb764174abf269e247e21578
parent 55e20d50
Loading
Loading
Loading
Loading
+16 −5
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ import android.view.animation.LinearInterpolator;
 * Draws a ripple background.
 */
class RippleBackground extends RippleComponent {

    private static final TimeInterpolator LINEAR_INTERPOLATOR = new LinearInterpolator();

    private static final int OPACITY_ENTER_DURATION = 600;
@@ -48,8 +49,14 @@ class RippleBackground extends RippleComponent {
    // Software rendering properties.
    private float mOpacity = 0;

    public RippleBackground(RippleDrawable owner, Rect bounds, boolean forceSoftware) {
    /** Whether this ripple is bounded. */
    private boolean mIsBounded;

    public RippleBackground(RippleDrawable owner, Rect bounds, boolean isBounded,
            boolean forceSoftware) {
        super(owner, bounds, forceSoftware);

        mIsBounded = isBounded;
    }

    public boolean isVisible() {
@@ -105,7 +112,8 @@ class RippleBackground extends RippleComponent {
        final AnimatorSet.Builder builder = set.play(exit);

        // Linear "fast" enter based on current opacity.
        final int fastEnterDuration = (int) ((1 - mOpacity) * OPACITY_ENTER_DURATION_FAST);
        final int fastEnterDuration = mIsBounded ?
                (int) ((1 - mOpacity) * OPACITY_ENTER_DURATION_FAST) : 0;
        if (fastEnterDuration > 0) {
            final ObjectAnimator enter = ObjectAnimator.ofFloat(this, RippleBackground.OPACITY, 1);
            enter.setInterpolator(LINEAR_INTERPOLATOR);
@@ -131,15 +139,18 @@ class RippleBackground extends RippleComponent {
        mPropX = CanvasProperty.createFloat(0);
        mPropY = CanvasProperty.createFloat(0);

        final int fastEnterDuration = (int) ((1 - mOpacity) * OPACITY_ENTER_DURATION_FAST);
        final int fastEnterDuration = mIsBounded ?
                (int) ((1 - mOpacity) * OPACITY_ENTER_DURATION_FAST) : 0;

        // Linear exit after enter is completed.
        final RenderNodeAnimator exit = new RenderNodeAnimator(
                mPropPaint, RenderNodeAnimator.PAINT_ALPHA, 0);
        exit.setInterpolator(LINEAR_INTERPOLATOR);
        exit.setDuration(OPACITY_EXIT_DURATION);
        if (fastEnterDuration > 0) {
            exit.setStartDelay(fastEnterDuration);
            exit.setStartValue(targetAlpha);
        }
        set.add(exit);

        // Linear "fast" enter based on current opacity.
+2 −1
Original line number Diff line number Diff line
@@ -540,7 +540,8 @@ public class RippleDrawable extends LayerDrawable {
     */
    private void tryBackgroundEnter(boolean focused) {
        if (mBackground == null) {
            mBackground = new RippleBackground(this, mHotspotBounds, mForceSoftware);
            final boolean isBounded = isBounded();
            mBackground = new RippleBackground(this, mHotspotBounds, isBounded, mForceSoftware);
        }

        mBackground.setup(mState.mMaxRadius, mDensity);