package com.pspdfkit.vangogh.rx;

import android.view.View;
import android.view.ViewPropertyAnimator;
import com.pspdfkit.vangogh.base.Animation;
import io.reactivex.Completable;
import io.reactivex.CompletableObserver;
import io.reactivex.annotations.NonNull;
import io.reactivex.annotations.Nullable;
import io.reactivex.functions.Consumer;

/**
 * Completable that runs specified animation once subscribed. The animation parameters used will be those specified
 * once the animation was passed to the constructor. If you change them between passing it to the constructor and
 * subscribing to this completable, those changes will be ignored.
 */
public final class AnimationCompletable extends Completable implements OnAnimationDisposedListener {

    /** Animation to run once subscribed to this completable. */
    @NonNull private final Animation animation;

    /** Action to perform when animation starts. */
    @Nullable private Consumer<View> doOnAnimationStart;

    /** Action to perform when animation gets canceled before it ends. */
    @Nullable private Consumer<View> doOnAnimationCancel;

    /** Action to perform when animation ends without interruption. */
    @Nullable private Consumer<View> doOnAnimationEnd;

    /** Animator for the current running animation. */
    @Nullable private ViewPropertyAnimator animator;

    /**
     * Creates completable that runs provided animation once subscribed to.
     * @param animation Animation to run when subscribed.
     */
    public AnimationCompletable(Animation animation) {
        this.animation = animation;
    }

    /** {@inheritDoc} */
    @Override
    public void onAnimationDisposed() {

    }

    /** {@inheritDoc} */
    @Override
    protected void subscribeActual(CompletableObserver s) {

    }

}

@@ -1577,32 +1577,1262 @@
 imation;%0A    %7D%0A%0A
+    /**%0A     * Sets the action to perform once the animation starts.%0A     * @param onAnimationStart Action to perform once animation starts.%0A     * @return An instance of this completable with this action added.%0A     */%0A    public AnimationCompletable doOnAnimationStart(Consumer%3CView%3E onAnimationStart) %7B%0A        this.doOnAnimationStart = onAnimationStart;%0A        return this;%0A    %7D%0A%0A    /**%0A     * Sets the action to perform once the animation is canceled (doesn't end by itself but it interrupted).%0A     * @param onAnimationCancel Action to perform once animation is canceled.%0A     * @return An instance of this completable with this action added.%0A     */%0A    public AnimationCompletable doOnAnimationCancel(Consumer%3CView%3E onAnimationCancel) %7B%0A        this.doOnAnimationCancel = onAnimationCancel;%0A        return this;%0A    %7D%0A%0A    /**%0A     * Sets the action to perform once the animation ends (is not interrupted).%0A     * @param onAnimationEnd Action to perform once animation is canceled.%0A     * @return An instance of this completable with this action added.%0A     */%0A    public AnimationCompletable doOnAnimationEnd(Consumer%3CView%3E onAnimationEnd) %7B%0A        this.doOnAnimationEnd = onAnimationEnd;%0A        return this;%0A    %7D%0A%0A
     /** %7B@inheri

Add setters for animation actions