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

Commit 952dcab9 authored by Annie Chin's avatar Annie Chin Committed by Android (Google) Code Review
Browse files

Merge "Reset animation/pulse on TouchEvent ACTION_CANCEL." into ub-deskclock-army

parents aa86f82f 816cf531
Loading
Loading
Loading
Loading
+17 −2
Original line number Diff line number Diff line
@@ -266,8 +266,7 @@ public class AlarmActivity extends AppCompatActivity
            mReceiverRegistered = true;
        }

        // Set the animators to their initial values.
        setAnimatedFractions(0.0f /* snoozeFraction */, 0.0f /* dismissFraction */);
        resetAnimations();
    }

    @Override
@@ -404,6 +403,9 @@ public class AlarmActivity extends AppCompatActivity
                    }
                }
                break;
            case MotionEvent.ACTION_CANCEL:
                resetAnimations();
                break;
            default:
                break;
        }
@@ -420,6 +422,19 @@ public class AlarmActivity extends AppCompatActivity
        }
    }

    /**
     * Set animators to initial values and restart pulse on alarm button.
     */
    private void resetAnimations() {
        // Set the animators to their initial values.
        setAnimatedFractions(0.0f /* snoozeFraction */, 0.0f /* dismissFraction */);
        // Restart the pulse.
        mPulseAnimator.setRepeatCount(ValueAnimator.INFINITE);
        if (!mPulseAnimator.isStarted()) {
            mPulseAnimator.start();
        }
    }

    /**
     * Perform snooze animation and send snooze intent.
     */