Example usage for android.view.animation Animation setDuration

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

Introduction

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

Prototype

public void setDuration(long durationMillis) 

Source Link

Document

How long this animation should last.

Usage

From source file:org.namelessrom.devicecontrol.ui.views.AttachFragment.java

@Override
public Animation onCreateAnimation(int transit, boolean enter, int nextAnim) {
    if (MainActivity.sDisableFragmentAnimations) {
        final Animation a = new Animation() {
        };//from w ww  .j  ava  2 s  .  co  m
        a.setDuration(0);
        return a;
    }
    return super.onCreateAnimation(transit, enter, nextAnim);
}

From source file:com.architjn.acjmusicplayer.elements.ScrollAwareFABBehavior.java

private void animateIn(FloatingActionButton button) {
    button.setVisibility(View.VISIBLE);
    Animation anim = AnimationUtils.loadAnimation(button.getContext(), R.anim.abc_slide_in_bottom);
    anim.setDuration(600L);
    anim.setInterpolator(INTERPOLATOR);/* w  ww.  j  ava 2  s.c  o m*/
    button.startAnimation(anim);
}

From source file:at.wada811.imageslider.ImageSliderFragment.java

public void setDuration(int duration) {
    Animation inAnimation = mImageSwitcher.getInAnimation();
    inAnimation.setDuration(duration);
    Animation outAnimation = mImageSwitcher.getOutAnimation();
    outAnimation.setDuration(duration);/*w w  w  .j  ava2s . c o m*/
    setInOutAnimation(inAnimation, outAnimation);
}

From source file:net.soulwolf.widget.parallaxrefresh.BaseParallaxHolder.java

@Override
public void onRollback() {
    if (ViewCompat.getTranslationY(mContentView) > 0) {
        Animation animation = ObjectAnimator.ofTranslationY(mContentView, 0);
        animation.setDuration(ROLLBACK_DURATION);
        animation.setInterpolator(ROLLBACK_INTERPOLATOR);
        animation.start();/*  w  w  w  .ja v  a 2s  .  c  o m*/
    }
}

From source file:br.com.devfestsul.planetas.utils.ScrollAwareFABBehavior.java

private void animateIn(FloatingActionButton button) {
    button.setVisibility(View.VISIBLE);
    if (Build.VERSION.SDK_INT >= 14) {
        ViewCompat.animate(button).scaleX(1.0F).scaleY(1.0F).alpha(1.0F).setInterpolator(INTERPOLATOR)
                .withLayer().setListener(null).start();
    } else {/*from w w  w.ja va 2 s .com*/
        Animation anim = AnimationUtils.loadAnimation(button.getContext(), R.anim.fab_in);
        anim.setDuration(200L);
        anim.setInterpolator(INTERPOLATOR);
        button.startAnimation(anim);
    }
}

From source file:com.webianks.library.ShowHideAnimation.java

public void animateOut(final RelativeLayout view) {
    Animation anim = AnimationUtils.loadAnimation(view.getContext(), R.anim.pop_out);
    anim.setInterpolator(INTERPOLATOR_OUT);
    anim.setDuration(250L);
    anim.setAnimationListener(new Animation.AnimationListener() {
        public void onAnimationStart(Animation animation) {
            //ScrollAwareFABBehavior.this.mIsAnimatingOut = true;
        }/*from   w  w  w . j a v a2s  .  c  o m*/

        public void onAnimationEnd(Animation animation) {
            //ScrollAwareFABBehavior.this.mIsAnimatingOut = false;
            view.setVisibility(View.GONE);
        }

        @Override
        public void onAnimationRepeat(final Animation animation) {
        }
    });
    view.startAnimation(anim);

}

From source file:com.develop.autorus.MainActivity.java

public static void expand(final View v) {
    v.measure(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
    final int targetHeight = v.getMeasuredHeight();

    // Older versions of android (pre API 21) cancel animations for views with a height of 0.
    v.getLayoutParams().height = 1;//from   w  w w . j ava 2s .c  om
    v.setVisibility(View.VISIBLE);
    Animation a = new Animation() {
        @Override
        protected void applyTransformation(float interpolatedTime, Transformation t) {
            v.getLayoutParams().height = interpolatedTime == 1 ? LinearLayout.LayoutParams.WRAP_CONTENT
                    : (int) (targetHeight * interpolatedTime);
            v.requestLayout();
        }

        @Override
        public boolean willChangeBounds() {
            return true;
        }
    };

    // 1dp/ms
    a.setDuration((int) (targetHeight / v.getContext().getResources().getDisplayMetrics().density));
    v.startAnimation(a);
}

From source file:com.gubo.vosh.ScrollAwareFABBehavior.java

private void animateIn(FloatingActionButton button) {
    button.setVisibility(View.VISIBLE);
    if (Build.VERSION.SDK_INT >= 14) {
        ViewCompat.animate(button).scaleX(1.0F).scaleY(1.0F).alpha(1.0F).setInterpolator(INTERPOLATOR)
                .withLayer().setListener(null).start();
    } else {//  w  ww .ja  v a 2s .c  o  m
        Animation anim = AnimationUtils.loadAnimation(button.getContext(), android.R.anim.fade_in);
        anim.setDuration(200L);
        anim.setInterpolator(INTERPOLATOR);
        button.startAnimation(anim);
    }
}

From source file:com.lamcreations.scaffold.common.views.behaviors.FabBehavior.java

private void animateIn(FloatingActionButton button) {
    button.setVisibility(View.VISIBLE);
    if (Build.VERSION.SDK_INT >= 14) {
        ViewCompat.animate(button).scaleX(1.0F).scaleY(1.0F).alpha(1.0F).setInterpolator(INTERPOLATOR)
                .withLayer().setListener(null).start();
    } else {//from  www .  j a va 2  s.  c o  m
        Animation anim = AnimationUtils.loadAnimation(button.getContext(), R.anim.scaffold_fab_in);
        anim.setDuration(200L);
        anim.setInterpolator(INTERPOLATOR);
        button.startAnimation(anim);
    }
}

From source file:com.fangzp.daily.widget.ScrollAwareFABBehavior.java

private void animateIn(FloatingActionButton button) {
    button.setVisibility(View.VISIBLE);
    if (Build.VERSION.SDK_INT >= 14) {
        ViewCompat.animate(button).scaleX(1.0F).scaleY(1.0F).alpha(1.0F).setInterpolator(INTERPOLATOR)
                .withLayer().setListener(null).start();
    } else {//from   www. j a v a  2 s.  c  o m
        Animation anim = AnimationUtils.loadAnimation(button.getContext(), R.anim.design_fab_in);
        anim.setDuration(200L);
        anim.setInterpolator(INTERPOLATOR);
        button.startAnimation(anim);
    }
}