Java 类android.view.animation.CycleInterpolator 实例源码

项目:PasscodeView    文件:SquareKey.java   
/**
 * Public constructor.
 *
 * @param pinView {@link PinView}
 * @param digit   title of the key. (-1 for the backspace key)
 * @param bounds  {@link Rect} bound.
 */
private SquareKey(@NonNull PinView pinView,
                  @NonNull String digit,
                  @NonNull Rect bounds,
                  @NonNull SquareKey.Builder builder) {
    super(pinView, digit, bounds, builder);

    mBounds = bounds;
    mBuilder = builder;

    //Error animator
    mErrorAnimator = ValueAnimator.ofInt(0, 10);
    mErrorAnimator.setInterpolator(new CycleInterpolator(2));
    mErrorAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            mBounds.left += (int) animation.getAnimatedValue();
            mBounds.right += (int) animation.getAnimatedValue();
            getPinView().invalidate();
        }
    });
}
项目:PasscodeView    文件:RectKey.java   
/**
 * Public constructor.
 *
 * @param pinView {@link PinView}
 * @param digit   title of the key. (-1 for the backspace key)
 * @param bounds  {@link Rect} bound.
 */
private RectKey(@NonNull PinView pinView,
                @NonNull String digit,
                @NonNull Rect bounds,
                @NonNull RectKey.Builder builder) {
    super(pinView, digit, bounds, builder);

    mBounds = bounds;
    mBuilder = builder;

    //Error animator
    mErrorAnimator = ValueAnimator.ofInt(0, 10);
    mErrorAnimator.setInterpolator(new CycleInterpolator(2));
    mErrorAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            mBounds.left += (int) animation.getAnimatedValue();
            mBounds.right += (int) animation.getAnimatedValue();
            getPinView().invalidate();
        }
    });
}
项目:SegmentedButton    文件:SegmentedButtonGroup.java   
private void initInterpolations() {
    ArrayList<Class> interpolatorList = new ArrayList<Class>() {{
        add(FastOutSlowInInterpolator.class);
        add(BounceInterpolator.class);
        add(LinearInterpolator.class);
        add(DecelerateInterpolator.class);
        add(CycleInterpolator.class);
        add(AnticipateInterpolator.class);
        add(AccelerateDecelerateInterpolator.class);
        add(AccelerateInterpolator.class);
        add(AnticipateOvershootInterpolator.class);
        add(FastOutLinearInInterpolator.class);
        add(LinearOutSlowInInterpolator.class);
        add(OvershootInterpolator.class);
    }};

    try {
        interpolatorSelector = (Interpolator) interpolatorList.get(animateSelector).newInstance();
    } catch (Exception e) {
        e.printStackTrace();
    }
}
项目:AndroidAnimationDemo    文件:FrameFragment.java   
@OnClick(R.id.btn_start)
    public void onAction() {

//        float start = mView.getY();
//        if (start > 680f) {
//            start = 0f;
//            mView.setY(0f);
//        }

//        Keyframe kf0 = Keyframe.ofFloat(0f, 0f);
//        Keyframe kf1 = Keyframe.ofFloat(.5f, 360f);
//        Keyframe kf2 = Keyframe.ofFloat(1f, 0f);
//        PropertyValuesHolder pvh = PropertyValuesHolder.ofKeyframe("X", kf0, kf1, kf2);
//        ObjectAnimator anim = ObjectAnimator.ofPropertyValuesHolder(mView, pvh);
//
//        anim.setDuration(5000);
//        anim.setInterpolator(new AccelerateDecelerateInterpolator());
//        anim.start();

        ObjectAnimator animX = ObjectAnimator.ofFloat(mView, "x", 0, 50f);
        ObjectAnimator animY = ObjectAnimator.ofFloat(mView, "y", 0, 100f);
        AnimatorSet animSetXY = new AnimatorSet();
        animSetXY.playTogether(animX, animY);
        animSetXY.setInterpolator(new CycleInterpolator(0.5f));
        animSetXY.start();
    }
