Example usage for android.animation AnimatorSet start

List of usage examples for android.animation AnimatorSet start

Introduction

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

Prototype

@SuppressWarnings("unchecked")
@Override
public void start() 

Source Link

Document

Starting this AnimatorSet will, in turn, start the animations for which it is responsible.

Usage

From source file:com.example.linhdq.test.install.InstallActivity.java

private void startInstallAnimation() {
    mTip1.setAlpha(0);//from   w w  w.j  a va 2  s. c o  m
    mTip2.setAlpha(0);
    mTip3.setAlpha(0);
    mYoutube.setAlpha(0);

    ObjectAnimator anim1 = ObjectAnimator.ofFloat(mTip1, "alpha", 1);
    ObjectAnimator anim2 = ObjectAnimator.ofFloat(mTip2, "alpha", 1);
    ObjectAnimator anim3 = ObjectAnimator.ofFloat(mTip3, "alpha", 1);
    ObjectAnimator anim4 = ObjectAnimator.ofFloat(mYoutube, "alpha", 1);
    AnimatorSet set = new AnimatorSet();
    set.setStartDelay(300);
    set.setDuration(600);
    set.playTogether(anim1, anim2, anim3, anim4);
    set.start();
    mFairyAnimation.start();

}

From source file:com.ibm.mil.readyapps.physio.fragments.LandingFragment.java

private void animateMetricsIn(boolean isInitial) {
    int delay = 0;
    if (isInitial) {
        delay = INIT_DELAY;//from w w w.j  a  va2 s  . c  om
    }

    ObjectAnimator heartRateSlideInAnimator = ObjectAnimator.ofFloat(heartRateTab, "translationX", 1f);
    ObjectAnimator weightSlideInAnimator = ObjectAnimator.ofFloat(weightTab, "translationX", 1f);
    ObjectAnimator stepsSlideInAnimator = ObjectAnimator.ofFloat(stepsTab, "translationX", 1f);

    heartRateSlideInAnimator.setDuration(ANIM_SPEED * 2);
    heartRateSlideInAnimator.setStartDelay(delay);

    weightSlideInAnimator.setDuration(ANIM_SPEED * 2);
    weightSlideInAnimator.setStartDelay(delay + (ANIM_SPEED * 2));

    stepsSlideInAnimator.setDuration(ANIM_SPEED * 2);
    stepsSlideInAnimator.setStartDelay(delay + ANIM_SPEED);

    AnimatorSet slideIn = new AnimatorSet();
    slideIn.play(heartRateSlideInAnimator).with(stepsSlideInAnimator).with(weightSlideInAnimator);
    slideIn.start();
}

From source file:la.marsave.fullscreentest.MainActivity.java

/**
 * This method animates the image fragment into the background by both
 * scaling and rotating the fragment's view, as well as adding a
 * translucent dark hover view to inform the user that it is inactive.
 *//*  w  w  w. j av  a  2  s  .  c om*/
public void slideBack(Animator.AnimatorListener listener) {
    View movingFragmentView = mInfiniteViewPager;

    PropertyValuesHolder rotateX = PropertyValuesHolder.ofFloat("rotationY", 40f);
    PropertyValuesHolder scaleX = PropertyValuesHolder.ofFloat("scaleX", 0.8f);
    PropertyValuesHolder scaleY = PropertyValuesHolder.ofFloat("scaleY", 0.8f);
    ObjectAnimator movingFragmentAnimator = ObjectAnimator.ofPropertyValuesHolder(movingFragmentView, rotateX,
            scaleX, scaleY);

    ObjectAnimator darkHoverViewAnimator = ObjectAnimator.ofFloat(mDarkHoverView, "alpha", 0.0f, 0.5f);

    ObjectAnimator movingFragmentRotator = ObjectAnimator.ofFloat(movingFragmentView, "rotationY", 0);
    movingFragmentRotator.setStartDelay(getResources().getInteger(R.integer.half_slide_up_down_duration));

    AnimatorSet s = new AnimatorSet();
    s.playTogether(movingFragmentAnimator, darkHoverViewAnimator, movingFragmentRotator);
    s.addListener(listener);
    s.start();
}

From source file:com.ibm.mil.readyapps.physio.fragments.LandingFragment.java

