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.geecko.QuickLyric.utils.ScreenSlidePagerAdapter.java

public void exitAction() {
    Animation slideOut = new TranslateAnimation(0f, -2000f, 0f, 0f);
    slideOut.setInterpolator(new AccelerateInterpolator());
    slideOut.setDuration(700);/*from  ww w . j av a  2 s. c o m*/

    slideOut.setAnimationListener(new Animation.AnimationListener() {
        public void onAnimationEnd(Animation animation) {
            ((RelativeLayout) mPager.getParent()).setVisibility(View.GONE);
            ((MainActivity) mActivity).focusOnFragment = true;
            if (((MainActivity) mActivity).mDrawerToggle != null) {
                ((MainActivity) mActivity).getSupportActionBar().setDisplayHomeAsUpEnabled(true);
                ((MainActivity) mActivity).mDrawerToggle.setDrawerIndicatorEnabled(true);
            }
            mActivity.invalidateOptionsMenu();
            SharedPreferences.Editor editor = mActivity.getSharedPreferences("tutorial", Context.MODE_PRIVATE)
                    .edit();
            editor.putBoolean("seen", true);
            editor.apply();
        }

        public void onAnimationRepeat(Animation animation) {
        }

        public void onAnimationStart(Animation animation) {
        }
    });
    ((MainActivity) mActivity).setStatusBarColor(null);
    ((MainActivity) mActivity).setNavBarColor(null);
    ((RelativeLayout) mPager.getParent()).startAnimation(slideOut);
}

From source file:cn.lingox.android.share.view.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  a v a  2s .c  o m*/

                    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.design_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.example.xyzreader.util.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;
                    }//from  www  .j av a  2 s.c  o  m

                    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.design_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.simon.dribbble.widget.navigationbar.behavior.BehaviorScrollZoomFab.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) {
                        BehaviorScrollZoomFab.this.mIsAnimatingOut = true;
                    }//from ww  w.  j  a  va 2  s  .com

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

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

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

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

From source file:cn.lingox.android.share.view.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 w w  .  jav a 2 s  .c  o m*/
        Animation anim = AnimationUtils.loadAnimation(button.getContext(),
                android.support.design.R.anim.design_fab_in);
        anim.setDuration(200L);
        anim.setInterpolator(INTERPOLATOR);
        button.startAnimation(anim);
    }
}

From source file:android.support.design.widget.FloatingActionButtonEclairMr1.java

private Animation setupAnimation(Animation animation) {
    animation.setInterpolator(AnimationUtils.FAST_OUT_SLOW_IN_INTERPOLATOR);
    animation.setDuration(mAnimationDuration);
    return animation;
}

From source file:com.wii.sean.wiimmfiitus.adapters.CustomWiiCyclerViewAdapter.java

private Animation getBlinkAnimation() {
    Animation animation = new AlphaAnimation(1, 0);
    animation.setDuration(500);/*from   w ww  . ja v a2  s.  c  o m*/
    animation.setInterpolator(new LinearInterpolator());
    animation.setRepeatCount(Animation.INFINITE);
    animation.setRepeatMode(Animation.REVERSE);

    return animation;
}

From source file:eu.power_switch.gui.animation.ScrollAwareFABBehavior.java

/**
 * Same animation that FloatingActionButton.Behavior uses to
 * hide the FAB when the AppBarLayout exits
 *
 * @param floatingActionButton FAB//from w  ww . ja v a2  s . c  om
 */
private void animateOut(final FloatingActionButton floatingActionButton) {
    if (SmartphonePreferencesHandler.getUseOptionsMenuInsteadOfFAB()) {
        return;
    }

    if (Build.VERSION.SDK_INT >= 14) {
        ViewCompat.animate(floatingActionButton).scaleX(0.0F).scaleY(0.0F).alpha(0.0F)
                .setInterpolator(INTERPOLATOR).withLayer().setListener(new ViewPropertyAnimatorListener() {
                    public void onAnimationStart(View view) {
                        ScrollAwareFABBehavior.this.mIsAnimatingOut = true;
                    }

                    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(floatingActionButton.getContext(),
                android.R.anim.fade_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;
                floatingActionButton.setVisibility(View.GONE);
            }

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

From source file:eu.power_switch.gui.animation.ScrollAwareFABBehavior.java

/**
 * Same animation that FloatingActionButton.Behavior
 * uses to show the FAB when the AppBarLayout enters
 *
 * @param floatingActionButton FAB/*from   w  w  w  .jav a  2 s  . c  om*/
 */
//
private void animateIn(FloatingActionButton floatingActionButton) {
    if (SmartphonePreferencesHandler.getUseOptionsMenuInsteadOfFAB()) {
        return;
    }
    floatingActionButton.setVisibility(View.VISIBLE);
    if (Build.VERSION.SDK_INT >= 14) {
        ViewCompat.animate(floatingActionButton).scaleX(1.0F).scaleY(1.0F).alpha(1.0F)
                .setInterpolator(INTERPOLATOR).withLayer().setListener(null).start();
    } else {
        Animation anim = AnimationUtils.loadAnimation(floatingActionButton.getContext(),
                android.R.anim.fade_in);
        anim.setDuration(200L);
        anim.setInterpolator(INTERPOLATOR);
        floatingActionButton.startAnimation(anim);
    }
}

From source file:com.calgen.udacity.lego.ui.ArticleDetailFragment.java

private void playAnimation(ImageView photoView) {
    Animation fadeIn = new AlphaAnimation(0, 1);
    fadeIn.setInterpolator(new AccelerateInterpolator());
    fadeIn.setDuration(500);/*from   w w  w.  j a va 2  s  .c o  m*/
    photoView.startAnimation(fadeIn);
    shareFab.setVisibility(View.VISIBLE);
    shareFab.startAnimation(fadeIn);
}