List of usage examples for android.view.animation Animation Animation
public Animation()
From source file:Main.java
public static void collapse(final View v, final int beHeight) { Animation a = new Animation() { @Override//from w w w .j a v a 2 s . c om 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:Main.java
public static void collapse(final View v) { final int initialHeight = v.getMeasuredHeight(); Animation a = new Animation() { @Override//w w w .java 2 s .c o m protected void applyTransformation(float interpolatedTime, Transformation t) { if (interpolatedTime == 1) { v.setVisibility(View.GONE); } else { v.getLayoutParams().height = initialHeight - (int) (initialHeight * interpolatedTime); v.requestLayout(); } } @Override public boolean willChangeBounds() { return true; } }; // 1dp/ms a.setDuration((int) (initialHeight / v.getContext().getResources().getDisplayMetrics().density) * 2); v.startAnimation(a); }
From source file:Main.java
public static void collapse(final View v) { final int initialHeight = v.getMeasuredHeight(); Animation a = new Animation() { @Override/* w w w . j av a2s. co m*/ protected void applyTransformation(float interpolatedTime, Transformation t) { if (interpolatedTime == 1) { v.setVisibility(View.GONE); } else { v.getLayoutParams().height = initialHeight - (int) (initialHeight * interpolatedTime); v.requestLayout(); } } @Override public boolean willChangeBounds() { return true; } }; // 1dp/ms a.setDuration((int) (initialHeight / v.getContext().getResources().getDisplayMetrics().density)); v.startAnimation(a); }
From source file:Main.java
public static void animCollapse(final View v) { final int initialHeight = v.getMeasuredHeight(); Animation a = new Animation() { @Override/*from w w w .j a va 2s. c om*/ protected void applyTransformation(float interpolatedTime, Transformation t) { if (interpolatedTime == 1) { v.setVisibility(View.GONE); } else { v.getLayoutParams().height = initialHeight - (int) (initialHeight * interpolatedTime); v.requestLayout(); } } @Override public boolean willChangeBounds() { return true; } }; // 1dp/ms a.setDuration((int) (initialHeight / v.getContext().getResources().getDisplayMetrics().density)); v.startAnimation(a); }
From source file:Main.java
public static void collapse(final View v) { final int initialHeight = v.getMeasuredHeight(); Animation a = new Animation() { @Override// w w w .j a va2 s.c o m protected void applyTransformation(float interpolatedTime, Transformation t) { if (interpolatedTime == 1) { v.setVisibility(View.GONE); } else { v.getLayoutParams().height = initialHeight - (int) (initialHeight * interpolatedTime); v.requestLayout(); } } @Override public boolean willChangeBounds() { return true; } }; a.setDuration(ANIM); v.startAnimation(a); }
From source file:Main.java
public static void collapse(final View v) { final int initialHeight = v.getMeasuredHeight(); Animation a = new Animation() { @Override/* w w w .j a v a 2s .c o m*/ protected void applyTransformation(float interpolatedTime, Transformation t) { if (interpolatedTime == 1) { v.setVisibility(View.GONE); } else { v.getLayoutParams().height = initialHeight - (int) (initialHeight * interpolatedTime); v.requestLayout(); } } @Override public boolean willChangeBounds() { return true; } }; // 1dp/ms a.setDuration(1000); // a.setDuration((int)(initialHeight / v.getContext().getResources().getDisplayMetrics().density)); v.startAnimation(a); }
From source file:Main.java
public static void collapseViews(final View v) { final int initialHeight = v.getMeasuredHeight(); Animation a = new Animation() { @Override/*from w ww .j a va 2s . c o m*/ protected void applyTransformation(float interpolatedTime, Transformation t) { if (interpolatedTime == 1) { v.setVisibility(View.GONE); } else { v.getLayoutParams().height = initialHeight - (int) (initialHeight * interpolatedTime); v.requestLayout(); } } @Override public boolean willChangeBounds() { return true; } }; // 1dp/ms a.setDuration((int) (initialHeight / v.getContext().getResources().getDisplayMetrics().density) * 1); v.startAnimation(a); }
From source file:Main.java
private static Animation collapseAnimation(final View drawer) { final int initialHeight = drawer.getMeasuredHeight(); return new Animation() { @Override/*w w w . j ava 2 s . c o m*/ protected void applyTransformation(float interpolatedTime, Transformation t) { if (interpolatedTime == 1) { drawer.setVisibility(View.GONE); } else { drawer.getLayoutParams().height = initialHeight - (int) (initialHeight * interpolatedTime); drawer.requestLayout(); } } @Override public boolean willChangeBounds() { return true; } }; }
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)//from w w w . j a v a2s . c o m @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 collapse(final View v) { final int initialHeight = v.getMeasuredHeight(); Animation a = new Animation() { @Override//w ww. j av a2s .c o m protected void applyTransformation(float interpolatedTime, Transformation t) { if (interpolatedTime == 1) { v.setVisibility(View.GONE); } else { v.getLayoutParams().height = initialHeight - (int) (initialHeight * interpolatedTime); v.requestLayout(); } } @Override public boolean willChangeBounds() { return true; } }; a.setDuration(300); v.startAnimation(a); }