项目:DiaryMemo    文件:Password.java   
private void initAnimation(){
    pushLeftIn = new TranslateAnimation(
            TranslateAnimation.RELATIVE_TO_SELF, 1.0f,   
            TranslateAnimation.RELATIVE_TO_SELF, 0.0f,
            TranslateAnimation.RELATIVE_TO_SELF, 0.0f,
            TranslateAnimation.RELATIVE_TO_SELF, 0.0f);
    pushLeftIn.setDuration(200);
    pushLeftIn.setFillAfter(true);

    pushLeftOut = new TranslateAnimation(
            TranslateAnimation.RELATIVE_TO_SELF, 0.0f,   
            TranslateAnimation.RELATIVE_TO_SELF, -1.0f,
            TranslateAnimation.RELATIVE_TO_SELF, 0.0f,
            TranslateAnimation.RELATIVE_TO_SELF, 0.0f);
    pushLeftOut.setDuration(200);
    pushLeftOut.setFillAfter(true);

    shakeAni = new TranslateAnimation(
            TranslateAnimation.RELATIVE_TO_SELF, 0.0f,   
            TranslateAnimation.RELATIVE_TO_SELF, 0.05f,
            TranslateAnimation.RELATIVE_TO_SELF, 0.0f,
            TranslateAnimation.RELATIVE_TO_SELF, 0.0f);
    shakeAni.setDuration(300);
    shakeAni.setInterpolator(new CycleInterpolator(2.0f));
}
项目:CmoaQuiz    文件:ViewBouncer.java   
@Override
public void run() {

    if (mView != null && mView.getWidth() != 0 && mView.getHeight() != 0) {

        if (bounceViewAnimation != null && !bounceViewAnimation.hasEnded()) {
            return;
        }

        bounceViewAnimation = new ScaleAnimation(1f, mRatio, 1f, mRatio, mView.getWidth() / 2, mView.getHeight() / 2);

        // Define the parameters of the animation
        bounceViewAnimation.setDuration(mTime);
        bounceViewAnimation.setInterpolator(new CycleInterpolator(0.5f));
        mView.setVisibility(View.VISIBLE);
        mView.startAnimation(bounceViewAnimation);
    }

    if (mInfiniteBounce) {
        bounceViewHandler.postDelayed(bounceViewRunnable, 2000);
    }
}
项目:MaterialAppBase    文件:BaseFragmentActivity.java   
/**
    * To shake a view
    * @param view
    */
protected void shakeView(View view){
    float delta = 10.0f;
    CycleInterpolator cycle = new CycleInterpolator(6);
    AnimationSet animSet = new AnimationSet(false);

    Animation anim = new TranslateAnimation(0, delta, 0, 0);
    anim.setDuration(500);
    anim.setInterpolator(cycle);
    animSet.addAnimation(anim);
    view.startAnimation(animSet);

    try{
        Vibrator vibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
        vibrator.vibrate(300);
    }catch(Exception e){}

}
项目:WindowShaker    文件:WindowShaker.java   
public static void shake(View view, Option option) {

        if (option == null) {
            option = getOption(view.getContext());
        }

        TranslateAnimation ta = new TranslateAnimation(-option.mOffsetX,
                option.mOffsetX, -option.mOffsetY, option.mOffsetY);
        ta.setDuration(option.mDuration);
        ta.setInterpolator(new CycleInterpolator(option.mRepeatCount));

        view.startAnimation(ta);

        if (option.mVibrate) {
            Vibrator v = (Vibrator) view.getContext().getSystemService(
                    Context.VIBRATOR_SERVICE);
            v.vibrate(getVibratePattern(option), -1);
        }
    }
项目:CircularProgressDrawable    文件:MainActivity.java   
/**
 * This animation will make a pulse effect to the inner circle
 *
 * @return Animation
 */
