lottie-android icon indicating copy to clipboard operation
lottie-android copied to clipboard

[Bug] Afterimage Persists in Android

Open MoonJR opened this issue 1 year ago • 0 comments

LottieAnimationView's Parent View After Applying Alpha Animation

When changing the visibility of the LottieAnimationView during the animation of the parent view, the animation pauses, but the view itself continues to linger on the screen as an afterimage.

When the visibility is set to 'gone,' and a layout inspection is performed, the view appears to be removed, but an afterimage persists.

xml

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/black">

    <FrameLayout
        android:id="@+id/lottieParentView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">

        <com.airbnb.lottie.LottieAnimationView
            android:id="@+id/lottieView"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            app:lottie_autoPlay="true"
            app:lottie_loop="true"
            app:lottie_rawRes="@raw/loading_spinner_w_30" />
    </FrameLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

code

         binding.lottieParentView.animation = AlphaAnimation(0.5f, 1f)
            .apply {
                // after 10second animation done
                duration = 10000
                setAnimationListener(object : AnimationListener {
                    override fun onAnimationStart(animation: Animation?) {
                    }

                    override fun onAnimationEnd(animation: Animation?) {
                        toast("End Alpha Animation")
                    }

                    override fun onAnimationRepeat(animation: Animation?) {
                    }
                })
            }

        binding.lottieParentView.postDelayed(3000) {
            binding.lottieParentView.isVisible = false
            toast("Exec lottieParentView visible gone")
        }
example layout inspect
https://github.com/airbnb/lottie-android/assets/7312966/9153ae1d-3cdc-4e89-959d-304ebc4c6288 IMG_1074

MoonJR avatar Feb 05 '24 03:02 MoonJR