List of usage examples for android.view.animation Animation setDuration
public void setDuration(long durationMillis)
From source file:org.smssecure.smssecure.util.ViewUtil.java
private static Animation getAlphaAnimation(float from, float to, int duration) { final Animation anim = new AlphaAnimation(from, to); anim.setInterpolator(new FastOutSlowInInterpolator()); anim.setDuration(duration); return anim;//from ww w. j ava2s . c o m }
From source file:com.bluros.music.utils.FabAnimationUtils.java
public static void scaleOut(final View fab, long duration, final ScaleCallback callback) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { ViewCompat.animate(fab).scaleX(0.0F).scaleY(0.0F).alpha(0.0F) .setInterpolator(FAST_OUT_SLOW_IN_INTERPOLATOR).setDuration(duration).withLayer() .setListener(new ViewPropertyAnimatorListener() { public void onAnimationStart(View view) { if (callback != null) callback.onAnimationStart(); }//from w w w. j a v a2 s .c o m public void onAnimationCancel(View view) { } public void onAnimationEnd(View view) { view.setVisibility(View.INVISIBLE); if (callback != null) callback.onAnimationEnd(); } }).start(); } else { Animation anim = AnimationUtils.loadAnimation(fab.getContext(), R.anim.design_fab_out); anim.setInterpolator(FAST_OUT_SLOW_IN_INTERPOLATOR); anim.setDuration(duration); anim.setAnimationListener(new Animation.AnimationListener() { public void onAnimationStart(Animation animation) { if (callback != null) callback.onAnimationStart(); } public void onAnimationEnd(Animation animation) { fab.setVisibility(View.INVISIBLE); if (callback != null) callback.onAnimationEnd(); } @Override public void onAnimationRepeat(Animation animation) { // } }); fab.startAnimation(anim); } }
From source file:Main.java
public static void show(final View view) { if (Build.VERSION.SDK_INT >= 11) { final Animation animation = new Animation() { @TargetApi(11)//w w w . j a v a 2s . c om @Override protected void applyTransformation(final float interpolatedTime, final Transformation t) { view.setAlpha(interpolatedTime); } }; animation.setDuration(ANIMATION_DURATION); // return animation; view.startAnimation(animation); } else { view.setVisibility(View.VISIBLE); } }
From source file:Main.java
public static void hide(final View view, final boolean makeInvisible) { if (Build.VERSION.SDK_INT >= 11) { final Animation animation = new Animation() { @TargetApi(11)/* ww w . jav a 2 s. c o m*/ @Override protected void applyTransformation(final float interpolatedTime, final Transformation t) { view.setAlpha(1.f - interpolatedTime); } }; animation.setDuration(ANIMATION_DURATION); // return animation; view.startAnimation(animation); } else { view.setVisibility(View.INVISIBLE); } }
From source file:Main.java
public static void collapse(final View v, final int beHeight) { Animation a = new Animation() { @Override/* w w w . java2 s.com*/ protected void applyTransformation(float interpolatedTime, Transformation t) { v.getLayoutParams().height = beHeight; v.requestLayout(); } @Override public boolean willChangeBounds() { return true; } }; // 1dp/ms a.setDuration(500); v.startAnimation(a); }
From source file:com.capricorn.ArcMenu.java
private static Animation createHintSwitchAnimation(final boolean expanded) { Animation animation = new RotateAnimation(expanded ? 45 : 0, expanded ? 0 : 45, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); animation.setStartOffset(0);//from w w w .ja v a 2s .co m animation.setDuration(100); animation.setInterpolator(new DecelerateInterpolator()); animation.setFillAfter(true); return animation; }
From source file:com.capricorn.ArcMenu.java
private static Animation createQuickHintSwitchAnimation(final boolean expanded) { Animation animation = new RotateAnimation(expanded ? 45 : 0, expanded ? 0 : 45, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); animation.setStartOffset(0);//from www.j av a 2 s .c o m animation.setDuration(10); animation.setInterpolator(new DecelerateInterpolator()); animation.setFillAfter(true); return animation; }
From source file:Main.java
public static void expand(final View v, int beHeight) { v.measure(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); v.getLayoutParams().height = 0;// www . j a va 2s. c o m v.setVisibility(View.VISIBLE); Animation a = new Animation() { @Override protected void applyTransformation(float interpolatedTime, Transformation t) { v.getLayoutParams().height = 350; v.requestLayout(); } @Override public boolean willChangeBounds() { return true; } }; // 1dp/ms a.setDuration(500); v.startAnimation(a); }
From source file:com.enadein.carlogbook.db.CommonUtils.java
public static void runAnimation(int mlastPos, int pos, View view, float size) { if (UnitFacade.ANIM_LIST_ON) { float initialTranslation = (mlastPos <= pos) ? size : -size; Animation animationY = new TranslateAnimation(0, 0, initialTranslation, 0); animationY.setDuration(400); view.startAnimation(animationY); animationY = null;//w w w. ja v a 2 s .c om } }
From source file:Main.java
public static void collapse(final View v, final int initialHeight, final int targetHeight, int duration, Animation.AnimationListener listener) { final int diffHeight = initialHeight - targetHeight; Animation a = new Animation() { @Override//from w w w .ja v a 2 s . co m protected void applyTransformation(float interpolatedTime, Transformation t) { v.getLayoutParams().height = initialHeight - (int) (diffHeight * interpolatedTime); v.requestLayout(); } @Override public boolean willChangeBounds() { return true; } }; a.setDuration(duration); a.setInterpolator(new DecelerateInterpolator(2)); if (listener != null) { a.setAnimationListener(listener); } v.startAnimation(a); }