private Animator preparePulseAnimation() {
    AnimatorSet animation = new AnimatorSet();

    Animator firstBounce = ObjectAnimator.ofFloat(drawable, CircularProgressDrawable.CIRCLE_SCALE_PROPERTY,
            drawable.getCircleScale(), 0.88f);
    firstBounce.setDuration(300);
    firstBounce.setInterpolator(new CycleInterpolator(1));
    Animator secondBounce = ObjectAnimator.ofFloat(drawable, CircularProgressDrawable.CIRCLE_SCALE_PROPERTY,
            0.75f, 0.83f);
    secondBounce.setDuration(300);
    secondBounce.setInterpolator(new CycleInterpolator(1));
    Animator thirdBounce = ObjectAnimator.ofFloat(drawable, CircularProgressDrawable.CIRCLE_SCALE_PROPERTY,
            0.75f, 0.80f);
    thirdBounce.setDuration(300);
    thirdBounce.setInterpolator(new CycleInterpolator(1));

    animation.playSequentially(firstBounce, secondBounce, thirdBounce);
    return animation;
}
项目:triples    文件:CardDrawable.java   
void setHinted(boolean hinted) {
  if (mHinted != hinted) {
    mHinted = hinted;
    regenerateCachedDrawable();
    if (hinted) {
      // Throb animation
      Animation throbAnimation =
          new ScaleAnimation(1.0f, 1.15f, 1.0f, 1.15f, mBounds.centerX(), mBounds.centerY());
      throbAnimation.setInterpolator(new CycleInterpolator(0.5f));
      throbAnimation.setDuration(HINT_ANIMATION_DURATION_MS);
      throbAnimation.setStartTime(Animation.START_ON_FIRST_FRAME);
      throbAnimation.setAnimationListener(new BaseAnimationListener());
      updateAnimation(throbAnimation);
    }
  }
}
项目:triples    文件:CardDrawable.java   
void onIncorrectTriple() {
  mSelected = false;
  mShakeAnimating = true;
  // Shake animation
  Animation shakeAnimation = new RotateAnimation(0, 5, mBounds.centerX(), mBounds.centerY());
  shakeAnimation.setInterpolator(new CycleInterpolator(4));
  shakeAnimation.setDuration(INCORRECT_ANIMATION_DURATION_MS);
  shakeAnimation.setStartTime(Animation.START_ON_FIRST_FRAME);
  shakeAnimation.setAnimationListener(
      new BaseAnimationListener() {
        @Override
        public void onAnimationEnd(Animation animation) {
          super.onAnimationEnd(animation);
          mShakeAnimating = false;
          regenerateCachedDrawable();
        }
      });
  updateAnimation(shakeAnimation);
}
项目:PaymentKit-Droid    文件:AnimUtils.java   
/**
 * @param shouldResetTextColor if true make sure you end the previous animation before starting this one.
 */
public static ObjectAnimator getShakeAnimation(final TextView textView, final boolean shouldResetTextColor) {
    final int textColor = textView.getCurrentTextColor();
    textView.setTextColor(Color.RED);

    ObjectAnimator shakeAnim = ObjectAnimator.ofFloat(textView, "translationX", -16);
    shakeAnim.setDuration(SHAKE_DURATION);
    shakeAnim.setInterpolator(new CycleInterpolator(2.0f));
    shakeAnim.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator anim) {
            if (shouldResetTextColor) {
                textView.setTextColor(textColor);
            }
        }
    });
    return shakeAnim;
}
项目:GitHub    文件:DialogPopup.java   
@Override
protected Animation initShowAnimation() {
    AnimationSet set=new AnimationSet(false);
    Animation shakeAnima=new RotateAnimation(0,15,Animation.RELATIVE_TO_SELF,0.5f,Animation.RELATIVE_TO_SELF,0.5f);
    shakeAnima.setInterpolator(new CycleInterpolator(5));
    shakeAnima.setDuration(400);
    set.addAnimation(getDefaultAlphaAnimation());
    set.addAnimation(shakeAnima);
    return set;
}
项目:LuaViewPlayground    文件:UDInterpolator.java   
public static Interpolator parse(Integer type, Float cycles) {
        if (type != null) {
            switch (type) {
                case 0:
                    return new AccelerateDecelerateInterpolator();
                case 1:
                    return new AccelerateInterpolator();
                case 2:
                    return new AnticipateInterpolator();
                case 3:
                    return new AnticipateOvershootInterpolator();
                case 4:
                    return new BounceInterpolator();
                case 5:
                    return new CycleInterpolator((cycles != null && cycles > 0) ? cycles : 1f);
                case 6:
                    return new DecelerateInterpolator();
                case 7:
                    return new LinearInterpolator();
                case 8:
                    return new OvershootInterpolator();
                //暂时不支持的
//            case 7: return new FastOutLinearInterplator();
//            case 8: return new FastOutSlowInInterplator();
//            case 10: return new LinearOutSlowInInterplator();
//            case 12: return new PathInterplator();
                default:
                    return new LinearInterpolator();
            }
        } else {
            return new LinearInterpolator();
        }
    }
