I have set Custom Animation for the fragment transaction using fragmentTansaction.setCustomAnimation(in,out). I want to know the start and end of the animation and trigger some respective action . How can I do that? Is it possible to set some listner?
You can use animation in onStart() for getDecorView()
@Override
public void onStart() {
super.onStart();
if (getDialog().getWindow().getDecorView()) {
ObjectAnimator objectAnimator = ObjectAnimator.ofPropertyValuesHolder(getDialog().getWindow().getDecorView(),
PropertyValuesHolder.ofFloat(View.Y, 0, 1000));
objectAnimator.setDuration(1000);
objectAnimator.addListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
}
@Override
public void onAnimationEnd(Animator animation) {
}
@Override
public void onAnimationCancel(Animator animation) {
}
@Override
public void onAnimationRepeat(Animator animation) {
}
});
objectAnimator.start();
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With