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

Commit 5cfb3d7e authored by ztenghui's avatar ztenghui
Browse files

Trigger circular ripple when touched down, instead of up.

This will also show circular ripple when focus is on.
Previously, bounded case behaved differently than unbounded case. Now
they are consistent, too.

b/63635160
Test: sample app and calculator app

Change-Id: I5c96c8079c789d6e571af2c2356e3ce6add37b46
parent 6d17e658
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -104,7 +104,7 @@ class RippleBackground extends RippleComponent {
        final AnimatorSet set = new AnimatorSet();

        // Linear exit after enter is completed.
        final ObjectAnimator exit = ObjectAnimator.ofFloat(this, RippleBackground.OPACITY, 0);
        final ObjectAnimator exit = ObjectAnimator.ofFloat(this, OPACITY, 0);
        exit.setInterpolator(LINEAR_INTERPOLATOR);
        exit.setDuration(OPACITY_EXIT_DURATION);
        exit.setAutoCancel(true);
@@ -115,7 +115,7 @@ class RippleBackground extends RippleComponent {
        final int fastEnterDuration = mIsBounded ?
                (int) ((1 - mOpacity) * OPACITY_ENTER_DURATION_FAST) : 0;
        if (fastEnterDuration > 0) {
            final ObjectAnimator enter = ObjectAnimator.ofFloat(this, RippleBackground.OPACITY, 1);
            final ObjectAnimator enter = ObjectAnimator.ofFloat(this, OPACITY, 1);
            enter.setInterpolator(LINEAR_INTERPOLATOR);
            enter.setDuration(fastEnterDuration);
            enter.setAutoCancel(true);
+2 −1
Original line number Diff line number Diff line
@@ -266,7 +266,8 @@ public class RippleDrawable extends LayerDrawable {
            }
        }

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

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

        return changed;
+0 −5
Original line number Diff line number Diff line
@@ -162,11 +162,6 @@ class RippleForeground extends RippleComponent {

    @Override
    protected Animator createSoftwareEnter(boolean fast) {
        // Bounded ripples don't have enter animations.
        if (mIsBounded) {
            return null;
        }

        final int duration = (int)
                (1000 * Math.sqrt(mTargetRadius / WAVE_TOUCH_DOWN_ACCELERATION * mDensityScale) + 0.5);