is Animator Running - Android android.animation

Android examples for android.animation:Animator

Description

is Animator Running

Demo Code


import android.animation.Animator;
import android.os.Build;
import java.util.List;

public class Main{
    //ww w.  j  av a 2  s  .  c om
    public static boolean isRunning(List<Animator> animators) {
        if (animators != null) {
            for (Animator animator : animators) {
                if (isRunning(animator)) {
                    return true;
                }
            }
        }
        return false;
    }
    
    public static boolean isRunning(Animator animator) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            LogUtil.d(animator.isStarted(), animator.isPaused(),
                    animator.isRunning());
        }
        return animator != null && animator.isRunning();
    }
    
    public static boolean isPaused(List<Animator> animators) {
        if (animators != null && animators.size() > 0) {
            boolean isAllPaused = true;
            for (Animator animator : animators) {
                if (isPaused(animator) == false) {
                    isAllPaused = false;
                }
            }
            return isAllPaused;
        }
        return false;
    }
    
    public static boolean isPaused(Animator animator) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            return animator != null && animator.isPaused();
        }
        return false;
    }
}

Related Tutorials