List of usage examples for android.view.animation Animation setInterpolator
public void setInterpolator(Interpolator i)
From source file:com.lcl.designsnackbar.tsnackbar.TSnackbar.java
private void animateViewOut(final int event) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { ViewCompat.animate(mView).translationY(-mView.getHeight()) .setInterpolator(FAST_OUT_SLOW_IN_INTERPOLATOR).setDuration(ANIMATION_DURATION) .setListener(new ViewPropertyAnimatorListenerAdapter() { @Override/*from ww w .j a va2 s. c om*/ public void onAnimationStart(View view) { mView.animateChildrenOut(0, ANIMATION_FADE_DURATION); } @Override public void onAnimationEnd(View view) { onViewHidden(event); } }).start(); } else { Animation anim = AnimationUtils.loadAnimation(mView.getContext(), com.lcl.designsnackbar.R.anim.design_tsnackbar_out); anim.setInterpolator(FAST_OUT_SLOW_IN_INTERPOLATOR); anim.setDuration(ANIMATION_DURATION); anim.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationEnd(Animation animation) { onViewHidden(event); } @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { } }); mView.startAnimation(anim); } }
From source file:com.lcl.designsnackbar.tsnackbar.TSnackbar.java
void animateViewIn() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { ViewCompat.setTranslationY(mView, -mView.getHeight()); ViewCompat.animate(mView).translationY(0f).setInterpolator(FAST_OUT_SLOW_IN_INTERPOLATOR) .setDuration(ANIMATION_DURATION).setListener(new ViewPropertyAnimatorListenerAdapter() { @Override//from w ww. j a v a 2 s .co m public void onAnimationStart(View view) { mView.animateChildrenIn(ANIMATION_DURATION - ANIMATION_FADE_DURATION, ANIMATION_FADE_DURATION); } @Override public void onAnimationEnd(View view) { if (mCallback != null) { mCallback.onShown(TSnackbar.this); } SnackbarManager.getInstance().onShown(mManagerCallback); } }).start(); } else { Animation anim = AnimationUtils.loadAnimation(mView.getContext(), com.lcl.designsnackbar.R.anim.design_tsnackbar_in); anim.setInterpolator(FAST_OUT_SLOW_IN_INTERPOLATOR); anim.setDuration(ANIMATION_DURATION); anim.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationEnd(Animation animation) { if (mCallback != null) { mCallback.onShown(TSnackbar.this); } SnackbarManager.getInstance().onShown(mManagerCallback); } @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { } }); mView.startAnimation(anim); } }
From source file:com.github.topbottomsnackbar.TBSnackbar.java
private void in2(int animId) { Animation anim = AnimationUtils.loadAnimation(mView.getContext(), animId); anim.setInterpolator(FAST_OUT_SLOW_IN_INTERPOLATOR); anim.setDuration(ANIMATION_DURATION); anim.setAnimationListener(new Animation.AnimationListener() { @Override// w ww . j a v a2 s .com public void onAnimationEnd(Animation animation) { onViewShown(); } @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { } }); mView.startAnimation(anim); }
From source file:com.github.topbottomsnackbar.TBSnackbar.java
private void out2(final int event, int animId) { Animation anim = AnimationUtils.loadAnimation(mView.getContext(), animId); anim.setInterpolator(FAST_OUT_SLOW_IN_INTERPOLATOR); anim.setDuration(ANIMATION_DURATION); anim.setAnimationListener(new Animation.AnimationListener() { @Override/*from ww w . j a v a 2s . co m*/ public void onAnimationEnd(Animation animation) { onViewHidden(event); } @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { } }); mView.startAnimation(anim); }
From source file:com.jet.sweettips.snackbar.SweetSnackbar.java
void animateViewIn() { Animation anim = null; if (animateIn != -1) { anim = AnimationUtils.loadAnimation(mView.getContext(), animateIn); } else {/*from www .j a v a 2 s . c om*/ anim = AnimationUtils.loadAnimation(mView.getContext(), R.anim.design_snackbar_in); } anim.setInterpolator(com.jet.sweettips.util.AnimationUtils.FAST_OUT_SLOW_IN_INTERPOLATOR); anim.setDuration(ANIMATION_DURATION); anim.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationEnd(Animation animation) { onViewShown(); } @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { } }); mView.startAnimation(anim); }
From source file:com.jet.sweettips.snackbar.SweetSnackbar.java
private void animateViewOut(final int event) { Animation anim = null; if (animateOut != -1) { anim = AnimationUtils.loadAnimation(mView.getContext(), animateOut); } else {//from w w w.j a va 2 s .c om anim = AnimationUtils.loadAnimation(mView.getContext(), R.anim.design_snackbar_out); } anim.setInterpolator(com.jet.sweettips.util.AnimationUtils.FAST_OUT_SLOW_IN_INTERPOLATOR); anim.setDuration(ANIMATION_DURATION); anim.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationEnd(Animation animation) { onViewHidden(event); } @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { } }); mView.startAnimation(anim); }
From source file:com.jekyll.wu.widget.FreeSnackBar.java
void animateViewIn() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { ViewCompat.setTranslationY(mView, gravity == TOP ? -mView.getHeight() : mView.getHeight()); ViewCompat.animate(mView).translationY(0f).setInterpolator(FAST_OUT_SLOW_IN_INTERPOLATOR) .setDuration(ANIMATION_DURATION).setListener(new ViewPropertyAnimatorListenerAdapter() { @Override// w w w . ja va2s .c om public void onAnimationStart(View view) { mView.animateChildrenIn(ANIMATION_DURATION - ANIMATION_FADE_DURATION, ANIMATION_FADE_DURATION); } @Override public void onAnimationEnd(View view) { onViewShown(); } }).start(); } else { Animation anim = AnimationUtils.loadAnimation(mView.getContext(), gravity == TOP ? R.anim.my_design_snackbar_in : R.anim.my_design_snackbar_bottom_in); anim.setInterpolator(FAST_OUT_SLOW_IN_INTERPOLATOR); anim.setDuration(ANIMATION_DURATION); anim.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationEnd(Animation animation) { onViewShown(); } @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { } }); mView.startAnimation(anim); } }
From source file:com.jekyll.wu.widget.FreeSnackBar.java
private void animateViewOut(final int event) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { ViewCompat.animate(mView).translationY(gravity == TOP ? -mView.getHeight() : mView.getHeight()) .setInterpolator(FAST_OUT_SLOW_IN_INTERPOLATOR).setDuration(ANIMATION_DURATION) .setListener(new ViewPropertyAnimatorListenerAdapter() { @Override//w w w. java 2 s . c o m public void onAnimationStart(View view) { mView.animateChildrenOut(0, ANIMATION_FADE_DURATION); } @Override public void onAnimationEnd(View view) { onViewHidden(event); } }).start(); } else { Animation anim = AnimationUtils.loadAnimation(mView.getContext(), gravity == TOP ? R.anim.my_design_snackbar_out : R.anim.my_design_snackbar_bottom_out); anim.setInterpolator(FAST_OUT_SLOW_IN_INTERPOLATOR); anim.setDuration(ANIMATION_DURATION); anim.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationEnd(Animation animation) { onViewHidden(event); } @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { } }); mView.startAnimation(anim); } }
From source file:com.wanderingcan.floatingactionmenu.FloatingActionMenu.java
/** * Adds the Floating Action Button to the menu. And creates and attaches a LabelView to the Button * if the Style is set./*ww w . jav a 2 s.c o m*/ * @param button The Floating Action Button to be added to the menu */ public void addButton(FloatingActionButton button) { addView(button, mButtonsCount - 1); mButtonsCount++; Animation showAnimation = AnimationUtils.loadAnimation(getContext(), mMenuShowAnimation); if (mMenuHideAnimation == R.anim.fab_in) { showAnimation.setInterpolator(new FastOutSlowInInterpolator()); } Animation hideAnimation = AnimationUtils.loadAnimation(getContext(), mMenuHideAnimation); if (mMenuHideAnimation == R.anim.fab_out) { hideAnimation.setInterpolator(new FastOutSlowInInterpolator()); } button.setShowAnimation(showAnimation, mAnimationDuration); button.setHideAnimation(hideAnimation, mAnimationDuration); if (mLabelsStyle != 0 || mLabelsType != 0) { createLabels(); } }
From source file:com.wanderingcan.floatingactionmenu.FloatingActionMenu.java
/** * Adds the Floating Action Button to the menu. And creates and attaches a LabelView to the Button * if the Style is set./*from w ww . j a va 2s .com*/ * @param button The Floating Action Button to be added to the menu */ public void addButton(FloatingActionButton button, int index) { addView(button, index); mButtonsCount++; Animation showAnimation = AnimationUtils.loadAnimation(getContext(), mMenuShowAnimation); if (mMenuHideAnimation == R.anim.fab_in) { showAnimation.setInterpolator(new FastOutSlowInInterpolator()); } Animation hideAnimation = AnimationUtils.loadAnimation(getContext(), mMenuHideAnimation); if (mMenuHideAnimation == R.anim.fab_out) { hideAnimation.setInterpolator(new FastOutSlowInInterpolator()); } button.setShowAnimation(showAnimation, mAnimationDuration); button.setHideAnimation(hideAnimation, mAnimationDuration); if (mLabelsStyle != 0 || mLabelsType != 0) { createLabels(); } }