Example usage for android.animation AnimatorSet playTogether

List of usage examples for android.animation AnimatorSet playTogether

Introduction

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

Prototype

public void playTogether(Collection<Animator> items) 

Source Link

Document

Sets up this AnimatorSet to play all of the supplied animations at the same time.

Usage

From source file:Main.java

public static void slowViewAnimation(View view) {
    ObjectAnimator translationY = ObjectAnimator.ofFloat(view, View.TRANSLATION_Y, -200f, 0f);
    translationY.setDuration(5000);//ww  w  . ja v  a 2 s  .c om
    AnimatorSet translateSlowly = new AnimatorSet();
    translateSlowly.playTogether(translationY);
    translateSlowly.start();
}

From source file:Main.java

private static AnimatorSet buildMenuAnimation(View target, float alpha, int animationDuration) {

    AnimatorSet alphaAnimation = new AnimatorSet();
    alphaAnimation.playTogether(ObjectAnimator.ofFloat(target, "alpha", alpha));

    alphaAnimation.setDuration(animationDuration);
    return alphaAnimation;
}

From source file:Main.java

public static void playTogether(ObjectAnimator... animator) {
    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.setDuration(200);//from  w  w w  .  j ava2s.c o m
    animatorSet.playTogether(animator);
    animatorSet.start();

}

From source file:despotoski.nikola.github.com.bottomnavigationlayout.Util.java

@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public static void playTogether(Animator... animators) {
    AnimatorSet set = new AnimatorSet();
    set.playTogether(animators);
    set.start();/*from www. j a  v  a  2s .com*/
}

From source file:Main.java

public static AnimatorSet createSequentialAnimatorSet(long interval, List<Animator> os) {
    AnimatorSet result = createAnimatorSet();

    if (os != null) {
        for (Animator o : os) {
            o.setStartDelay(interval);//from w w  w .  j a  v a 2  s.c  o  m
            interval += interval;
        }
        result.playTogether(os);
    }
    return result;
}

From source file:com.sysdata.widget.accordion.CollapsedViewHolder.java

private Animator createExpandingAnimator(ArrowItemViewHolder newHolder, long duration) {
    if (arrow != null) {
        arrow.setVisibility(View.INVISIBLE);
    }/*from  ww  w .  ja  v a2  s  .  c  o m*/

    final View oldView = itemView;
    final View newView = newHolder.itemView;
    final Animator boundsAnimator = AnimatorUtils.getBoundsAnimator(oldView, oldView, newView)
            .setDuration(duration);
    boundsAnimator.setInterpolator(AnimatorUtils.INTERPOLATOR_FAST_OUT_SLOW_IN);

    final AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.playTogether(boundsAnimator);
    return animatorSet;
}

From source file:org.amahi.anywhere.tv.fragment.IntroFragment.java

@Override
protected Animator onCreateEnterAnimation() {
    ArrayList<Animator> animators = new ArrayList<>();

    animators.add(createFadeInAnimator(mBackgroundView));

    mContentView.setImageResource(CONTENT_IMAGES[0]);

    mContentAnimator = createFadeInAnimator(mContentView);

    animators.add(mContentAnimator);/* w w  w.j  a v a 2s  .co  m*/

    AnimatorSet set = new AnimatorSet();

    set.playTogether(animators);

    mBackgroundView.setBackground(new ColorDrawable(mColors.get(0)));

    return set;
}

From source file:com.devilyang.musicstation.swinginadapters.AnimationAdapter.java

private void animateView(int position, ViewGroup parent, View view) {
    if (mAnimationStartMillis == -1) {
        mAnimationStartMillis = System.currentTimeMillis();
    }/*from  w w  w. j a  va  2s  .c  om*/

    //      ViewDragHelper.setAlpha(view, 0);
    view.setAlpha(0);

    Animator[] childAnimators;
    if (mDecoratedBaseAdapter instanceof AnimationAdapter) {
        childAnimators = ((AnimationAdapter) mDecoratedBaseAdapter).getAnimators(parent, view);
    } else {
        childAnimators = new Animator[0];
    }
    Animator[] animators = getAnimators(parent, view);
    Animator alphaAnimator = ObjectAnimator.ofFloat(view, "alpha", 0, 1);

    AnimatorSet set = new AnimatorSet();
    set.playTogether(concatAnimators(childAnimators, animators, alphaAnimator));
    set.setStartDelay(calculateAnimationDelay());
    set.setDuration(getAnimationDurationMillis());
    set.start();

    mAnimators.put(view.hashCode(), set);
}

From source file:com.dalingge.gankio.common.widgets.recyclerview.anim.adapter.helper.ViewAnimator.java

/**
 * Animates given View.//from  w w  w. j a  va  2 s . c  om
 *
 * @param view the View that should be animated.
 */
private void animateView(final int position, @NonNull final View view, @NonNull final Animator[] animators) {
    if (mAnimationStartMillis == -1) {
        mAnimationStartMillis = SystemClock.uptimeMillis();
    }

    ViewCompat.setAlpha(view, 0);

    AnimatorSet set = new AnimatorSet();
    set.playTogether(animators);
    set.setStartDelay(calculateAnimationDelay(position));
    set.setDuration(mAnimationDurationMillis);
    set.start();

    mAnimators.put(view.hashCode(), set);
}

From source file:com.xianxiaotao.copyandstudy.xcopy.recycleranim.adapter.helper.ViewAnimator.java

/**
 * Animates given View.//www .  j a v  a 2s  .  c om
 *
 * @param view the View that should be animated.
 */
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void animateView(final int position, @NonNull final View view, @NonNull final Animator[] animators) {
    if (mAnimationStartMillis == -1) {
        mAnimationStartMillis = SystemClock.uptimeMillis();
    }

    ViewCompat.setAlpha(view, 0);

    AnimatorSet set = new AnimatorSet();
    set.playTogether(animators);
    set.setStartDelay(calculateAnimationDelay(position));
    set.setDuration(mAnimationDurationMillis);
    set.start();

    mAnimators.put(view.hashCode(), set);
}