I have the following code that shows an animation of Lottie, what I need to know is how to detect that I finish to be able to show a Toast:
public class SplashScreen extends AppCompatActivity {
LottieAnimationView lottieAnimationView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash_screen);
lottieAnimationView = findViewById(R.id.lottieAnimationView);
startCheckAnimation();
}
private void startCheckAnimation(){
ValueAnimator animator = ValueAnimator.ofFloat(0f, 1f).setDuration(2500);
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener(){
@Override
public void onAnimationUpdate(ValueAnimator animation){
lottieAnimationView.setProgress((Float)animation.getAnimatedValue());
}
});
if(lottieAnimationView.getProgress() == 0f){
animator.setStartDelay(500);
animator.start();
}else{
lottieAnimationView.setProgress(0f);
}
}
}