Example usage for android.view.animation Animation setInterpolator

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

Introduction

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

Prototype

public void setInterpolator(Interpolator i) 

Source Link

Document

Sets the acceleration curve for this animation.

Usage

From source file:com.megaphone.skoozi.FloatingActionButtonScrollMorphBehavior.java

private void animateOut(final FloatingActionButton button) {
    if (Build.VERSION.SDK_INT >= 14) {
        ViewCompat.animate(button).scaleX(0.0F).scaleY(0.0F).alpha(0.0F).setInterpolator(INTERPOLATOR)
                .withLayer().setListener(new ViewPropertyAnimatorListener() {
                    public void onAnimationStart(View view) {
                        FloatingActionButtonScrollMorphBehavior.this.mIsAnimatingOut = true;
                    }/*from  ww w  .  j a  v a  2s . c  om*/

                    public void onAnimationCancel(View view) {
                        FloatingActionButtonScrollMorphBehavior.this.mIsAnimatingOut = false;
                    }

                    public void onAnimationEnd(View view) {
                        FloatingActionButtonScrollMorphBehavior.this.mIsAnimatingOut = false;
                        view.setVisibility(View.GONE);
                    }
                }).start();
    } else {
        Animation anim = AnimationUtils.loadAnimation(button.getContext(), R.anim.fab_out);
        anim.setInterpolator(INTERPOLATOR);
        anim.setDuration(200L);
        anim.setAnimationListener(new Animation.AnimationListener() {
            public void onAnimationStart(Animation animation) {
                FloatingActionButtonScrollMorphBehavior.this.mIsAnimatingOut = true;
            }

            public void onAnimationEnd(Animation animation) {
                FloatingActionButtonScrollMorphBehavior.this.mIsAnimatingOut = false;
                button.setVisibility(View.GONE);
            }

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

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();//from w w  w  . j  a  v  a 2 s.  c o  m
    }
}

From source file:com.evandroid.musica.utils.RefreshButtonBehavior.java

public void animateOut(final FloatingActionButton button) {
    int translationY = button.getHeight()
            + ((CoordinatorLayout.LayoutParams) button.getLayoutParams()).bottomMargin;
    if (Build.VERSION.SDK_INT >= 14) {
        ViewCompat.animate(button).translationY(translationY).setInterpolator(INTERPOLATOR).withLayer()
                .setListener(new ViewPropertyAnimatorListener() {
                    public void onAnimationStart(View view) {
                        RefreshButtonBehavior.this.mIsAnimatingOut = true;
                    }/*from   www .j a  v a  2  s  .  co m*/

                    public void onAnimationCancel(View view) {
                        RefreshButtonBehavior.this.mIsAnimatingOut = false;
                    }

                    public void onAnimationEnd(View view) {
                        RefreshButtonBehavior.this.mIsAnimatingOut = false;
                        view.setVisibility(View.GONE);
                        visible = false;
                    }
                }).start();
    } else {
        Animation anim = AnimationUtils.loadAnimation(button.getContext(), R.anim.refresh_out);
        anim.setInterpolator(INTERPOLATOR);
        anim.setDuration(200L);
        anim.setAnimationListener(new Animation.AnimationListener() {
            public void onAnimationStart(Animation animation) {
                RefreshButtonBehavior.this.mIsAnimatingOut = true;
            }

            public void onAnimationEnd(Animation animation) {
                RefreshButtonBehavior.this.mIsAnimatingOut = false;
                button.setVisibility(View.GONE);
                visible = false;
            }

            @Override
            public void onAnimationRepeat(final Animation animation) {
            }
        });
        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  ww  w  .j a v  a 2  s  .com*/
        Animation anim = AnimationUtils.loadAnimation(button.getContext(), R.anim.design_fab_in);
        anim.setDuration(200L);
        anim.setInterpolator(INTERPOLATOR);
        button.startAnimation(anim);
    }
}

From source file:com.ua.max.oliynick.flicker.widgets.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  ww  .ja v a2s. c om
        Animation anim = AnimationUtils.loadAnimation(button.getContext(), R.anim.fab_appear);
        anim.setDuration(200L);
        anim.setInterpolator(INTERPOLATOR);
        button.startAnimation(anim);
    }
}

From source file:it.bellotti.android.materialdesignsample.ui.widget.ScrollAwareFABBehavior.java

