Back to project page DragHelperView.
The source code is released under:
Apache License
If you think the Android project DragHelperView listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package so.library.draghelper.helper.animation; /*from www. ja va2 s .c o m*/ import android.view.View; import android.view.animation.Animation; import android.view.animation.Transformation; /** * Created by risedrag on 15. 1. 16.. */ public class HeaderViewMinimizeAnimation extends Animation { final int startWidth; final int targetWidth; final float targetTranslationX; final float targetTranslationY; View view; public HeaderViewMinimizeAnimation(View view, int targetWidth, float targetTranslationX, float targetTranslationY) { this.view = view; this.targetWidth = targetWidth; this.targetTranslationX = targetTranslationX; this.targetTranslationY = targetTranslationY; startWidth = view.getWidth(); } @Override protected void applyTransformation(float interpolatedTime, Transformation t) { int newWidth = (int) (startWidth + (targetWidth - startWidth) * interpolatedTime); view.setTranslationX(targetTranslationX * interpolatedTime); view.setTranslationY(targetTranslationY * interpolatedTime); view.getLayoutParams().width = newWidth; view.requestLayout(); } @Override public void initialize(int width, int height, int parentWidth, int parentHeight) { super.initialize(width, height, parentWidth, parentHeight); } @Override public boolean willChangeBounds() { return true; } }