Android Open Source - android-util Anim Util






From Project

Back to project page android-util.

License

The source code is released under:

Apache License

If you think the Android project android-util listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.ms.square.android.util;
/*ww  w  .  ja  v  a2s  . c  o  m*/
import android.view.MotionEvent;
import android.view.View;
import android.view.animation.ScaleAnimation;

public class AnimUtil {

    public static void setOnTouchScaleAnimation(View targetView, final float scaleX, final float scaleY) {
        targetView.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                final int action = event.getAction();
                switch (action) {
                    case MotionEvent.ACTION_DOWN: {
                        ScaleAnimation anim = new ScaleAnimation(1.0f, scaleX, 1.0f,
                                scaleY, v.getWidth() / 2, v.getHeight() / 2);
                        anim.setDuration(60);
                        anim.setFillEnabled(true);
                        anim.setFillAfter(true);
                        v.startAnimation(anim);
                        break;
                    }
                    case MotionEvent.ACTION_CANCEL:
                    case MotionEvent.ACTION_UP: {
                        ScaleAnimation anim = new ScaleAnimation(scaleX, 1.0f, scaleY,
                                1.0f, v.getWidth() / 2, v.getHeight() / 2);
                        anim.setDuration(100);
                        v.startAnimation(anim);
                        break;
                    }
                }
                return false;
            }
        });
    }
}




Java Source Code List

com.ms.square.android.util.AnimUtil.java
com.ms.square.android.util.AppUtil.java
com.ms.square.android.util.CameraUtil.java
com.ms.square.android.util.FileUtil.java
com.ms.square.android.util.LogUtil.java
com.ms.square.android.util.NetUtil.java
com.ms.square.android.util.StreamUtil.java
com.ms.square.android.util.StringUtil.java
com.ms.square.android.util.ToastMaster.java
com.ms.square.android.util.UIUtil.java