private ObjectAnimator createAnimation(View view, AnimationParams params) {
   ObjectAnimator animator = null;
   if (params.attr != null) {
     if (params.paramsFloat != null) {
       animator = ObjectAnimator.ofFloat(view, params.attr, params.paramsFloat);
     } else if (params.paramsInt != null) {
       animator = ObjectAnimator.ofInt(view, params.attr, params.paramsInt);
     }
   } else {
     if (params.paramsFloat != null && params.propertyFloat != null) {
       animator = ObjectAnimator.ofFloat(view, params.propertyFloat, params.paramsFloat);
     } else if (params.paramsInt != null && params.propertyInt != null) {
       animator = ObjectAnimator.ofInt(view, params.propertyInt, params.paramsInt);
     }
   }
   if (animator == null) {
     throw new RuntimeException("Can't support this animation params");
   }
   if (params.evaluator != null) {
     animator.setEvaluator(params.evaluator);
   }
   if (params.interpolator != null) {
     animator.setInterpolator(params.interpolator);
   }
   return animator;
 }
예제 #2
0
  @TargetApi(Build.VERSION_CODES.HONEYCOMB)
  @SuppressLint("NewApi")
  private void init() {
    mXAnimator = ObjectAnimator.ofFloat(this, "x", 0);
    mYAnimator = ObjectAnimator.ofFloat(this, "y", 0);
    mWAnimator = ObjectAnimator.ofInt(this, "wid", 0);
    mHAnimator = ObjectAnimator.ofInt(this, "hei", 0);
    mAnimatorSet = new AnimatorSet();
    mAnimatorSet.setDuration(AnimationDuration);
    mAnimatorSet.playTogether(mWAnimator, mHAnimator, mXAnimator, mYAnimator);
    mAnimatorSet.addListener(
        new AnimatorListener() {

          @Override
          public void onAnimationStart(Animator animation) {}

          @Override
          public void onAnimationRepeat(Animator animation) {}

          @Override
          public void onAnimationEnd(Animator animation) {
            if (getVisibility() != View.VISIBLE) {
              setVisibility(View.VISIBLE);
            }
          }

          @Override
          public void onAnimationCancel(Animator animation) {}
        });
  }
예제 #3
0
 private void animateArrow(boolean shouldRotateUp) {
   int start = shouldRotateUp ? 0 : MAX_LEVEL;
   int end = shouldRotateUp ? MAX_LEVEL : 0;
   ObjectAnimator animator = ObjectAnimator.ofInt(drawable, "level", start, end);
   animator.setInterpolator(new LinearOutSlowInInterpolator());
   animator.start();
 }
  /** Animation for the textview if the action bar is visible. */
  public void startShowAnimation() {
    if (mCurrentAnimation != null) mCurrentAnimation.cancel();

    mCurrentAnimation =
        ObjectAnimator.ofInt(
                mActionBarDelegate,
                TOP_MARGIN_ANIM_PROPERTY,
                (int) (Math.max(0, queryCurrentActionBarHeight() - mTabStripHeight)))
            .setDuration(SLIDE_DURATION_MS);

    mCurrentAnimation.addListener(
        new AnimatorListenerAdapter() {
          @Override
          public void onAnimationEnd(Animator animation) {
            mCurrentAnimation = null;
          }
        });

    mCurrentAnimation.addUpdateListener(
        new ValueAnimator.AnimatorUpdateListener() {
          @Override
          public void onAnimationUpdate(ValueAnimator animation) {
            ActionBar actionBar = mActionBarDelegate.getSupportActionBar();
            if (actionBar != null) {
              animation.setIntValues(
                  (int) (Math.max(0, queryCurrentActionBarHeight() - mTabStripHeight)));
            }
          }
        });

    mActionBarDelegate.setActionBarBackgroundVisibility(true);
    mCurrentAnimation.start();
    mShowingActionMode = true;
  }
  @Override
  public void setWeekParams(HashMap<String, Integer> params, String tz) {
    super.setWeekParams(params, tz);

    if (params.containsKey(VIEW_PARAMS_ORIENTATION)) {
      mOrientation = params.get(VIEW_PARAMS_ORIENTATION);
    }

    updateToday(tz);
    mNumCells = mNumDays + 1;

    if (params.containsKey(VIEW_PARAMS_ANIMATE_TODAY) && mHasToday) {
      synchronized (mAnimatorListener) {
        if (mTodayAnimator != null) {
          mTodayAnimator.removeAllListeners();
          mTodayAnimator.cancel();
        }
        mTodayAnimator =
            ObjectAnimator.ofInt(this, "animateTodayAlpha", Math.max(mAnimateTodayAlpha, 80), 255);
        mTodayAnimator.setDuration(150);
        mAnimatorListener.setAnimator(mTodayAnimator);
        mAnimatorListener.setFadingIn(true);
        mTodayAnimator.addListener(mAnimatorListener);
        mAnimateToday = true;
        mTodayAnimator.start();
      }
    }
  }
예제 #6
0
  // Define Animations
  public void initializeAnimatorSets() {
    rotate = new AnimatorSet();
    unrotate = new AnimatorSet();
    Animator[] rotationAnimations = new Animator[getChildCount() * 2];

    // set rotate
    float spaceForEach =
        (float) (Math.cos((double) MapView.rotationAngle) * MapView.rotationYScale * getHeight());
    for (int i = 0; i < getChildCount(); i++) {
      ((MapView) getChildAt(i)).initPivots();
      rotationAnimations[2 * i] =
          new ObjectAnimator()
              .ofFloat(
                  getChildAt(getChildCount() - i - 1),
                  "translationY",
                  (float)
                      ((i - activeLayer) * spaceForEach
                          - (getHeight() - spaceForEach)
                              / 2)); // the "getChildCount() - i - 1" bit reverses the ordering of
                                     // the layers. Good candidate for refactoring
      rotationAnimations[2 * i + 1] = ((MapView) getChildAt(getChildCount() - i - 1)).rotate;
    }
    for (int i = 0; i < rotationAnimations.length - 1; i++) {
      rotate.play(rotationAnimations[i]).with(rotationAnimations[i + 1]);
    }

    // set unrotate
    unrotate.play(ObjectAnimator.ofInt(this, "scrollY", 0));
  }
 @Override
 public void onAnimationEnd(Animator animation) {
   synchronized (this) {
     if (mAnimator != animation) {
       animation.removeAllListeners();
       animation.cancel();
       return;
     }
     if (mFadingIn) {
       if (mTodayAnimator != null) {
         mTodayAnimator.removeAllListeners();
         mTodayAnimator.cancel();
       }
       mTodayAnimator =
           ObjectAnimator.ofInt(MonthWeekEventsView.this, "animateTodayAlpha", 255, 0);
       mAnimator = mTodayAnimator;
       mFadingIn = false;
       mTodayAnimator.addListener(this);
       mTodayAnimator.setDuration(600);
       mTodayAnimator.start();
     } else {
       mAnimateToday = false;
       mAnimateTodayAlpha = 0;
       mAnimator.removeAllListeners();
       mAnimator = null;
       mTodayAnimator = null;
       invalidate();
     }
   }
 }
예제 #8
0
 private void createAnimation(int... colors) {
   if (colorAnim == null) {
     colorAnim = ObjectAnimator.ofInt(this, "backgroundColor", colors);
     colorAnim.setEvaluator(new ArgbEvaluator());
     colorAnim.setDuration(DURATION);
     colorAnim.addUpdateListener(this);
   }
 }
 /** 主要用于释放手指后的回弹效果 */
 private void reset() {
   if (oa != null && oa.isRunning()) {
     return;
   }
   oa = ObjectAnimator.ofInt(this, "t", (int) -distance / 4, 0);
   oa.setDuration(150);
   oa.start();
 }
예제 #10
0
  public void selectOffButton(Button button) {
    TransitionDrawable drawable = (TransitionDrawable) button.getBackground();
    drawable.reverseTransition(100);

    ObjectAnimator colorAnim = ObjectAnimator.ofInt(button, "textColor", Color.BLACK, Color.WHITE);
    colorAnim.setDuration(100);
    colorAnim.setEvaluator(new ArgbEvaluator());
    colorAnim.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;
 }
예제 #12
0
  /**
   * 根据当前scrollX的位置判断是展开还是折叠
   *
   * @param velocityX 如果不等于0那么这是一次fling事件,否则是一次ACTION_UP或者ACTION_CANCEL
   */
  private boolean smoothHorizontalExpandOrCollapse(float velocityX) {

    int scrollX = mTargetView.getScrollX();
    int scrollRange = getHorizontalRange();

    if (mExpandAndCollapseAnim != null) return false;

    int to = 0;
    int duration = DEFAULT_DURATION;

    if (velocityX == 0) {
      // 如果已经展一半,平滑展开
      if (scrollX > scrollRange / 2) {
        to = scrollRange;
      }
    } else {

      if (velocityX > 0) to = 0;
      else to = scrollRange;

      duration = (int) ((1.f - Math.abs(velocityX) / mMaxVelocity) * DEFAULT_DURATION);
    }

    if (to == scrollX) return false;

    mExpandAndCollapseAnim = ObjectAnimator.ofInt(mTargetView, "scrollX", to);
    mExpandAndCollapseAnim.setDuration(duration);
    mExpandAndCollapseAnim.addListener(
        new Animator.AnimatorListener() {
          @Override
          public void onAnimationStart(Animator animation) {}

          @Override
          public void onAnimationEnd(Animator animation) {
            mExpandAndCollapseAnim = null;
            if (isCollapsed()) mTargetView = null;

            Log.d(TAG, "onAnimationEnd");
          }

          @Override
          public void onAnimationCancel(Animator animation) {
            // onAnimationEnd(animation);
            mExpandAndCollapseAnim = null;

            Log.d(TAG, "onAnimationCancel");
          }

          @Override
          public void onAnimationRepeat(Animator animation) {}
        });
    mExpandAndCollapseAnim.start();

    return true;
  }
    public MyAnimationView(Context context) {
      super(context);

      ValueAnimator colorAnim = ObjectAnimator.ofInt(this, "backgroundColor", RED, BLUE);
      colorAnim.setDuration(3000);
      colorAnim.setEvaluator(new ArgbEvaluator());
      colorAnim.setRepeatCount(ValueAnimator.INFINITE);
      colorAnim.setRepeatMode(ValueAnimator.REVERSE);
      ObjectAnimator.setFrameDelay(0);
      colorAnim.start();
    }
예제 #14
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    WaveProgressView waveProgressView = (WaveProgressView) findViewById(R.id.wave_progress_view);
    waveProgressView.setMax(100);
    ObjectAnimator progressAnim =
        ObjectAnimator.ofInt(waveProgressView, "progress", 0, waveProgressView.getMax());
    progressAnim.setDuration(10 * 1000);
    progressAnim.setRepeatCount(ObjectAnimator.INFINITE);
    progressAnim.setRepeatMode(ObjectAnimator.RESTART);
    progressAnim.start();

    waveProgressView = (WaveProgressView) findViewById(R.id.wave_progress_view_2);
    progressAnim = ObjectAnimator.ofInt(waveProgressView, "progress", 0, waveProgressView.getMax());
    progressAnim.setDuration(15 * 1000);
    progressAnim.setRepeatCount(ObjectAnimator.INFINITE);
    progressAnim.setRepeatMode(ObjectAnimator.RESTART);
    progressAnim.start();
  }
예제 #15
0
 public static void translateFragmentX(Fragment fragment, int from, int to) {
   final View fragmentView = fragment.getView();
   if (fragmentView == null) {
     return;
   }
   FragmentViewXWrapper wrapper = new FragmentViewXWrapper(fragmentView);
   ObjectAnimator objectAnimator = ObjectAnimator.ofInt(wrapper, "change", from, to);
   objectAnimator.setDuration(300);
   objectAnimator.setInterpolator(new DecelerateInterpolator());
   objectAnimator.start();
 }
