Example usage for android.animation AnimatorSet getChildAnimations

List of usage examples for android.animation AnimatorSet getChildAnimations

Introduction

In this page you can find the example usage for android.animation AnimatorSet getChildAnimations.

Prototype

public ArrayList<Animator> getChildAnimations() 

Source Link

Document

Returns the current list of child Animator objects controlled by this AnimatorSet.

Usage

From source file:Main.java

public static long getAnimDuration(AnimatorSet animatorset) {
    Iterator iterator = animatorset.getChildAnimations().iterator();
    long l1 = 0L;
    while (iterator.hasNext()) {
        Animator animator = (Animator) iterator.next();
        long l2 = animator.getStartDelay() + animator.getDuration();
        long l3;/*from ww w  .  j  a  v a  2  s  .c  o  m*/
        if (l2 > l1) {
            l3 = l2;
        } else {
            l3 = l1;
        }
        l1 = l3;
    }
    return l1;
}

From source file:Main.java

public static void seekAnim(AnimatorSet animatorset, long l1) {
    if (animatorset != null) {
        if (animatorset.isStarted()) {
            animatorset.end();/*from   www . ja v a2 s.c  o m*/
        }
        Iterator iterator = animatorset.getChildAnimations().iterator();
        do {
            if (!iterator.hasNext()) {
                break;
            }
            Animator animator = (Animator) iterator.next();
            long l2 = l1 - animator.getStartDelay();
            if (l2 < 0L) {
                l2 = 0L;
            }
            if (animator instanceof ValueAnimator) {
                ((ValueAnimator) animator).setCurrentPlayTime(l2);
            }
        } while (true);
    }
}