@Override
          public void onClick(View v) {
            if (startButton.getVisibility() == View.VISIBLE) {
              startButton.setVisibility(View.INVISIBLE);
            }

            if (upAnimation.isStarted()) {
              upAnimation.cancel();
            }

            if (startPosition == 0) {
              startPosition = bird.getTop();
            }

            isUpAnimationCancelled = false;
            isDownEndByClick = true;
            // bird.layout(bird.getLeft(), 228, bird.getRight(), 228 + bird.getMeasuredHeight());
            bird.layout(
                bird.getLeft(),
                (int) bird.getY(),
                bird.getRight(),
                (int) bird.getY() + bird.getMeasuredHeight());
            bird.setTranslationY(0);
            upAnimation.start();
          }
 public void fade(int durationMs, int delayMs, int alpha) {
   if (mAnimator != null && mAnimator.isStarted()) {
     mAnimator.cancel();
   }
   mAnimator = ObjectAnimator.ofInt(this, "alpha", alpha);
   mAnimator.setInterpolator(new LinearInterpolator());
   mAnimator.setDuration(durationMs);
   mAnimator.setStartDelay(delayMs);
   mAnimationPending = true;
 }
 public void testIsStarted() throws Throwable {
   Object object = mActivity.view.newBall;
   String property = "y";
   float startY = mActivity.mStartY;
   float endY = mActivity.mStartY + mActivity.mDeltaY;
   Interpolator interpolator = new AccelerateInterpolator();
   ObjectAnimator objAnimator = ObjectAnimator.ofFloat(object, property, startY, endY);
   objAnimator.setDuration(mDuration);
   objAnimator.setRepeatCount(ValueAnimator.INFINITE);
   objAnimator.setInterpolator(interpolator);
   objAnimator.setRepeatMode(ValueAnimator.REVERSE);
   startAnimation(objAnimator);
   Thread.sleep(100);
   assertTrue(objAnimator.isStarted());
   Thread.sleep(100);
 }
 @Override
 protected void onResume() {
   // TODO Auto-generated method stub
   super.onResume();
   appState = ((MApplication) getApplicationContext());
   helper = appState.getDBHelper();
   helperFavorite = appState.getDBHelperFavorite();
   fileInfos = appState.getFileInfos();
   music_play_bt.setPressed(play_bt_press);
   music_play_bt.setChecked(play_bt_check);
   setFavoriteDefault(); // 设置是否歌曲收藏状态
   if (anim != null && isPlaying == true) {
     if (!anim.isStarted()) {
       anim.start(); // 开始旋转
     } else {
       anim.resume(); // 继续旋转
     }
   } else {
     anim.pause(); // 停止旋转
   }
 }
 public boolean isAnimationStarted() {
   return mAnimator != null && mAnimator.isStarted();
 }