Skip to content

Unusual (historical) undocumented behaviour change #2678

@JakeSteam

Description

@JakeSteam

Describe the bug

Note: I'm raising this primarily for awareness / visibility for any others with similar issues, no action is expected for a behaviour change >3 years ago, feel free to close!

An undocumented change (fix?) happened in Lottie Android v5.1.1 around animator update listeners if the developer option "Animator duration scale" is set to "Off".

A (legacy) piece of our code using v5.0.3 had the following logic, just "run a splash animation, then startMain() when it finishes". This code worked correctly for multiple years:

findViewById<LottieAnimationView>(R.id.lottie_splash_animation)?.let { animationView ->
            animationView.addAnimatorUpdateListener { animation ->
                if (animation.animatedFraction >= 1) {
                    startMain()
                    animationView.removeAllUpdateListeners()
                }
            }
        }

After updating to v5.1.1+, the listener is called with a value slightly below 1 (previously it was 1), resulting in no startMain() being invoked, and users being stuck with the lottie_splash_animation. In our scenario, this resulted in users complaining of being "stuck on splash screen".

5.0.3 5.1.1
Image Image

Steps To Reproduce

  1. In device "Developer options", set "Animator duration scale" to "Animation off".
  2. Have an XML LottieAnimationView, example below.
  3. Try listening for animator updates on v5.0.3 vs 5.1.1.
  4. Notice the final animatedFraction value was previously 1, and is now slightly below 1.
        <com.airbnb.lottie.LottieAnimationView
            android:id="@+id/lottie_splash_animation"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:layout_constraintLeft_toLeftOf="parent"
            app:layout_constraintRight_toRightOf="parent"
            app:layout_constraintTop_toTopOf="parent"
            app:layout_constraintBottom_toBottomOf="parent"
            app:lottie_autoPlay="true"
            app:lottie_loop="false"
            app:lottie_rawRes="@raw/splash_screen" />

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions