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.github.jokar.rxupload.widget.ProgressDownloadView.java

public void drawFail() {
    mState = State.STATE_FAILED;/*  ww w .j a  v a2  s .  c om*/

    ObjectAnimator failAnim = ObjectAnimator.ofFloat(this, "failAngle", 0, 180);
    failAnim.setInterpolator(new OvershootInterpolator());

    //This one doesn't do much actually, we just use it to take advantage of associating two different interpolators
    ObjectAnimator anim = ObjectAnimator.ofFloat(this, "progress", getProgress(), mTarget);
    anim.setInterpolator(new AccelerateInterpolator());

    AnimatorSet set = new AnimatorSet();
    set.setDuration((long) (ANIMATION_DURATION_BASE / 1.7f));
    set.playTogether(failAnim, anim);
    set.start();
}

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

/**
 * Perform the animation from loading progress to the actual fragment's content.
 *///from  w w  w . ja  v  a 2 s  .  c o m
private void animateProgressToContent() {
    AnimatorSet animatorSet = new AnimatorSet();
    FrameLayout targetView = ((FrameLayout) getView());
    //noinspection ConstantConditions
    animatorSet.play(createCircularReveal(targetView)).with(createColorChange(targetView));
    animatorSet.start();
}

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

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

    ViewCompat.animate(clickedView).scaleX(0).scaleY(0).alpha(0).setInterpolator(mInterpolator)
            .setListener(new ViewPropertyAnimatorListenerAdapter() {
                @Override/*w  w w  .j  a  v  a 2 s  .  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:org.muckebox.android.ui.activity.WizardActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_wizard);

    mExtraContainer = findViewById(R.id.wizard_extra_container);
    mExtraContainer.measure(SPEC, SPEC);
    mExtraContainerHeight = mExtraContainer.getMeasuredHeight();

    LayoutParams params = mExtraContainer.getLayoutParams();
    params.height = 0;//from w w  w  . j  av a2 s .  c  o m
    mExtraContainer.setLayoutParams(params);

    mExpandButton = findViewById(R.id.wizard_expand_button);
    mExpandButton.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            AnimatorSet animatorSet = new AnimatorSet();

            animatorSet.play(
                    ValueAnimator.ofObject(new HeightEvaluator(mExtraContainer), 0, mExtraContainerHeight));
            animatorSet.play(
                    ValueAnimator.ofObject(new HeightEvaluator(mExpandButton), mExpandButton.getHeight(), 0));

            animatorSet.start();
        }
    });

    mServerText = (TextView) findViewById(R.id.wizard_server_text);
    mPasswordText = (TextView) findViewById(R.id.wizard_server_password);
    mPortText = (TextView) findViewById(R.id.wizard_port_text);
    mSslCheckbox = (CheckBox) findViewById(R.id.wizard_ssl_enabled);

    mResultText = (TextView) findViewById(R.id.wizard_result_text);

    readFromPreferences();
}

From source file:com.andremion.floatingnavigationview.FloatingNavigationView.java

private void startOpenAnimations() {

    // Icon/*from  w w w  .j  a v a  2  s .co  m*/
    // Animated Icons
    AnimatedVectorDrawable menuIcon = (AnimatedVectorDrawable) ContextCompat.getDrawable(getContext(),
            R.drawable.ic_menu_animated);
    mFabView.setImageDrawable(menuIcon);
    menuIcon.start();

    // Reveal
    int centerX = mFabRect.centerX();
    int centerY = mFabRect.centerY();
    float startRadius = getMinRadius();
    float endRadius = getMaxRadius();
    Animator reveal = ViewAnimationUtils.createCircularReveal(mNavigationView, centerX, centerY, startRadius,
            endRadius);

    // Fade in
    mNavigationMenuView.setAlpha(0);
    Animator fade = ObjectAnimator.ofFloat(mNavigationMenuView, View.ALPHA, 0, 1);

    // Animations
    AnimatorSet set = new AnimatorSet();
    set.playSequentially(reveal, fade);
    set.start();
}

From source file:com.andremion.floatingnavigationview.FloatingNavigationView.java

private void startCloseAnimations() {

    // Icon/*from  www  . ja  v  a  2  s .com*/
    AnimatedVectorDrawable closeIcon = (AnimatedVectorDrawable) ContextCompat.getDrawable(getContext(),
            R.drawable.ic_close_animated);
    mFabView.setImageDrawable(closeIcon);
    closeIcon.start();

    // Unreveal
    int centerX = mFabRect.centerX();
    int centerY = mFabRect.centerY();
    float startRadius = getMaxRadius();
    float endRadius = getMinRadius();
    Animator reveal = ViewAnimationUtils.createCircularReveal(mNavigationView, centerX, centerY, startRadius,
            endRadius);
    reveal.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            detachNavigationView();
        }
    });

    // Fade out
    Animator fade = ObjectAnimator.ofFloat(mNavigationMenuView, View.ALPHA, 1, 0);

    // Animations
    AnimatorSet set = new AnimatorSet();
    set.playTogether(fade, reveal);
    set.start();
}

From source file:com.gudong.appkit.ui.fragment.AppListFragment.java

@Override
public void onClickListItemIcon(View iconView, AppEntity entity) {
    ObjectAnimator animatorRotation = ObjectAnimator.ofFloat(iconView, "rotation", 0, 360);
    ObjectAnimator scaleRotationX = ObjectAnimator.ofFloat(iconView, "scaleX", 0, 1F);
    ObjectAnimator scaleRotationY = ObjectAnimator.ofFloat(iconView, "scaleY", 0, 1F);
    AnimatorSet animationSet = new AnimatorSet();
    animationSet.playTogether(animatorRotation, scaleRotationY, scaleRotationX);
    animationSet.setDuration(500);/*from  w  ww . j a va2 s.  c  om*/
    animationSet.start();
}

From source file:com.google.samples.apps.iosched.util.LPreviewUtilsBase.java

public void setOrAnimatePlusCheckIcon(final ImageView imageView, boolean isCheck, boolean allowAnimate) {
    final int imageResId = isCheck ? R.drawable.add_schedule_button_icon_checked
            : R.drawable.add_schedule_button_icon_unchecked;

    if (imageView.getTag() != null) {
        if (imageView.getTag() instanceof Animator) {
            Animator anim = (Animator) imageView.getTag();
            anim.end();//from   w w  w  . j a v a  2 s  .c  o m
            imageView.setAlpha(1f);
        }
    }

    if (allowAnimate && isCheck) {
        int duration = mActivity.getResources().getInteger(android.R.integer.config_shortAnimTime);

        Animator outAnimator = ObjectAnimator.ofFloat(imageView, View.ALPHA, 0f);
        outAnimator.setDuration(duration / 2);
        outAnimator.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                imageView.setImageResource(imageResId);
            }
        });

        AnimatorSet inAnimator = new AnimatorSet();
        outAnimator.setDuration(duration);
        inAnimator.playTogether(ObjectAnimator.ofFloat(imageView, View.ALPHA, 1f),
                ObjectAnimator.ofFloat(imageView, View.SCALE_X, 0f, 1f),
                ObjectAnimator.ofFloat(imageView, View.SCALE_Y, 0f, 1f));

        AnimatorSet set = new AnimatorSet();
        set.playSequentially(outAnimator, inAnimator);
        set.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                imageView.setTag(null);
            }
        });
        imageView.setTag(set);
        set.start();
    } else {
        mHandler.post(new Runnable() {
            @Override
            public void run() {
                imageView.setImageResource(imageResId);
            }
        });
    }
}

From source file:fr.paug.droidcon.util.LPreviewUtilsBase.java

public void setOrAnimatePlusCheckIcon(final ImageView imageView, boolean isCheck, boolean allowAnimate,
        int resIdChecked) {

    final int imageResId = isCheck ? resIdChecked : R.drawable.add_schedule_button_icon_unchecked;

    if (imageView.getTag() != null) {
        if (imageView.getTag() instanceof Animator) {
            Animator anim = (Animator) imageView.getTag();
            anim.end();/*  ww  w .  ja  v  a2  s .c  o  m*/
            imageView.setAlpha(1f);
        }
    }

    if (allowAnimate && isCheck) {
        int duration = mActivity.getResources().getInteger(android.R.integer.config_shortAnimTime);

        Animator outAnimator = ObjectAnimator.ofFloat(imageView, View.ALPHA, 0f);
        outAnimator.setDuration(duration / 2);
        outAnimator.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                imageView.setImageResource(imageResId);
            }
        });

        AnimatorSet inAnimator = new AnimatorSet();
        outAnimator.setDuration(duration);
        inAnimator.playTogether(ObjectAnimator.ofFloat(imageView, View.ALPHA, 1f),
                ObjectAnimator.ofFloat(imageView, View.SCALE_X, 0f, 1f),
                ObjectAnimator.ofFloat(imageView, View.SCALE_Y, 0f, 1f));

        AnimatorSet set = new AnimatorSet();
        set.playSequentially(outAnimator, inAnimator);
        set.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                imageView.setTag(null);
            }
        });
        imageView.setTag(set);
        set.start();
    } else {
        mHandler.post(new Runnable() {
            @Override
            public void run() {
                imageView.setImageResource(imageResId);
            }
        });
    }
}

From source file:com.evilduck.animtest.DraggedPanelLayout.java

public void animatePanel(final boolean opening, float distY, long duration) {
    ObjectAnimator slidingPanelAnimator = ObjectAnimator.ofFloat(slidingPanel, View.TRANSLATION_Y,
            slidingPanel.getTranslationY(), slidingPanel.getTranslationY() + distY);
    ObjectAnimator bottomPanelAnimator = ObjectAnimator.ofFloat(bottomPanel, View.TRANSLATION_Y,
            bottomPanel.getTranslationY(), bottomPanel.getTranslationY() + (float) (distY * parallaxFactor));

    AnimatorSet set = new AnimatorSet();
    set.playTogether(slidingPanelAnimator, bottomPanelAnimator);
    set.setDuration(duration);/*from  w w  w.  j  a v a 2  s.  co  m*/
    set.setInterpolator(sDecelerator);
    set.addListener(new MyAnimListener(opening));
    set.start();
}