Aghajari / AXrLottie

AXrLottie (Android) Renders animations and vectors exported in the bodymovin JSON format. (Using rLottie)
Apache License 2.0
147 stars 26 forks source link

setAutoRepeat false not working, keeps repeating #20

Closed hannojg closed 2 years ago

hannojg commented 2 years ago

Example reproduction code:

setLottieDrawable(
  AXrLottieDrawable.fromJson(jsonString, cacheKey)
      .setSize(decodeWidth, decodeHeight)
      .setAutoRepeat(false)
      .setSpeed(speed) // speed is set to 1.0f
      .build()
);

playAnimation();

Observation vs. Expectation

I expect the animation to only play once, and then stop. However, the animation keeps repeating.

mojtabasheikhy commented 2 years ago

I have the same problem

Aghajari commented 2 years ago

Hi @mojtabasheikhy and @hannojg, Auto repeat is based on AXrLottieImageView's autoRepeat property. AXrLottieDrawable's autoRepeat only matters if you are not using AXrLottieImageView. Or you can change the auto repeat on AXrLottieDrawable after calling AXrLottieImageView#setLottieDrawable.

This code should work:

lottieView.setAutoRepeat(false);

lottieView.setLottieDrawable(
  AXrLottieDrawable.fromJson(jsonString, cacheKey)
      .setSize(decodeWidth, decodeHeight)
      .build()
);

lottieView.playAnimation();

let me know if it didn't. Thanks!

Aghajari commented 2 years ago

Fixed on v1.4.0

mojtabasheikhy commented 1 year ago

Hi @mojtabasheikhy and @hannojg, Auto repeat is based on AXrLottieImageView's autoRepeat property. AXrLottieDrawable's autoRepeat only matters if you are not using AXrLottieImageView. Or you can change the auto repeat on AXrLottieDrawable after calling AXrLottieImageView#setLottieDrawable.

This code should work:

lottieView.setAutoRepeat(false);

lottieView.setLottieDrawable(
  AXrLottieDrawable.fromJson(jsonString, cacheKey)
      .setSize(decodeWidth, decodeHeight)
      .build()
);

lottieView.playAnimation();

let me know if it didn't. Thanks!

Thanks, it's fixed 🙌