项目:MultiFuncViewLibrary    文件:MultiFuncEditText.java   
/**
 * 晃动动画
 *
 * @param counts 1秒钟晃动多少下
 * @return
 */
public static Animation shakeAnimation(int counts) {
    Animation translateAnimation = new TranslateAnimation(0, 10, 0, 0);
    translateAnimation.setInterpolator(new CycleInterpolator(counts));
    translateAnimation.setDuration(1000);
    return translateAnimation;
}
项目:UnversityFinance    文件:ClearEditText.java   
/**
 * 晃动动画
 * @param counts 0.5秒钟晃动多少下
 * @return
 */
private Animation shakeAnimation(int counts){
    Animation translateAnimation = new TranslateAnimation(0, 10, 0, 0);
    translateAnimation.setInterpolator(new CycleInterpolator(counts));
    translateAnimation.setDuration(500);
    return translateAnimation;
}
项目:PowerfulEditText    文件:PowerfulEditText.java   
/**
 * 晃动动画
 * @param counts 0.5秒钟晃动多少下
 * @return
 */
private Animation shakeAnimation(int counts){
    Animation translateAnimation = new TranslateAnimation(0, 10, 0, 0);
    translateAnimation.setInterpolator(new CycleInterpolator(counts));
    translateAnimation.setDuration(500);
    return translateAnimation;
}
项目:ShangHanLun    文件:ClearEditText.java   
/**
 * 晃动动画
 *
 * @param counts 1秒钟晃动多少下
 * @return
 */
public static Animation shakeAnimation(int counts) {
    Animation translateAnimation = new TranslateAnimation(0, 10, 0, 0);
    translateAnimation.setInterpolator(new CycleInterpolator(counts));
    translateAnimation.setDuration(1000);
    return translateAnimation;
}
项目:sealtalk-android-master    文件:ClearWriteEditText.java   
/**
 * 晃动动画
 * @param counts 半秒钟晃动多少下
 * @return
 */
public static Animation shakeAnimation(int counts) {
    Animation translateAnimation = new TranslateAnimation(0, 10, 0, 0);
    translateAnimation.setInterpolator(new CycleInterpolator(counts));
    translateAnimation.setDuration(500);
    return translateAnimation;
}
项目:android-project-gallery    文件:ViewAnimCreator.java   
/**
 * 抖动动画
 * 
 * @param count 次数
 * @return
 */
public static Animation shakeAnimation(int count)
{
    Animation translateAnimation = new TranslateAnimation(0, 10, 0, 0);
    translateAnimation.setInterpolator(new CycleInterpolator(count));
    translateAnimation.setDuration(600);

    return translateAnimation;
}
项目:GCSApp    文件:ClearEditText.java   
/**
 * 晃动动画
 *
 * @param counts 1秒钟晃动多少下
 * @return
 */
public static Animation shakeAnimation(int counts) {
    Animation translateAnimation = new TranslateAnimation(0, 10, 0, 0);
    translateAnimation.setInterpolator(new CycleInterpolator(counts));
    translateAnimation.setDuration(1000);
    return translateAnimation;
}
项目:rongyunDemo    文件:ClearWriteEditText.java   
/**
 * 晃动动画
 * @param counts 半秒钟晃动多少下
 * @return
 */
public static Animation shakeAnimation(int counts) {
    Animation translateAnimation = new TranslateAnimation(0, 10, 0, 0);
    translateAnimation.setInterpolator(new CycleInterpolator(counts));
    translateAnimation.setDuration(500);
    return translateAnimation;
}
项目:sctalk    文件:SearchEditText.java   
/**
 * 晃动动画
 * @param counts 1秒钟晃动多少下
 * @return
 */
public static Animation shakeAnimation(int counts){
    Animation translateAnimation = new TranslateAnimation(0, 10, 0, 0);
    translateAnimation.setInterpolator(new CycleInterpolator(counts));
    translateAnimation.setDuration(1000);
    return translateAnimation;
}
项目:CloudPan    文件:ClearEditText.java   
/**
 * �����
 * @param counts 1���ӻζ�������
 * @return
 */