private void animateMetricsOut(boolean isInitial) {
    int delay = 0;
    if (isInitial) {
        delay = INIT_DELAY;//from   www  .  j ava 2s.  co  m
    }

    ObjectAnimator weightSlideOutAnimator = ObjectAnimator.ofFloat(weightTab, "translationX",
            1f + SLIDE_OFFSET);
    ObjectAnimator heartRateSlideOutAnimator = ObjectAnimator.ofFloat(heartRateTab, "translationX",
            1f + SLIDE_OFFSET);
    ObjectAnimator stepsSlideOutAnimator = ObjectAnimator.ofFloat(stepsTab, "translationX", 1f + SLIDE_OFFSET);

    heartRateSlideOutAnimator.setDuration(ANIM_SPEED * 2);
    heartRateSlideOutAnimator.setStartDelay(ANIM_SPEED * 2);

    weightSlideOutAnimator.setDuration(ANIM_SPEED * 2);
    weightSlideOutAnimator.setStartDelay(delay);

    stepsSlideOutAnimator.setDuration(ANIM_SPEED * 2);
    stepsSlideOutAnimator.setStartDelay(ANIM_SPEED);

    AnimatorSet outAnimation = new AnimatorSet();
    outAnimation.play(weightSlideOutAnimator).with(stepsSlideOutAnimator).with(heartRateSlideOutAnimator);
    outAnimation.start();
}

From source file:sg.fxl.topekaport.QuizActivity.java

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void revealFragmentContainerLollipop(final View clickedView, final FrameLayout fragmentContainer) {
    prepareCircularReveal(clickedView, fragmentContainer);

    ViewCompat.animate(clickedView).scaleX(0).scaleY(0).alpha(0).setInterpolator(interpolator)
            .setListener(new ViewPropertyAnimatorListenerAdapter() {
                @Override/*from   w  w  w  .  j a v a 2  s  .  c  o  m*/
                public void onAnimationEnd(View view) {
                    fragmentContainer.setVisibility(View.VISIBLE);
                    clickedView.setVisibility(View.GONE);
                }
            }).start();

    fragmentContainer.setVisibility(View.VISIBLE);
    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.play(circularReveal).with(colorChange);
    animatorSet.start();
}

From source file:com.google.samples.apps.topeka.activity.QuizActivity.java

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void revealFragmentContainerLollipop(final View clickedView, final FrameLayout fragmentContainer) {
    prepareCircularReveal(clickedView, fragmentContainer);

    ViewCompat.animate(clickedView).scaleX(0).scaleY(0).alpha(0).setInterpolator(mInterpolator)
            .setListener(new ViewPropertyAnimatorListenerAdapter() {
                @Override//from  ww  w.j  a v a2s. co  m
                public void onAnimationEnd(View view) {
                    fragmentContainer.setVisibility(View.VISIBLE);
                    clickedView.setVisibility(View.GONE);
                }
            }).start();

    fragmentContainer.setVisibility(View.VISIBLE);
    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.play(mCircularReveal).with(mColorChange);
    animatorSet.start();
}

From source file:fr.tvbarthel.apps.cameracolorpicker.activities.MainActivity.java

/**
 * Make a subtle animation for a {@link com.melnykov.fab.FloatingActionButton} drawing attention to the button.
 *
 * @param fab the {@link com.melnykov.fab.FloatingActionButton} to animate.
 *//*www .  j  a  va2  s  . c o m*/
private void animateFab(final FloatingActionButton fab) {
    fab.postDelayed(new Runnable() {
        @Override
        public void run() {
            // Play a subtle animation
            final long duration = 450;

            final ObjectAnimator scaleXAnimator = ObjectAnimator.ofFloat(fab, View.SCALE_X, 1f, 1.2f, 1f);
            scaleXAnimator.setDuration(duration);
            scaleXAnimator.setRepeatCount(1);

            final ObjectAnimator scaleYAnimator = ObjectAnimator.ofFloat(fab, View.SCALE_Y, 1f, 1.2f, 1f);
            scaleYAnimator.setDuration(duration);
            scaleYAnimator.setRepeatCount(1);

            scaleXAnimator.start();
            scaleYAnimator.start();

            final AnimatorSet animatorSet = new AnimatorSet();
            animatorSet.play(scaleXAnimator).with(scaleYAnimator);
            animatorSet.start();
        }
    }, 400);
}

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

/**
 * Animates given View./*from   w  ww. j a  v a  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.devilyang.musicstation.swinginadapters.AnimationAdapter.java

private void animateView(int position, ViewGroup parent, View view) {
    if (mAnimationStartMillis == -1) {
        mAnimationStartMillis = System.currentTimeMillis();
    }//w w  w  .ja  v a 2 s  .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.xianxiaotao.copyandstudy.xcopy.recycleranim.adapter.helper.ViewAnimator.java

/**
 * Animates given View./*from w ww .j  a  v a 2  s.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);
}