package com.akexorcist.mvpsimple.utility;

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

import com.akexorcist.mvpsimple.R;

/**
 * Created by Akexorcist on 7/14/16 AD.
 */
public class AnimationManager {
    private static AnimationManager animationManager;

    public static AnimationManager getInstance() {
        if (animationManager == null) {
            animationManager = new AnimationManager();
        }
        return animationManager;
    }

    public static void clear() {
        animationManager = null;
    }

    public void applyViewFadeIn(View view) {
        Animator fadeInAnimator = AnimatorInflater.loadAnimator(Contextor.getInstance().getContext(), R.animator.animator_fade_in);
        fadeInAnimator.setTarget(view);
        fadeInAnimator.start();
        view.setVisibility(View.VISIBLE);
    }

    public void applyViewFadeOut(final View view) {
        Animator fadeInAnimator = AnimatorInflater.loadAnimator(Contextor.getInstance().getContext(), R.animator.animator_fade_out);
        fadeInAnimator.setTarget(view);
        fadeInAnimator.start();
        fadeInAnimator.addListener(new Animator.AnimatorListener() {
            @Override
            public void onAnimationStart(Animator animator) {
            }

            @Override
            public void onAnimationEnd(Animator animator) {
                view.setVisibility(View.GONE);
            }

            @Override
            public void onAnimationCancel(Animator animator) {
            }

            @Override
            public void onAnimationRepeat(Animator animator) {
            }
        });
    }

}

@@ -618,32 +618,135 @@
 In(View view) %7B%0A
+        applyViewFadeOut(view, -1);%0A    %7D%0A%0A    public void applyViewFadeIn(View view, long duration) %7B%0A
         Animator
@@ -861,16 +861,104 @@
 de_in);%0A
+        if(duration %3E= 0) %7B%0A            fadeInAnimator.setDuration(duration);%0A        %7D%0A
         
@@ -1107,14 +1107,8 @@
 Out(
-final 
 View
@@ -1104,32 +1104,142 @@
 adeOut(View view
+) %7B%0A        applyViewFadeOut(view, -1);%0A    %7D%0A%0A    public void applyViewFadeOut(final View view, long duration
 ) %7B%0A        Anim
@@ -1359,16 +1359,104 @@
 e_out);%0A
+        if(duration %3E= 0) %7B%0A            fadeInAnimator.setDuration(duration);%0A        %7D%0A
         

Add duration setter