public static Animation shakeAnimation(int counts){
    Animation translateAnimation = new TranslateAnimation(0, 10, 0, 0);
    translateAnimation.setInterpolator(new CycleInterpolator(counts));
    translateAnimation.setDuration(1000);
    return translateAnimation;
}
项目:RongCloudJcenter    文件:ClearWriteEditText.java   
/**
 * 晃动动画
 * @param counts 半秒钟晃动多少下
 * @return
 */
public static Animation shakeAnimation(int counts) {
    Animation translateAnimation = new TranslateAnimation(0, 10, 0, 0);
    translateAnimation.setInterpolator(new CycleInterpolator(counts));
    translateAnimation.setDuration(500);
    return translateAnimation;
}
项目:LittleFreshWeather    文件:SplashActivity.java   
private void startAnimation() {
    ObjectAnimator animator = ObjectAnimator.ofFloat(ivSplashIcon, "translationY", 0, -(ivSplashIcon.getHeight() >> 1));
    animator.setDuration(800);
    animator.setRepeatCount(ObjectAnimator.INFINITE);
    animator.setRepeatMode(ObjectAnimator.RESTART);
    animator.setInterpolator(new CycleInterpolator(0.5f));
    animator.start();
}
项目:Android-Application-ZJB    文件:ClearEditText.java   
/**
 * 晃动动画
 *
 * @param counts 1秒钟晃动多少下
 * @return
 */
public static Animation shakeAnimation(int counts) {
    Animation translateAnimation = new TranslateAnimation(0, 10, 0, 0);
    translateAnimation.setInterpolator(new CycleInterpolator(counts));
    translateAnimation.setDuration(1000);
    return translateAnimation;
}
项目:BasePopup    文件:DialogPopup.java   
@Override
protected Animation initShowAnimation() {
    AnimationSet set=new AnimationSet(false);
    Animation shakeAnima=new RotateAnimation(0,15,Animation.RELATIVE_TO_SELF,0.5f,Animation.RELATIVE_TO_SELF,0.5f);
    shakeAnima.setInterpolator(new CycleInterpolator(5));
    shakeAnima.setDuration(400);
    set.addAnimation(getDefaultAlphaAnimation());
    set.addAnimation(shakeAnima);
    return set;
}
项目:yun2win-sdk-android    文件:ClearEditText.java   
/**
 * 晃动动画
 * @param counts 1秒钟晃动多少下
 * @return
 */
public static Animation shakeAnimation(int counts){
    Animation translateAnimation = new TranslateAnimation(0, 10, 0, 0);
    translateAnimation.setInterpolator(new CycleInterpolator(counts));
    translateAnimation.setDuration(1000);
    return translateAnimation;
}
项目:AndroidAnimationExercise    文件:AlipayFailureView.java   
private void failureAnim() {
    float currentX = this.getTranslationX();
    ObjectAnimator tansXAnim = ObjectAnimator.ofFloat(this, "translationX",currentX+20);
    tansXAnim.setDuration(1000);
    tansXAnim.setInterpolator(new CycleInterpolator(3));
    tansXAnim.start();
}
项目:smile-mvp    文件:ClearEditText.java   
/**
 * 晃动动画
 * @param counts 1秒钟晃动多少下
 * @return
 */
public static Animation shakeAnimation(int counts){
    Animation translateAnimation = new TranslateAnimation(0, 10, 0, 0);
    translateAnimation.setInterpolator(new CycleInterpolator(counts));
    translateAnimation.setDuration(1000);
    return translateAnimation;
}
项目:drawLayout    文件:MainActivity.java   
private void initListener() {
        mDragLayout.setDragStatusListener(new OnDragStatusChangeListener() {

            @Override
            public void onOpen() {
                Utils.showToast(MainActivity.this, "onOpen");
                // 左面板ListView随机设置一个条目
                Random random = new Random();
                Log.i(TAG, "onOpen:=" +mDragLayout.getRange());
                int nextInt = random.nextInt(50);
                mLeftList.smoothScrollToPosition(nextInt);

            }

            @Override
            public void onDraging(float percent) {
                Log.d(TAG, "onDraging: " + percent);// 0 -> 1
                // 更新图标的透明度
                // 1.0 -> 0.0
                ViewHelper.setAlpha(mHeaderImage, 1 - percent);
            }

            @Override
            public void onClose() {
                Utils.showToast(MainActivity.this, "onClose");
                // 让图标晃动
//              mHeaderImage.setTranslationX(translationX)
                ObjectAnimator mAnim = ObjectAnimator.ofFloat(mHeaderImage, "translationX", 15.0f);
                mAnim.setInterpolator(new CycleInterpolator(4));
                mAnim.setDuration(500);
                mAnim.start();
            }
        });
    }
