When this view is used in a RecyclerView and the view detached due to user scrolling then it results in a crash. If the FabTransformation.Builder#transformFrom(..) or transformTo can return the Animator then we can cancel the transformation when the view is detached.
Fatal Exception: java.lang.IllegalStateException: Cannot start this animator on a detached view!
at android.view.RenderNode.addAnimator(RenderNode.java:812)
at android.view.RenderNodeAnimator.setTarget(RenderNodeAnimator.java:300)
at android.view.RenderNodeAnimator.setTarget(RenderNodeAnimator.java:282)
at android.animation.RevealAnimator.<init>(RevealAnimator.java:37)
at android.view.ViewAnimationUtils.createCircularReveal(ViewAnimationUtils.java:55)
at com.konifar.fab_transformation.animation.FabAnimatorLollipop.revealOn(FabAnimatorLollipop.java:53)
at com.konifar.fab_transformation.animation.FabAnimator$1.onAnimationEnd(FabAnimator.java:64)
at com.konifar.fab_transformation.animation.FabAnimatorLollipop$4.onAnimationEnd(FabAnimatorLollipop.java:141)
at android.view.ViewPropertyAnimator$AnimatorEventListener.onAnimationEnd(ViewPropertyAnimator.java:1114)
at android.animation.ValueAnimator.endAnimation(ValueAnimator.java:1239)
at android.animation.ValueAnimator$AnimationHandler.doAnimationFrame(ValueAnimator.java:766)
at android.animation.ValueAnimator$AnimationHandler$1.run(ValueAnimator.java:801)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:858)
at android.view.Choreographer.doCallbacks(Choreographer.java:670)
at android.view.Choreographer.doFrame(Choreographer.java:603)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:844)
at android.os.Handler.handleCallback(Handler.java:746)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5443)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
When this view is used in a RecyclerView and the view detached due to user scrolling then it results in a crash. If the
FabTransformation.Builder#transformFrom(..)
ortransformTo
can return theAnimator
then we can cancel the transformation when the view is detached.