예제 #16
0
  public void startAnimation() {
    if (animationEnabled) {
      if (windowAnimatorSet != null) {
        return;
      }
      ActionBarPopupWindowLayout content = (ActionBarPopupWindowLayout) getContentView();
      content.setTranslationY(0);
      content.setAlpha(1.0f);
      content.setPivotX(content.getMeasuredWidth());
      content.setPivotY(0);
      int count = content.getItemsCount();
      content.positions.clear();
      int visibleCount = 0;
      for (int a = 0; a < count; a++) {
        View child = content.getItemAt(a);
        if (child.getVisibility() != View.VISIBLE) {
          continue;
        }
        content.positions.put(child, visibleCount);
        child.setAlpha(0.0f);
        visibleCount++;
      }
      if (content.showedFromBotton) {
        content.lastStartedChild = count - 1;
      } else {
        content.lastStartedChild = 0;
      }
      windowAnimatorSet = new AnimatorSet();
      windowAnimatorSet.playTogether(
          ObjectAnimator.ofFloat(content, "backScaleY", 0.0f, 1.0f),
          ObjectAnimator.ofInt(content, "backAlpha", 0, 255));
      windowAnimatorSet.setDuration(150 + 16 * visibleCount);
      windowAnimatorSet.addListener(
          new Animator.AnimatorListener() {
            @Override
            public void onAnimationStart(Animator animation) {}

            @Override
            public void onAnimationEnd(Animator animation) {
              windowAnimatorSet = null;
            }

            @Override
            public void onAnimationCancel(Animator animation) {
              onAnimationEnd(animation);
            }

            @Override
            public void onAnimationRepeat(Animator animation) {}
          });
      windowAnimatorSet.start();
    }
  }
 /** Animates the dim to the task progress. */
 void animateDimToProgress(int delay, int duration, Animator.AnimatorListener postAnimRunnable) {
   // Animate the dim into view as well
   int toDim = getDimFromTaskProgress();
   if (toDim != getDim()) {
     ObjectAnimator anim = ObjectAnimator.ofInt(TaskView.this, "dim", toDim);
     anim.setStartDelay(delay);
     anim.setDuration(duration);
     if (postAnimRunnable != null) {
       anim.addListener(postAnimRunnable);
     }
     anim.start();
   }
 }
  private void startAnimation() {
    final float sunYStart = sunView.getTop();
    final float sunYEnd = skyView.getHeight();

    final ObjectAnimator heightAnimator =
        ObjectAnimator.ofFloat(sunView, "y", sunYStart, sunYEnd).setDuration(3000);
    heightAnimator.setInterpolator(new AccelerateInterpolator());

    final ObjectAnimator sunsetSkyAnimator =
        ObjectAnimator.ofInt(skyView, "backgroundColor", blueSkyColor, sunsetSkyColor)
            .setDuration(3000);
    sunsetSkyAnimator.setEvaluator(new ArgbEvaluator());

    final ObjectAnimator nightSkyAnimator =
        ObjectAnimator.ofInt(skyView, "backgroundColor", sunsetSkyColor, nightSkyColor)
            .setDuration(1500);
    nightSkyAnimator.setEvaluator(new ArgbEvaluator());

    final AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.play(heightAnimator).with(sunsetSkyAnimator).before(nightSkyAnimator);
    animatorSet.start();
  }
    public MyAnimationView(Context context) {
      super(context);

      // Animate background color
      // Note that setting the background color will automatically invalidate the
      // view, so that the animated color, and the bouncing balls, get redisplayed on
      // every frame of the animation.
      ValueAnimator colorAnim = ObjectAnimator.ofInt(this, "backgroundColor", RED, BLUE);
      colorAnim.setDuration(3000);
      colorAnim.setEvaluator(new ArgbEvaluator());
      colorAnim.setRepeatCount(ValueAnimator.INFINITE);
      colorAnim.setRepeatMode(ValueAnimator.REVERSE);
      colorAnim.start();
    }
  /** Animates this task view as it exits recents */
  void startLaunchTaskAnimation(
      final Runnable postAnimRunnable,
      boolean isLaunchingTask,
      boolean occludesLaunchTarget,
      boolean lockToTask) {
    if (isLaunchingTask) {
      // Animate the thumbnail alpha back into full opacity for the window animation out
      mThumbnailView.startLaunchTaskAnimation(postAnimRunnable);

      // Animate the dim
      if (mDimAlpha > 0) {
        ObjectAnimator anim = ObjectAnimator.ofInt(this, "dim", 0);
        anim.setDuration(mConfig.taskViewExitToAppDuration);
        anim.setInterpolator(mConfig.fastOutLinearInInterpolator);
        anim.start();
      }

      // Animate the action button away
      if (!lockToTask) {
        float toScale = 0.9f;
        mActionButtonView.animate().scaleX(toScale).scaleY(toScale);
      }
      mActionButtonView
          .animate()
          .alpha(0f)
          .setStartDelay(0)
          .setDuration(mConfig.taskViewExitToAppDuration)
          .setInterpolator(mConfig.fastOutLinearInInterpolator)
          .withLayer()
          .start();
    } else {
      // Hide the dismiss button
      mHeaderView.startLaunchTaskDismissAnimation();
      // If this is another view in the task grouping and is in front of the launch task,
      // animate it away first
      if (occludesLaunchTarget) {
        animate()
            .alpha(0f)
            .translationY(getTranslationY() + mConfig.taskViewAffiliateGroupEnterOffsetPx)
            .setStartDelay(0)
            .setUpdateListener(null)
            .setInterpolator(mConfig.fastOutLinearInInterpolator)
            .setDuration(mConfig.taskViewExitToAppDuration)
            .start();
      }
    }
  }
