Example usage for android.view.animation Animation getStartOffset

List of usage examples for android.view.animation Animation getStartOffset

Introduction

In this page you can find the example usage for android.view.animation Animation getStartOffset.

Prototype

public long getStartOffset() 

Source Link

Document

When this animation should start, relative to StartTime

Usage

From source file:com.github.shareme.gwsmaterialuikit.library.material.app.ToolbarManager.java

private void animateOut() {
    ActionMenuView menuView = getMenuView();
    int count = menuView == null ? 0 : menuView.getChildCount();
    Animation slowestAnimation = null;
    mAnimations.clear();//from w w  w . j  a  v  a2 s.c  o  m
    mAnimations.ensureCapacity(count);

    for (int i = 0; i < count; i++) {
        View child = menuView.getChildAt(i);
        Animation anim = mAnimator.getOutAnimation(child, i);
        mAnimations.add(anim);
        if (anim != null)
            if (slowestAnimation == null || slowestAnimation.getStartOffset()
                    + slowestAnimation.getDuration() < anim.getStartOffset() + anim.getDuration())
                slowestAnimation = anim;
    }

    if (slowestAnimation == null)
        mOutAnimationEndListener.onAnimationEnd(null);
    else {
        slowestAnimation.setAnimationListener(mOutAnimationEndListener);

        for (int i = 0; i < count; i++) {
            Animation anim = mAnimations.get(i);
            if (anim != null)
                menuView.getChildAt(i).startAnimation(anim);
        }
    }

    mAnimations.clear();
}