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:io.vit.vitio.StartScreens.DetailFragment.java

public void animate() {
    ObjectAnimator animatorY = ObjectAnimator.ofFloat(displayImage, "translationY", 200, 0);
    ObjectAnimator animatorA = ObjectAnimator.ofFloat(displayImage, "alpha", 0, 1);
    animatorY.setDuration(200);//from w  ww  .ja v a2 s .  c  o  m
    animatorA.setDuration(200);
    animatorY.setInterpolator(new AccelerateInterpolator());
    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.playTogether(animatorY, animatorA);
    animatorSet.start();
}

From source file:com.google.samples.apps.ourstreets.fragment.StreetViewFragment.java

/**
 * Reveals the contents of this fragment using a circular reveal animation.
 *///from w w  w .  jav a  2s .c o m
private void revealPanorama() {
    //noinspection ConstantConditions
    getView().setVisibility(View.VISIBLE);
    //noinspection ConstantConditions
    Animator circularReveal = ViewUtils.createCircularReveal(mRevealCenter, mRevealWidth, getView(),
            INTERPOLATOR);
    ObjectAnimator colorChange = ViewUtils.createColorChange(((FrameLayout) getView()), R.color.foreground,
            android.R.color.transparent, INTERPOLATOR);
    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.play(circularReveal).with(colorChange);
    animatorSet.start();
}

From source file:io.vit.vitio.Settings.ComingSoonActivity.java

private void toggleCircle(ImageView imon, ImageView imoff[]) {
    imon.setActivated(true);//from w  w w  .  jav  a  2 s .c  o  m
    ObjectAnimator animatorX = ObjectAnimator.ofFloat(imon, "scaleX", 0.5f, 1.0f);
    ObjectAnimator animatorY = ObjectAnimator.ofFloat(imon, "scaleY", 0.5f, 1.0f);
    animatorX.setDuration(300);
    animatorY.setDuration(300);
    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.playTogether(animatorX, animatorY);
    animatorSet.start();
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
            (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 10,
                    getResources().getDisplayMetrics()),
            (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 10,
                    getResources().getDisplayMetrics()));
    params.setMargins(0, 0, (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 13,
            getResources().getDisplayMetrics()), 0);
    imon.setLayoutParams(params);
    for (int i = 0; i < imoff.length; i++) {
        imoff[i].setActivated(false);
        params = new LinearLayout.LayoutParams(
                (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 6,
                        getResources().getDisplayMetrics()),
                (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 6,
                        getResources().getDisplayMetrics()));
        params.setMargins(0, 0, (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 13,
                getResources().getDisplayMetrics()), 0);
        imoff[i].setLayoutParams(params);
    }
}

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

@Override
protected void onPageChanged(final int newPage, int previousPage) {
    if (mContentAnimator != null) {
        mContentAnimator.end();//  w  w w .  j a v a2s  . c  o m
    }

    ArrayList<Animator> animators = new ArrayList<>();

    Animator fadeOut = createFadeOutAnimator(mContentView);

    fadeOut.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            Log.d(getClass().getName(), String.valueOf(newPage));
            mContentView.setImageResource(CONTENT_IMAGES[newPage]);
            switch (newPage) {
            case 0:
                mBackgroundView.setBackground(new ColorDrawable(mColors.get(newPage)));
                break;
            case 1:
                mBackgroundView.setBackground(new ColorDrawable(mColors.get(newPage)));
                break;
            case 2:
                mBackgroundView.setBackground(new ColorDrawable(mColors.get(newPage)));
                break;
            case 3:
                mBackgroundView.setBackground(new ColorDrawable(mColors.get(newPage)));
                break;
            case 4:
                mBackgroundView.setBackground(new ColorDrawable(mColors.get(newPage)));
                break;
            case 5:
                mBackgroundView.setBackground(new ColorDrawable(mColors.get(newPage)));
                break;
            }
        }
    });

    animators.add(fadeOut);

    animators.add(createFadeInAnimator(mContentView));

    AnimatorSet set = new AnimatorSet();

    set.playSequentially(animators);

    set.start();

    mContentAnimator = set;
}

From source file:org.cyanogenmod.designertools.ui.CreditsActivity.java