项目:SprintNBA    文件:ShakeHorizontal.java   
@Override
public void setAnimation(View view) {
    ObjectAnimator animator = ObjectAnimator.ofFloat(view, "translationX", -10, 10);
    animator.setInterpolator(new CycleInterpolator(5));
    animatorSet.playTogether(animator);

    /**
     * <pre>
     *  另一种shake实现
     * ObjectAnimator.ofFloat(view, "translationX", 0, 25, -25, 25, -25, 15, -15, 6, -6, 0);
     * </pre>
     */
}
项目:MyHearts    文件:ClearCityEditText.java   
/**
 * 抖动动动画
 * counts 1秒钟晃动多少下
 */
public static Animation shakeAnimation(int counts){
    Animation translateAnimation = new TranslateAnimation(0, 10, 0, 0);
    translateAnimation.setInterpolator(new CycleInterpolator(counts));
    translateAnimation.setDuration(1000);
    return translateAnimation;
}
项目:android-passcodeview    文件:KeyRect.java   
/**
 * Show animation indicated invalid pincode
 */
public void setError() {
  ValueAnimator goLeftAnimator = ValueAnimator.ofInt(0, 5);
  goLeftAnimator.setInterpolator(new CycleInterpolator(2));
  goLeftAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
    @Override public void onAnimationUpdate(ValueAnimator animation) {
      rect.left += (int) animation.getAnimatedValue();
      rect.right += (int) animation.getAnimatedValue();
      view.invalidate();
    }
  });
  goLeftAnimator.start();
}
项目:BaseLibrary    文件:AnimationUtils.java   
/**
 * 左右摇晃
 *
 * @param counts 晃动次数
 * @return
 */
public static Animation shakeAnimation(int counts) {
    Animation translateAnimation = new TranslateAnimation(0, 10, 0, 0);
    translateAnimation.setInterpolator(new CycleInterpolator(counts));
    translateAnimation.setDuration(1000);
    return translateAnimation;
}
项目:TravelAround    文件:ClearCityEditText.java   
/**
 * 抖动动动画
 * counts 1秒钟晃动多少下
 */
public static Animation shakeAnimation(int counts){
    Animation translateAnimation = new TranslateAnimation(0, 10, 0, 0);
    translateAnimation.setInterpolator(new CycleInterpolator(counts));
    translateAnimation.setDuration(1000);
    return translateAnimation;
}
项目:sealtalk-android    文件:ClearWriteEditText.java   
/**
 * 晃动动画
 * @param counts 半秒钟晃动多少下
 * @return
 */
public static Animation shakeAnimation(int counts) {
    Animation translateAnimation = new TranslateAnimation(0, 10, 0, 0);
    translateAnimation.setInterpolator(new CycleInterpolator(counts));
    translateAnimation.setDuration(500);
    return translateAnimation;
}
项目:AndroidAnimationDemo    文件:PathFragment.java   
@OnClick(R.id.btn_start)
public void onAction() {

    float start = mView.getY();
    if (start > 680f) {
        start = 0f;
        mView.setY(0f);
    }
    ObjectAnimator anim = ObjectAnimator.ofFloat(mView, "Y", start, mView.getY() + 180f);
    anim.setDuration(800);
    anim.setInterpolator(new CycleInterpolator(0.5f));
    anim.start();
}
项目:MaterialHome    文件:AnimationUtils.java   
/**
 * 晃动动画
 *
 * @param counts 1秒钟晃动多少下
 * @return
 */
public static Animation shakeAnimation(int counts) {
    Animation translateAnimation = new TranslateAnimation(0, 10, 0, 0);
    translateAnimation.setInterpolator(new CycleInterpolator(counts));
    translateAnimation.setDuration(1000);
    return translateAnimation;
}