Lottie Animation автоматически отменяется в Android - PullRequest
0 голосов
/ 09 апреля 2019

Я использую лотерейную анимацию внутри моего recyclerView. Вот мой источник

     if (story.isRead)
            lottieAnimationView.setAnimation("story_archive_gray.json");
        else
            lottieAnimationView.setAnimation("story_archive_blue.json");



        final LinearLayout loadMoreContainer = v.findViewById(R.id.load_more_container);
        loadMoreContainer.setVisibility(story.isLastElement ? View.VISIBLE : View.GONE);

        rootView.setOnClickListener(view -> {

            lottieAnimationView.addAnimatorListener(new Animator.AnimatorListener() {
                @Override
                public void onAnimationStart(Animator animation) {
                }

                @Override
                public void onAnimationEnd(Animator animation) {
                    SPLogger.logMassage("animationListener","onAnimationEnd");
                    animation.cancel();
                    //call activity
                }

                @Override
                public void onAnimationCancel(Animator animation) {
                    SPLogger.logMassage("animationListener","onAnimationCancel");

                }

                @Override
                public void onAnimationRepeat(Animator animation) {
                    SPLogger.logMassage("animationListener","onAnimationRepeat");



                }
            });
            lottieAnimationView.playAnimation();

        });

У меня есть одна проблема, иногда анимация не завершается и onAnimationCancel автоматически вызывает. Может кто-нибудь сказать мне причину?Я помещаю мои файлы JSON в папки ресурсов

...