private void animateContent() {
    View avatar1 = findViewById(R.id.avatar1);
    avatar1.setScaleX(0);/*from  w w  w  .java 2  s .  c  o  m*/
    avatar1.setScaleY(0);
    avatar1.setVisibility(View.VISIBLE);
    View text1 = findViewById(R.id.text1);
    text1.setAlpha(0);
    text1.setVisibility(View.VISIBLE);
    View avatar2 = findViewById(R.id.avatar2);
    avatar2.setScaleX(0);
    avatar2.setScaleY(0);
    avatar2.setVisibility(View.VISIBLE);
    View text2 = findViewById(R.id.text2);
    text2.setAlpha(0);
    text2.setVisibility(View.VISIBLE);
    View avatar3 = findViewById(R.id.avatar3);
    avatar3.setScaleX(0);
    avatar3.setScaleY(0);
    avatar3.setVisibility(View.VISIBLE);
    View text3 = findViewById(R.id.text3);
    text3.setAlpha(0);
    text3.setVisibility(View.VISIBLE);
    View avatar4 = findViewById(R.id.avatar4);
    avatar4.setScaleX(0);
    avatar4.setScaleY(0);
    avatar4.setVisibility(View.VISIBLE);
    View text4 = findViewById(R.id.text4);
    text4.setAlpha(0);
    text4.setVisibility(View.VISIBLE);

    Interpolator interpolator = new FastOutSlowInInterpolator();
    long duration = 375L;
    long delay = duration / 3;

    AnimatorSet anim1 = new AnimatorSet();
    anim1.play(ObjectAnimator.ofFloat(avatar1, "scaleX", 1f))
            .with(ObjectAnimator.ofFloat(avatar1, "scaleY", 1f))
            .with(ObjectAnimator.ofFloat(text1, "alpha", 1f));
    anim1.setDuration(duration);
    anim1.setInterpolator(interpolator);
    AnimatorSet anim2 = new AnimatorSet();
    anim2.play(ObjectAnimator.ofFloat(avatar2, "scaleX", 1f))
            .with(ObjectAnimator.ofFloat(avatar2, "scaleY", 1f))
            .with(ObjectAnimator.ofFloat(text2, "alpha", 1f));
    anim2.setDuration(duration);
    anim2.setInterpolator(interpolator);
    anim2.setStartDelay(delay);
    AnimatorSet anim3 = new AnimatorSet();
    anim3.play(ObjectAnimator.ofFloat(avatar3, "scaleX", 1f))
            .with(ObjectAnimator.ofFloat(avatar3, "scaleY", 1f))
            .with(ObjectAnimator.ofFloat(text3, "alpha", 1f));
    anim3.setDuration(duration);
    anim3.setInterpolator(interpolator);
    anim3.setStartDelay(delay * 2);
    AnimatorSet anim4 = new AnimatorSet();
    anim4.play(ObjectAnimator.ofFloat(avatar4, "scaleX", 1f))
            .with(ObjectAnimator.ofFloat(avatar4, "scaleY", 1f))
            .with(ObjectAnimator.ofFloat(text4, "alpha", 1f));
    anim4.setDuration(duration);
    anim4.setInterpolator(interpolator);
    anim4.setStartDelay(delay * 3);
    AnimatorSet set = new AnimatorSet();
    set.play(anim1).with(anim2);
    set.play(anim2).with(anim3);
    set.play(anim3).with(anim4);
    set.start();
}

From source file:io.vit.vitio.StartScreens.FragmentHolder.java

private void toggleCircle(ImageView imon, ImageView imoff[]) {
    imon.setActivated(true);/*from  w  ww . j  a  va  2  s .  co m*/
    ObjectAnimator animatorX = ObjectAnimator.ofFloat(imon, "scaleX", 0.5f, 1.0f);
    ObjectAnimator animatorY = ObjectAnimator.ofFloat(imon, "scaleY", 0.5f, 1.0f);
    animatorX.setDuration(300);
    animatorY.setDuration(300);
    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.playTogether(animatorX, animatorY);
    animatorSet.start();
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
            (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 10,
                    getResources().getDisplayMetrics()),
            (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 10,
                    getResources().getDisplayMetrics()));
    if (imon != im7)
        params.setMargins(0, 0, (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 13,
                getResources().getDisplayMetrics()), 0);
    imon.setLayoutParams(params);
    for (int i = 0; i < imoff.length; i++) {
        imoff[i].setActivated(false);
        params = new LinearLayout.LayoutParams(
                (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 6,
                        getResources().getDisplayMetrics()),
                (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 6,
                        getResources().getDisplayMetrics()));
        if (imoff[i] != im7)
            params.setMargins(0, 0, (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 13,
                    getResources().getDisplayMetrics()), 0);
        imoff[i].setLayoutParams(params);
    }
}

