Skip to content

Commit

Permalink
Fix the problem of playing while switching front and back on the Andr…
Browse files Browse the repository at this point in the history
…oid platform. (#682)

Make the method of onAnimationStart aligned with the Android platform.

Co-authored-by: kevingpqi <kevingpqi@tencent.com>
(cherry picked from commit 7701614)
  • Loading branch information
kevingpqi123 committed Jan 17, 2023
1 parent b411cc9 commit 699238d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion android/libpag/src/main/java/org/libpag/PAGView.java
Original file line number Diff line number Diff line change
Expand Up @@ -277,11 +277,11 @@ public void onAnimationStart(Animator animator) {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
_isPlaying = false;
// Align with iOS platform, avoid triggering this method when stopping
int repeatCount = ((ValueAnimator) animation).getRepeatCount();
if (repeatCount >= 0 && (animation.getDuration() > 0) &&
(currentPlayTime / animation.getDuration() > repeatCount)) {
_isPlaying = false;
ArrayList<PAGViewListener> arrayList;
synchronized (PAGView.this) {
arrayList = new ArrayList<>(mViewListeners);
Expand Down
4 changes: 1 addition & 3 deletions src/platform/ios/private/PAGValueAnimator.mm
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,7 @@ - (void)start {
animatedFraction = static_cast<double>(playTime) / duration;
lock.unlock();
[animatorListener onAnimationUpdate];
if (animatedFraction == 0) {
[animatorListener onAnimationStart];
}
[animatorListener onAnimationStart];
}

- (void)stop {
Expand Down

0 comments on commit 699238d

Please sign in to comment.