private void animateFabIn(final 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. c  o  m*/
        Animation anim = new ScaleAnimation(0.0F, 0.0F, 1.0F, 1.0F);
        anim.setDuration(200L);
        anim.setInterpolator(INTERPOLATOR);
        anim.setAnimationListener(new Animation.AnimationListener() {
            @Override
            public void onAnimationStart(Animation animation) {
                ScrollAwareFABBehavior.this.mIsAnimatingOut = true;
            }

            @Override
            public void onAnimationEnd(Animation animation) {
                ScrollAwareFABBehavior.this.mIsAnimatingOut = false;
                button.setVisibility(View.VISIBLE);
            }

            @Override
            public void onAnimationRepeat(Animation animation) {

            }
        });
        button.startAnimation(anim);
    }
}

From source file:com.evandroid.musica.utils.RefreshButtonBehavior.java

public void animateIn(FloatingActionButton button) {
    if (!button.isEnabled())
        return;/*ww  w.  j  a v a  2 s . c  om*/
    button.setVisibility(View.VISIBLE);
    visible = true;
    if (Build.VERSION.SDK_INT >= 14) {
        ViewCompat.animate(button).translationY(0).setInterpolator(INTERPOLATOR).withLayer().setListener(null)
                .start();
    } else {
        Animation anim = AnimationUtils.loadAnimation(button.getContext(), R.anim.refresh_in);
        anim.setDuration(200L);
        anim.setInterpolator(INTERPOLATOR);
        button.startAnimation(anim);
    }
}

From source file:com.github.kaninohon.poi.ui.widget.ScrollAwareFABBehavior.java

private void animateOut(final FloatingActionButton button) {
    if (Build.VERSION.SDK_INT >= 14) {
        ViewCompat.animate(button).scaleX(0.0F).scaleY(0.0F).alpha(0.0F).setInterpolator(INTERPOLATOR)
                .withLayer().setListener(new ViewPropertyAnimatorListener() {
                    public void onAnimationStart(View view) {
                        ScrollAwareFABBehavior.this.mIsAnimatingOut = true;
                    }// ww  w .j ava  2s.c om

                    public void onAnimationCancel(View view) {
                        ScrollAwareFABBehavior.this.mIsAnimatingOut = false;
                    }

                    public void onAnimationEnd(View view) {
                        ScrollAwareFABBehavior.this.mIsAnimatingOut = false;
                        view.setVisibility(View.GONE);
                    }
                }).start();
    } else {
        Animation anim = AnimationUtils.loadAnimation(button.getContext(),
                android.support.design.R.anim.fab_out);
        anim.setInterpolator(INTERPOLATOR);
        anim.setDuration(200L);
        anim.setAnimationListener(new Animation.AnimationListener() {
            public void onAnimationStart(Animation animation) {
                ScrollAwareFABBehavior.this.mIsAnimatingOut = true;
            }

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

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

From source file:com.github.kaninohon.poi.ui.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 {//  w ww.  j  a  v a2 s  .c o m
        Animation anim = AnimationUtils.loadAnimation(button.getContext(),
                android.support.design.R.anim.fab_in);
        anim.setDuration(200L);
        anim.setInterpolator(INTERPOLATOR);
        button.startAnimation(anim);
    }
}

From source file:com.orangemoo.com.beta.widget.ScrollFABBehavior.java

private void animateOut(final FloatingActionButton button) {
    if (Build.VERSION.SDK_INT >= 14) {
        ViewCompat.animate(button).scaleX(0.0F).scaleY(0.0F).alpha(0.0F).setInterpolator(INTERPOLATOR)
                .withLayer().setListener(new ViewPropertyAnimatorListener() {
                    public void onAnimationStart(View view) {
                        ScrollFABBehavior.this.mIsAnimatingOut = true;
                    }//from  ww  w.  ja v  a2 s  .  c  om

                    public void onAnimationCancel(View view) {
                        ScrollFABBehavior.this.mIsAnimatingOut = false;
                    }

                    public void onAnimationEnd(View view) {
                        ScrollFABBehavior.this.mIsAnimatingOut = false;
                        view.setVisibility(View.GONE);
                    }
                }).setDuration(Utils.SWIPE_BEHAVIOR_ANIMATION_TIME).start();
    } else {
        Animation anim = AnimationUtils.loadAnimation(button.getContext(),
                android.support.design.R.anim.abc_fade_out);
        anim.setInterpolator(INTERPOLATOR);
        anim.setDuration(Utils.SWIPE_BEHAVIOR_ANIMATION_TIME);
        anim.setAnimationListener(new Animation.AnimationListener() {
            public void onAnimationStart(Animation animation) {
                ScrollFABBehavior.this.mIsAnimatingOut = true;
            }

            public void onAnimationEnd(Animation animation) {
                ScrollFABBehavior.this.mIsAnimatingOut = false;
                button.setVisibility(View.GONE);
            }

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