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

Commit 816cf531 authored by Annie Chin's avatar Annie Chin
Browse files

Reset animation/pulse on TouchEvent ACTION_CANCEL.

Bug: 20934499

Also restart pulse onResume()

Change-Id: I4efe30781e58a98b36235f07db21f2b11c0c664d
parent 6c0db0b4
Loading
Loading
Loading
Loading
+17 −2
Original line number Diff line number Diff line
@@ -262,8 +262,7 @@ public class AlarmActivity extends AppCompatActivity
            mReceiverRegistered = true;
        }

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

    @Override
@@ -397,6 +396,9 @@ public class AlarmActivity extends AppCompatActivity
                    }
                }
                break;
            case MotionEvent.ACTION_CANCEL:
                resetAnimations();
                break;
            default:
                break;
        }
@@ -413,6 +415,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.
     */