From source file:com.metinkale.prayerapp.compass._2D.Frag2D.java

public void show() {
    mHidden = false;/*from w  w  w  . jav  a 2  s . c om*/
    mCompassView.post(new Runnable() {
        @Override
        public void run() {
            ObjectAnimator scaleX = ObjectAnimator.ofFloat(mCompassView, "scaleX", 0, 1);
            ObjectAnimator scaleY = ObjectAnimator.ofFloat(mCompassView, "scaleY", 0, 1);

            ObjectAnimator scaleX2 = ObjectAnimator.ofFloat(mInfo, "scaleX", 0, 1);
            ObjectAnimator scaleY2 = ObjectAnimator.ofFloat(mInfo, "scaleY", 0, 1);
            AnimatorSet animSetXY = new AnimatorSet();
            animSetXY.playTogether(scaleX, scaleY, scaleX2, scaleY2);
            animSetXY.setInterpolator(overshootInterpolator);
            animSetXY.setDuration(300);
            animSetXY.start();
        }
    });

}

From source file:com.metinkale.prayerapp.compass._2D.Frag2D.java

public void hide() {
    mHidden = true;//from ww w  .ja  va  2 s . com
    mCompassView.post(new Runnable() {
        @Override
        public void run() {
            ObjectAnimator scaleX = ObjectAnimator.ofFloat(mCompassView, "scaleX", 1, 0);
            ObjectAnimator scaleY = ObjectAnimator.ofFloat(mCompassView, "scaleY", 1, 0);

            ObjectAnimator scaleX2 = ObjectAnimator.ofFloat(mInfo, "scaleX", 1, 0);
            ObjectAnimator scaleY2 = ObjectAnimator.ofFloat(mInfo, "scaleY", 1, 0);

            AnimatorSet animSetXY = new AnimatorSet();
            animSetXY.playTogether(scaleX, scaleY, scaleX2, scaleY2);
            animSetXY.setInterpolator(accelerateInterpolator);
            animSetXY.setDuration(300);
            animSetXY.start();
        }
    });

}

From source file:arun.com.chromer.shared.views.TabView.java

private void selectedAnimation() {
    clearAnimations();//from   w  w w  .  jav  a  2s  . co  m
    final AnimatorSet transformAnimator = new AnimatorSet();
    transformAnimator.playTogether(ObjectAnimator.ofFloat(tabIcon, "translationX", getIconCentreInLayout()),
            ObjectAnimator.ofFloat(tabIcon, "scaleX", 1f), ObjectAnimator.ofFloat(tabIcon, "scaleY", 1f),
            ObjectAnimator.ofFloat(text, "scaleX", 0f), ObjectAnimator.ofFloat(text, "scaleY", 0f),
            ObjectAnimator.ofFloat(text, "alpha", 0f));
    transformAnimator.setDuration(275);
    transformAnimator.setInterpolator(new AccelerateDecelerateInterpolator());

    final AnimatorSet togetherAnimator = new AnimatorSet();
    togetherAnimator.playSequentially(transformAnimator, getIconSelectionAnimator());
    togetherAnimator.start();
}

From source file:arun.com.chromer.shared.views.TabView.java

private void unSelectedAnimation() {
    clearAnimations();/*from  w ww. ja  v  a2s  . c om*/
    final AnimatorSet transformAnimator = new AnimatorSet();
    transformAnimator.playTogether(ObjectAnimator.ofFloat(tabIcon, "translationX", initialIconX),
            ObjectAnimator.ofFloat(tabIcon, "scaleX", 0.75f), ObjectAnimator.ofFloat(tabIcon, "scaleY", 0.75f),
            ObjectAnimator.ofFloat(text, "scaleX", 1f), ObjectAnimator.ofFloat(text, "scaleY", 1f),
            ObjectAnimator.ofFloat(text, "alpha", 1f));
    transformAnimator.setDuration(275);
    transformAnimator.setInterpolator(new AccelerateDecelerateInterpolator());

    final AnimatorSet sequentialAnimator = new AnimatorSet();
    sequentialAnimator.playTogether(transformAnimator, getIconUnSelectionAnimator());
    sequentialAnimator.start();
}