예제 #21
0
 public void startFromLocation(int[] tapLocationOnScreen) {
   changeState(STATE_FILL_STARTED);
   startLocationX = tapLocationOnScreen[0];
   startLocationY = tapLocationOnScreen[1];
   revealAnimator =
       ObjectAnimator.ofInt(this, "currentRadius", 0, getWidth() + getHeight())
           .setDuration(FILL_TIME);
   revealAnimator.setInterpolator(INTERPOLATOR);
   revealAnimator.addListener(
       new AnimatorListenerAdapter() {
         @Override
         public void onAnimationEnd(Animator animation) {
           changeState(STATE_FINISHED);
         }
       });
   revealAnimator.start();
 }
  /** Hide animation for the textview if the action bar is not visible. */
  public void startHideAnimation() {
    if (mCurrentAnimation != null) mCurrentAnimation.cancel();

    mCurrentAnimation =
        ObjectAnimator.ofInt(mActionBarDelegate, TOP_MARGIN_ANIM_PROPERTY, 0)
            .setDuration(SLIDE_DURATION_MS);

    mCurrentAnimation.addListener(
        new AnimatorListenerAdapter() {
          @Override
          public void onAnimationEnd(Animator animation) {
            mCurrentAnimation = null;
            mActionBarDelegate.setActionBarBackgroundVisibility(false);
          }
        });

    mCurrentAnimation.start();
    mShowingActionMode = false;
  }
  public void testOfInt() throws Throwable {
    Object object = mActivity.view.newBall;
    String property = "backgroundColor";
    int startColor = mActivity.view.RED;
    int endColor = mActivity.view.BLUE;

    ObjectAnimator colorAnimator = ObjectAnimator.ofInt(object, property, startColor, endColor);
    colorAnimator.setDuration(1000);
    colorAnimator.setEvaluator(new ArgbEvaluator());
    colorAnimator.setRepeatCount(1);
    colorAnimator.setRepeatMode(ValueAnimator.REVERSE);
    colorAnimator.start();
    startAnimation(mObjectAnimator, colorAnimator);
    Thread.sleep(100);
    Integer i = (Integer) colorAnimator.getAnimatedValue();
    // We are going from less negative value to a more negative value
    assertTrue(i.intValue() <= startColor);
    assertTrue(endColor <= i.intValue());
  }
      public ViewportWindow(Context context) {
        SurfaceControl surfaceControl = null;
        try {
          mWindowManager.getDefaultDisplay().getRealSize(mTempPoint);
          surfaceControl =
              new SurfaceControl(
                  mWindowManagerService.mFxSession,
                  SURFACE_TITLE,
                  mTempPoint.x,
                  mTempPoint.y,
                  PixelFormat.TRANSLUCENT,
                  SurfaceControl.HIDDEN);
        } catch (OutOfResourcesException oore) {
          /* ignore */
        }
        mSurfaceControl = surfaceControl;
        mSurfaceControl.setLayerStack(mWindowManager.getDefaultDisplay().getLayerStack());
        mSurfaceControl.setLayer(
            mWindowManagerService.mPolicy.windowTypeToLayerLw(
                    WindowManager.LayoutParams.TYPE_MAGNIFICATION_OVERLAY)
                * WindowManagerService.TYPE_LAYER_MULTIPLIER);
        mSurfaceControl.setPosition(0, 0);
        mSurface.copyFrom(mSurfaceControl);

        TypedValue typedValue = new TypedValue();
        context.getTheme().resolveAttribute(R.attr.colorActivatedHighlight, typedValue, true);
        final int borderColor = context.getResources().getColor(typedValue.resourceId);

        mPaint.setStyle(Paint.Style.STROKE);
        mPaint.setStrokeWidth(mBorderWidth);
        mPaint.setColor(borderColor);

        Interpolator interpolator = new DecelerateInterpolator(2.5f);
        final long longAnimationDuration =
            context.getResources().getInteger(com.android.internal.R.integer.config_longAnimTime);

        mShowHideFrameAnimator =
            ObjectAnimator.ofInt(this, PROPERTY_NAME_ALPHA, MIN_ALPHA, MAX_ALPHA);
        mShowHideFrameAnimator.setInterpolator(interpolator);
        mShowHideFrameAnimator.setDuration(longAnimationDuration);
        mInvalidated = true;
      }
  /** 执行反向动画将其隐藏 */
  private void doReverseAnimation() {
    if (Build.VERSION.SDK_INT < 11) {
      sv_bottom_content.setVisibility(View.GONE);
      ll_full_screen.setVisibility(View.GONE);
    } else {
      // 如果弹出动画还在执行,则直接将弹出动画的值置为最终值,代表该动画结束,接着直接进行收进动画
      popAnimation.end();
      // 避免用户连续快速点击造成短时间内执行两次收进动画,此处进行判断
      if (reverseAnimation != null && reverseAnimation.isRunning()) {
        return;
      }
      if (reverseAnimation == null) {
        reverseAnimation =
            ObjectAnimator.ofInt(sv_bottom_content, "bottomMargin", 0, -scrollViewMeasureHeight);
        reverseAnimation.addUpdateListener(
            new ValueAnimator.AnimatorUpdateListener() {
              @Override
              public void onAnimationUpdate(ValueAnimator animation) {
                int value = (Integer) animation.getAnimatedValue();
                RelativeLayout.LayoutParams params =
                    (RelativeLayout.LayoutParams) sv_bottom_content.getLayoutParams();
                params.bottomMargin = value;
                sv_bottom_content.setLayoutParams(params);
                ((View) (sv_bottom_content.getParent())).invalidate();
                if (value <= -scrollViewMeasureHeight) {
                  sv_bottom_content.setVisibility(View.GONE);
                }

                ll_full_screen.setAlpha(
                    (float)
                        (((scrollViewMeasureHeight + value) * 1.0)
                            / (scrollViewMeasureHeight * 1.0)));
                if (ll_full_screen.getAlpha() <= 0) {
                  ll_full_screen.setVisibility(View.GONE);
                }
              }
            });
        reverseAnimation.setDuration(500);
      }
      reverseAnimation.start();
    }
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);

    setContentView(R.layout.winner);

    // doBindService();

    final Animation animRotate = AnimationUtils.loadAnimation(this, R.anim.rotate);
    final Animation animRotate2 = AnimationUtils.loadAnimation(this, R.anim.rotatetwo);
    final Animation animRotate3 = AnimationUtils.loadAnimation(this, R.anim.rotate3);

    final Animation textAnimation = AnimationUtils.loadAnimation(this, R.anim.textanimation);

    String time = getIntent().getStringExtra("time");

    String click = getIntent().getStringExtra("click");

    TextView maintext = (TextView) findViewById(R.id.maintext);
    maintext.startAnimation(textAnimation);

    ObjectAnimator a;
    a = ObjectAnimator.ofInt(maintext, "textColor", Color.RED, Color.BLUE, Color.CYAN, Color.GREEN);
    a.setRepeatMode(ObjectAnimator.REVERSE);
    a.setRepeatCount(ObjectAnimator.INFINITE);
    a.setDuration(1500000);

    a.start();

    final TextView exit = (TextView) findViewById(R.id.texttime);
    final TextView records = (TextView) findViewById(R.id.clicktext);

    exit.startAnimation(animRotate);
    records.startAnimation(animRotate2);

    final TextView tvTime = (TextView) findViewById(R.id.time);
    final TextView tvClick = (TextView) findViewById(R.id.click);

    tvClick.setText(click);
    tvTime.setText(time);
  }
  private void startRipple(final Runnable animationEndRunnable) {
    if (eventCancelled) return;

    float endRadius = getEndRadius();

    cancelAnimations();

    rippleAnimator = new AnimatorSet();
    rippleAnimator.addListener(
        new AnimatorListenerAdapter() {
          @Override
          public void onAnimationEnd(Animator animation) {
            if (!ripplePersistent) {
              setRadius(0);
              setRippleAlpha(rippleAlpha);
            }
            if (animationEndRunnable != null && rippleDelayClick) {
              animationEndRunnable.run();
            }
            childView.setPressed(false);
          }
        });

    ObjectAnimator ripple = ObjectAnimator.ofFloat(this, radiusProperty, radius, endRadius);
    ripple.setDuration(rippleDuration);
    ripple.setInterpolator(new DecelerateInterpolator());
    ObjectAnimator fade = ObjectAnimator.ofInt(this, circleAlphaProperty, rippleAlpha, 0);
    fade.setDuration(rippleFadeDuration);
    fade.setInterpolator(new AccelerateInterpolator());
    fade.setStartDelay(rippleDuration - rippleFadeDuration - FADE_EXTRA_DELAY);

    if (ripplePersistent) {
      rippleAnimator.play(ripple);
    } else if (getRadius() > endRadius) {
      fade.setStartDelay(0);
      rippleAnimator.play(fade);
    } else {
      rippleAnimator.playTogether(ripple, fade);
    }
    rippleAnimator.start();
  }
  /** 用来显示该popwindow,保证在调用该方法之前已经调用{@link #addItemToBottomPopWindow(int, int, String)}方法 */
  protected void showBottomPopWindow() {
    if (Build.VERSION.SDK_INT >= 11) {
      // 如果上次的动画还在执行,直接停止
      if (reverseAnimation != null) {
        reverseAnimation.end();
      }
      sv_bottom_content.setVisibility(View.VISIBLE);
      ll_full_screen.setVisibility(View.VISIBLE);
      // 需要滚动到顶部
      sv_bottom_content.scrollTo(0, 0);
      if (popAnimation == null) {
        popAnimation =
            ObjectAnimator.ofInt(sv_bottom_content, "bottomMargin", -scrollViewMeasureHeight, 0);
        popAnimation.addUpdateListener(
            new ValueAnimator.AnimatorUpdateListener() {
              @Override
              public void onAnimationUpdate(ValueAnimator animation) {
                int value = (Integer) animation.getAnimatedValue();
                RelativeLayout.LayoutParams params =
                    (RelativeLayout.LayoutParams) sv_bottom_content.getLayoutParams();
                params.bottomMargin = value;
                sv_bottom_content.setLayoutParams(params);
                ((View) (sv_bottom_content.getParent())).invalidate();

                ll_full_screen.setAlpha(
                    (float)
                        (((scrollViewMeasureHeight + value) * 1.0)
                            / (scrollViewMeasureHeight * 1.0)));
              }
            });
        popAnimation.setDuration(500);
      }
      popAnimation.start();
    } else {
      ll_full_screen.setVisibility(View.VISIBLE);
      sv_bottom_content.setVisibility(View.VISIBLE);
      // 需要滚动到顶部
      sv_bottom_content.scrollTo(0, 0);
    }
  }
  /** 开启脉动效果 */
  private void startRipple() {
    if (eventCancelled) return;
    float endRadius = getEndRadius();
    cancelAnimations();

    rippleAnimator = new AnimatorSet();
    ObjectAnimator ripple = ObjectAnimator.ofFloat(this, radiusProperty, radius, endRadius);
    ripple.setDuration(350);
    ripple.setInterpolator(new DecelerateInterpolator()); // 在动画开始的地方快然后慢
    ObjectAnimator fade = ObjectAnimator.ofInt(this, cicleAlphaProperty, 125, 0);
    fade.setDuration(75);
    fade.setInterpolator(new AccelerateInterpolator());
    fade.setStartDelay(350 - 75 - 50); // 这个延迟启动的意义不是很明确,稍后在考虑

    if (getRadius() > endRadius) {
      fade.setStartDelay(0);
      rippleAnimator.play(fade);
    } else {
      rippleAnimator.playTogether(ripple, fade);
    }
    rippleAnimator.start();
  }
  @Override
  public boolean animateChange(
      RecyclerView.ViewHolder oldHolder,
      RecyclerView.ViewHolder newHolder,
      ItemHolderInfo preInfo,
      ItemHolderInfo postInfo) {
    if (preInfo instanceof DesignerNewsItemHolderInfo
        && ((DesignerNewsItemHolderInfo) preInfo).animateAddToPocket) {
      final FeedAdapter.DesignerNewsStoryHolder holder =
          (FeedAdapter.DesignerNewsStoryHolder) newHolder;

      // setup for anim
      holder.itemView.setHasTransientState(true);
      ((ViewGroup) holder.pocket.getParent().getParent()).setClipChildren(false);
      final int initialLeft = holder.pocket.getLeft();
      final int initialTop = holder.pocket.getTop();
      final int translatedLeft = (holder.itemView.getWidth() - holder.pocket.getWidth()) / 2;
      final int translatedTop =
          initialTop - ((holder.itemView.getHeight() - holder.pocket.getHeight()) / 2);
      final ArcMotion arc = new ArcMotion();

      // animate the title & pocket icon up, scale the pocket icon up
      Animator titleMoveFadeOut =
          ObjectAnimator.ofPropertyValuesHolder(
              holder.title,
              PropertyValuesHolder.ofFloat(View.TRANSLATION_Y, -(holder.itemView.getHeight() / 5)),
              PropertyValuesHolder.ofFloat(View.ALPHA, 0.54f));

      Animator pocketMoveUp =
          ObjectAnimator.ofFloat(
              holder.pocket,
              View.TRANSLATION_X,
              View.TRANSLATION_Y,
              arc.getPath(initialLeft, initialTop, translatedLeft, translatedTop));
      Animator pocketScaleUp =
          ObjectAnimator.ofPropertyValuesHolder(
              holder.pocket,
              PropertyValuesHolder.ofFloat(View.SCALE_X, 3f),
              PropertyValuesHolder.ofFloat(View.SCALE_Y, 3f));
      ObjectAnimator pocketFadeUp = ObjectAnimator.ofInt(holder.pocket, ViewUtils.IMAGE_ALPHA, 255);

      AnimatorSet up = new AnimatorSet();
      up.playTogether(titleMoveFadeOut, pocketMoveUp, pocketScaleUp, pocketFadeUp);
      up.setDuration(300);
      up.setInterpolator(
          AnimationUtils.loadInterpolator(
              holder.itemView.getContext(), android.R.interpolator.fast_out_slow_in));

      // animate everything back into place
      Animator titleMoveFadeIn =
          ObjectAnimator.ofPropertyValuesHolder(
              holder.title,
              PropertyValuesHolder.ofFloat(View.TRANSLATION_Y, 0f),
              PropertyValuesHolder.ofFloat(View.ALPHA, 1f));
      Animator pocketMoveDown =
          ObjectAnimator.ofFloat(
              holder.pocket,
              View.TRANSLATION_X,
              View.TRANSLATION_Y,
              arc.getPath(translatedLeft, translatedTop, 0, 0));
      Animator pvhPocketScaleDown =
          ObjectAnimator.ofPropertyValuesHolder(
              holder.pocket,
              PropertyValuesHolder.ofFloat(View.SCALE_X, 1f),
              PropertyValuesHolder.ofFloat(View.SCALE_Y, 1f));
      ObjectAnimator pocketFadeDown =
          ObjectAnimator.ofInt(holder.pocket, ViewUtils.IMAGE_ALPHA, 138);

      AnimatorSet down = new AnimatorSet();
      down.playTogether(titleMoveFadeIn, pocketMoveDown, pvhPocketScaleDown, pocketFadeDown);
      down.setDuration(300);
      down.setInterpolator(
          AnimationUtils.loadInterpolator(
              holder.itemView.getContext(), android.R.interpolator.fast_out_slow_in));
      down.setStartDelay(500);

      // play it
      AnimatorSet upDown = new AnimatorSet();
      upDown.playSequentially(up, down);

      // clean up
      upDown.addListener(
          new AnimatorListenerAdapter() {

            @Override
            public void onAnimationStart(Animator animation) {
              dispatchAnimationStarted(holder);
            }

            @Override
            public void onAnimationEnd(Animator animation) {
              ((ViewGroup) holder.pocket.getParent().getParent()).setClipChildren(true);
              holder.itemView.setHasTransientState(false);
              dispatchAnimationFinished(holder);
            }
          });
      upDown.start();
    }
    return super.animateChange(oldHolder, newHolder, preInfo, postInfo);
  }