package io.doist.recyclerviewext.flippers;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.view.View;

class DefaultFlipperAnimator extends FlipperAnimator {
    private boolean mAnimating = false;

    @Override
    public void animateFlip(final View outView, final View inView) {
        outView.setVisibility(View.VISIBLE);
        outView.setAlpha(1f);
        outView.animate()
               .alpha(0f)
               .setDuration(getFlipDuration())
               .setListener(new AnimatorListenerAdapter() {
                   @Override
                   public void onAnimationEnd(Animator animation) {
                       outView.setVisibility(View.GONE);
                       outView.setAlpha(1f);
                   }
               })
               .withLayer();

        inView.setVisibility(View.VISIBLE);
        inView.setAlpha(0f);
        inView.animate()
              .alpha(1f)
              .setDuration(getFlipDuration())
              .setListener(new AnimatorListenerAdapter() {
                  @Override
                  public void onAnimationEnd(Animator animation) {
                      inView.setAlpha(1f);
                      mAnimating = false;
                  }
              })
              .withLayer();

        mAnimating = true;
    }

    @Override
    public boolean isAnimating() {
        return mAnimating;
    }
}

@@ -340,53 +340,77 @@
     
-outView.setVisibility(View.VISIBLE);%0A
+if (mAnimating) %7B%0A            outView.animate().cancel();%0A   
         
 outV
@@ -405,37 +405,54 @@
         
-out
+ in
 View.
-setAlpha(1f);
+animate().cancel();%0A        %7D%0A
 %0A       
@@ -595,32 +595,258 @@
 enerAdapter() %7B%0A
+                   @Override%0A                   public void onAnimationStart(Animator animation) %7B%0A                       outView.setVisibility(View.VISIBLE);%0A                       outView.setAlpha(1f);%0A                   %7D%0A%0A
                 
@@ -1101,81 +1101,8 @@
 );%0A%0A
-        inView.setVisibility(View.VISIBLE);%0A        inView.setAlpha(0f);%0A
     
@@ -1185,32 +1185,32 @@
 FlipDuration())%0A
-
               .s
@@ -1244,32 +1244,251 @@
 enerAdapter() %7B%0A
+                  @Override%0A                  public void onAnimationStart(Animator animation) %7B%0A                      inView.setVisibility(View.VISIBLE);%0A                      inView.setAlpha(0f);%0A                  %7D%0A%0A
                 

Fix animation workflow