Skip to content

Commit

Permalink
Notify AnimationListener onEnd when animations are cancelled (airbnb#…
Browse files Browse the repository at this point in the history
…1994)

Lottie now behaves the same way as ValueAnimator in the platform.

Fixes airbnb#1963
  • Loading branch information
gpeal authored Jan 16, 2022
1 parent c5b8318 commit c82ed2f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions issue-repro/src/main/res/layout/issue_repro_activity.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
app:lottie_rawRes="@raw/heart"
app:lottie_autoPlay="true"
app:lottie_loop="true" />
</FrameLayout>
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,11 @@ public float getMaxFrame() {
return maxFrame == Integer.MAX_VALUE ? composition.getEndFrame() : maxFrame;
}

@Override void notifyCancel() {
super.notifyCancel();
notifyEnd(isReversed());
}

protected void postFrameCallback() {
if (isRunning()) {
removeFrameCallback(false);
Expand Down

0 comments on commit c82ed2f

Please sign in to comment.