private Animator createHideItemAnimator(final View item) {
    final float dx = centerItem.getX() - item.getX();
    final float dy = centerItem.getY() - item.getY();

    Animator anim =
        ObjectAnimator.ofPropertyValuesHolder(
            item,
            AnimatorUtils.scaleX(1f, 0f),
            AnimatorUtils.scaleY(1f, 0f),
            AnimatorUtils.translationX(0f, dx),
            AnimatorUtils.translationY(0f, dy));

    anim.setInterpolator(new DecelerateInterpolator());
    anim.addListener(
        new AnimatorListenerAdapter() {
          @Override
          public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            item.setTranslationX(0f);
            item.setTranslationY(0f);
          }
        });
    anim.setDuration(50);
    return anim;
  }
Example #2
0
  private void init() {

    PropertyValuesHolder valueHolder_1 = PropertyValuesHolder.ofFloat("scaleX", 1f, 0.9f);
    PropertyValuesHolder valueHolder_2 = PropertyValuesHolder.ofFloat("scaleY", 1f, 0.9f);
    anim1 = ObjectAnimator.ofPropertyValuesHolder(this, valueHolder_1, valueHolder_2);
    anim1.setDuration(200);
    anim1.setInterpolator(new LinearInterpolator());

    PropertyValuesHolder valueHolder_3 = PropertyValuesHolder.ofFloat("scaleX", 0.9f, 1f);
    PropertyValuesHolder valueHolder_4 = PropertyValuesHolder.ofFloat("scaleY", 0.9f, 1f);
    anim2 = ObjectAnimator.ofPropertyValuesHolder(this, valueHolder_3, valueHolder_4);
    anim2.setDuration(200);
    anim2.setInterpolator(new LinearInterpolator());
  }
  private void hideMenu(int cx, int cy, float startRadius, float endRadius) {
    List<Animator> animList = new ArrayList<>();

    for (int i = arcLayout.getChildCount() - 1; i >= 0; i--) {
      animList.add(createHideItemAnimator(arcLayout.getChildAt(i)));
    }

    animList.add(createHideItemAnimator(centerItem));

    Animator revealAnim = createCircularReveal(menuLayout, cx, cy, startRadius, endRadius);
    revealAnim.setInterpolator(new AccelerateDecelerateInterpolator());
    revealAnim.setDuration(200);
    revealAnim.addListener(
        new AnimatorListenerAdapter() {
          @Override
          public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            menuLayout.setVisibility(View.INVISIBLE);
          }
        });

    animList.add(revealAnim);

    AnimatorSet animSet = new AnimatorSet();
    animSet.playSequentially(animList);
    animSet.start();
  }
  // testing animation class
  private void animateRevealShow(View viewRoot) {
    int cx = (viewRoot.getLeft() + viewRoot.getRight()) / 2;
    int cy = (viewRoot.getTop() + viewRoot.getBottom()) / 2;
    int finalRadius = Math.max(viewRoot.getWidth(), viewRoot.getHeight());

    Animator anim = ViewAnimationUtils.createCircularReveal(viewRoot, cx, cy, 0, finalRadius);
    viewRoot.setVisibility(View.VISIBLE);
    anim.setDuration(1000);
    anim.setInterpolator(new AccelerateInterpolator());
    anim.start();
  }
    void createAnimation(boolean appearing) {
      // mVisible: previous state; appearing: new state

      float start, end;

      // 0: on-screen
      // height: off-screen
      float y = mContentParent.getTranslationY();
      if (appearing) {
        // we want to go from near-the-top to the top, unless we're half-open in the right
        // general vicinity
        end = 0;
        if (mNotificationCount == 0) {
          end += mContentFrameMissingTranslation;
        }
        start = HYPERSPACE_OFFRAMP + end;
      } else {
        start = y;
        end = y + HYPERSPACE_OFFRAMP;
      }

      Animator posAnim = ObjectAnimator.ofFloat(mContentParent, "translationY", start, end);
      posAnim.setInterpolator(appearing ? sDecelerateInterpolator : sAccelerateInterpolator);

      if (mContentAnim != null && mContentAnim.isRunning()) {
        mContentAnim.cancel();
      }

      Animator fadeAnim = ObjectAnimator.ofFloat(mContentParent, "alpha", appearing ? 1.0f : 0.0f);
      fadeAnim.setInterpolator(appearing ? sAccelerateInterpolator : sDecelerateInterpolator);

      mContentAnim = new AnimatorSet();
      mContentAnim.play(fadeAnim).with(posAnim);
      mContentAnim.setDuration((DEBUG ? 10 : 1) * (appearing ? OPEN_DURATION : CLOSE_DURATION));
      mContentAnim.addListener(this);
    }
  private void populateToolbarAnimations() {
    mSecurityButtonShowAnimator = new AnimatorSet();
    int securityIconButtonWidth =
        getResources().getDimensionPixelSize(R.dimen.location_bar_icon_width);
    Animator titleUrlTranslateAnimator =
        ObjectAnimator.ofFloat(mTitleUrlContainer, TRANSLATION_X, securityIconButtonWidth);
    titleUrlTranslateAnimator.setInterpolator(BakedBezierInterpolator.TRANSFORM_CURVE);
    titleUrlTranslateAnimator.setDuration(CUSTOM_TAB_TOOLBAR_SLIDE_DURATION_MS);

    Animator securityButtonAlphaAnimator = ObjectAnimator.ofFloat(mSecurityButton, ALPHA, 1);
    securityButtonAlphaAnimator.setInterpolator(BakedBezierInterpolator.FADE_IN_CURVE);
    securityButtonAlphaAnimator.setDuration(CUSTOM_TAB_TOOLBAR_FADE_DURATION_MS);
    securityButtonAlphaAnimator.addListener(
        new AnimatorListenerAdapter() {
          @Override
          public void onAnimationStart(Animator animation) {
            mSecurityButton.setVisibility(VISIBLE);
            mTitleUrlContainer.setTranslationX(0);
          }
        });

    mSecurityButtonShowAnimator.playSequentially(
        titleUrlTranslateAnimator, securityButtonAlphaAnimator);
  }
  private void showMenu(int cx, int cy, float startRadius, float endRadius) {
    menuLayout.setVisibility(View.VISIBLE);

    List<Animator> animList = new ArrayList<>();

    Animator revealAnim = createCircularReveal(menuLayout, cx, cy, startRadius, endRadius);
    revealAnim.setInterpolator(new AccelerateDecelerateInterpolator());
    revealAnim.setDuration(200);

    animList.add(revealAnim);
    animList.add(createShowItemAnimator(centerItem));

    for (int i = 0, len = arcLayout.getChildCount(); i < len; i++) {
      animList.add(createShowItemAnimator(arcLayout.getChildAt(i)));
    }

    AnimatorSet animSet = new AnimatorSet();
    animSet.playSequentially(animList);
    animSet.start();
  }
  private Animator createShowItemAnimator(View item) {
    float dx = centerItem.getX() - item.getX();
    float dy = centerItem.getY() - item.getY();

    item.setScaleX(0f);
    item.setScaleY(0f);
    item.setTranslationX(dx);
    item.setTranslationY(dy);

    Animator anim =
        ObjectAnimator.ofPropertyValuesHolder(
            item,
            AnimatorUtils.scaleX(0f, 1f),
            AnimatorUtils.scaleY(0f, 1f),
            AnimatorUtils.translationX(dx, 0f),
            AnimatorUtils.translationY(dy, 0f));

    anim.setInterpolator(new DecelerateInterpolator());
    anim.setDuration(50);
    return anim;
  }
Example #9
0
  @TargetApi(Build.VERSION_CODES.LOLLIPOP)
  public static void setAnimation(View viewToAnimate, int position) {
    try {
      if (position >= Reddit.lastposition.get(Reddit.currentPosition) - 1 && Reddit.animation) {
        int cx = viewToAnimate.getWidth() / 2;
        int cy = viewToAnimate.getHeight() / 2;
        int finalRadius = Math.max(viewToAnimate.getWidth(), viewToAnimate.getHeight());

        final Animator anim =
            ViewAnimationUtils.createCircularReveal(viewToAnimate, cx, cy, 0, finalRadius);
        anim.setDuration(Reddit.enter_animation_time);
        anim.setInterpolator(new FastOutSlowInInterpolator());
        viewToAnimate.setVisibility(View.VISIBLE);
        anim.start();
        Reddit.lastposition.set(
            Reddit.currentPosition, Reddit.lastposition.get(Reddit.currentPosition) + 1);
      }
    } catch (IndexOutOfBoundsException e) {
      fixSliding(Reddit.currentPosition);
    }
  }
Example #10
0
  @TargetApi(Build.VERSION_CODES.LOLLIPOP)
  public static void revealHide(
      final Context context,
      int finalRadius,
      final View view,
      @ColorRes final int colorRes,
      @NonNull final OnRevealAnimationListener onRevealAnimationListener) {
    // previously invisible view

    // get the center for the clipping circle
    int cx = (view.getLeft() + view.getRight()) / 2;
    int cy = (view.getTop() + view.getBottom()) / 2;

    // get the final radius for the clipping circle
    int startRadius = Math.max(view.getWidth(), view.getHeight());

    // create the animator for this view (the start radius is zero)
    Animator anim = ViewAnimationUtils.createCircularReveal(view, cx, cy, startRadius, finalRadius);
    anim.setDuration(500);
    anim.setInterpolator(new AccelerateDecelerateInterpolator());
    anim.addListener(
        new AnimatorListenerAdapter() {
          @Override
          public void onAnimationStart(Animator animation) {
            super.onAnimationStart(animation);
            onRevealAnimationListener.onAnimationStart();
            view.setBackgroundColor(ContextCompat.getColor(context, colorRes));
          }

          @Override
          public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            // make the view visible and start the animation
            view.setVisibility(View.INVISIBLE);
            onRevealAnimationListener.onAnimationEnd();
          }
        });
    anim.start();
  }
Example #11
0
  @Override
  public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
    if (position < getItemCount()
        && (customHeaderView != null ? position <= stringList.size() : position < stringList.size())
        && (customHeaderView != null ? position > 0 : true)) {

      ((ViewHolder) holder)
          .textViewSample.setText(
              stringList.get(customHeaderView != null ? position - 1 : position).getTitle());
      ((ViewHolder) holder)
          .imageViewSample.setImageResource(
              stringList.get(customHeaderView != null ? position - 1 : position).getImage());
      // ((ViewHolder) holder).itemView.setActivated(selectedItems.get(position, false));
    }
    if (!isFirstOnly || position > mLastPosition) {
      for (Animator anim : getAdapterAnimations(holder.itemView, AdapterAnimationType.ScaleIn)) {
        anim.setDuration(mDuration).start();
        anim.setInterpolator(mInterpolator);
      }
      mLastPosition = position;
    } else {
      ViewHelper.clear(holder.itemView);
    }
  }
  protected Animator createCheckoutRevealAnimator(
      final ClipRevealFrame view, int x, int y, float startRadius, float endRadius) {
    setMenuVisibility(false);
    Animator retAnimator;
    mRadius = endRadius;
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
      retAnimator = ViewAnimationUtils.createCircularReveal(view, x, y, startRadius, endRadius);
    } else {
      view.setClipOutLines(true);
      view.setClipCenter(x, y);
      view.setClipRadius(startRadius);

      retAnimator = ObjectAnimator.ofFloat(view, "clipRadius", startRadius, endRadius);
    }
    retAnimator.setDuration(ANIM_DURATION);
    retAnimator.addListener(
        new Animator.AnimatorListener() {
          @Override
          public void onAnimationStart(Animator animation) {}

          @Override
          public void onAnimationEnd(Animator animation) {
            view.setClipOutLines(false);
            removeOldSideFragment();
          }

          @Override
          public void onAnimationCancel(Animator animation) {}

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

    retAnimator.setInterpolator(new AccelerateInterpolator(2.0f));
    return retAnimator;
  }
  public void animateOpen() {
    if (!(getParent() instanceof DragLayer)) return;

    Animator openFolderAnim = null;
    final Runnable onCompleteRunnable;
    if (!Utilities.isLmpOrAbove()) {
      positionAndSizeAsIcon();
      centerAboutIcon();

      PropertyValuesHolder alpha = PropertyValuesHolder.ofFloat("alpha", 1);
      PropertyValuesHolder scaleX = PropertyValuesHolder.ofFloat("scaleX", 1.0f);
      PropertyValuesHolder scaleY = PropertyValuesHolder.ofFloat("scaleY", 1.0f);
      final ObjectAnimator oa =
          LauncherAnimUtils.ofPropertyValuesHolder(this, alpha, scaleX, scaleY);
      oa.setDuration(mExpandDuration);
      openFolderAnim = oa;

      setLayerType(LAYER_TYPE_HARDWARE, null);
      onCompleteRunnable =
          new Runnable() {
            @Override
            public void run() {
              setLayerType(LAYER_TYPE_NONE, null);
            }
          };
    } else {
      prepareReveal();
      centerAboutIcon();

      int width = getPaddingLeft() + getPaddingRight() + mContent.getDesiredWidth();
      int height = getFolderHeight();

      float transX = -0.075f * (width / 2 - getPivotX());
      float transY = -0.075f * (height / 2 - getPivotY());
      setTranslationX(transX);
      setTranslationY(transY);
      PropertyValuesHolder tx = PropertyValuesHolder.ofFloat("translationX", transX, 0);
      PropertyValuesHolder ty = PropertyValuesHolder.ofFloat("translationY", transY, 0);

      int rx = (int) Math.max(Math.max(width - getPivotX(), 0), getPivotX());
      int ry = (int) Math.max(Math.max(height - getPivotY(), 0), getPivotY());
      float radius = (float) Math.sqrt(rx * rx + ry * ry);
      AnimatorSet anim = LauncherAnimUtils.createAnimatorSet();
      Animator reveal =
          LauncherAnimUtils.createCircularReveal(
              this, (int) getPivotX(), (int) getPivotY(), 0, radius);
      reveal.setDuration(mMaterialExpandDuration);
      reveal.setInterpolator(new LogDecelerateInterpolator(100, 0));

      mContent.setAlpha(0f);
      Animator iconsAlpha = LauncherAnimUtils.ofFloat(mContent, "alpha", 0f, 1f);
      iconsAlpha.setDuration(mMaterialExpandDuration);
      iconsAlpha.setStartDelay(mMaterialExpandStagger);
      iconsAlpha.setInterpolator(new AccelerateInterpolator(1.5f));

      mFolderName.setAlpha(0f);
      Animator textAlpha = LauncherAnimUtils.ofFloat(mFolderName, "alpha", 0f, 1f);
      textAlpha.setDuration(mMaterialExpandDuration);
      textAlpha.setStartDelay(mMaterialExpandStagger);
      textAlpha.setInterpolator(new AccelerateInterpolator(1.5f));

      Animator drift = LauncherAnimUtils.ofPropertyValuesHolder(this, tx, ty);
      drift.setDuration(mMaterialExpandDuration);
      drift.setStartDelay(mMaterialExpandStagger);
      drift.setInterpolator(new LogDecelerateInterpolator(60, 0));

      anim.play(drift);
      anim.play(iconsAlpha);
      anim.play(textAlpha);
      anim.play(reveal);

      openFolderAnim = anim;

      mContent.setLayerType(LAYER_TYPE_HARDWARE, null);
      onCompleteRunnable =
          new Runnable() {
            @Override
            public void run() {
              mContent.setLayerType(LAYER_TYPE_NONE, null);
            }
          };
    }
    openFolderAnim.addListener(
        new AnimatorListenerAdapter() {
          @Override
          public void onAnimationStart(Animator animation) {
            sendCustomAccessibilityEvent(
                AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED,
                String.format(
                    getContext().getString(R.string.folder_opened),
                    mContent.getCountX(),
                    mContent.getCountY()));
            mState = STATE_ANIMATING;
          }

          @Override
          public void onAnimationEnd(Animator animation) {
            mState = STATE_OPEN;

            if (onCompleteRunnable != null) {
              onCompleteRunnable.run();
            }

            setFocusOnFirstChild();
          }
        });
    openFolderAnim.start();

    // Make sure the folder picks up the last drag move even if the finger doesn't move.
    if (mDragController.isDragging()) {
      mDragController.forceTouchMove();
    }
  }
Example #14
0
 void setupBottomBarAnimator(Animator animator) {
   Resources res = mContext.getResources();
   int duration = res.getInteger(R.integer.titlebar_animation_duration);
   animator.setInterpolator(new DecelerateInterpolator(ANIM_TITLEBAR_DECELERATE));
   animator.setDuration(duration);
 }
  @Override
  public Animator createAnimator(
      final ViewGroup sceneRoot,
      final TransitionValues startValues,
      final TransitionValues endValues) {
    if (startValues == null || endValues == null) return null;

    final Rect startBounds = (Rect) startValues.values.get(PROP_BOUNDS);
    final Rect endBounds = (Rect) endValues.values.get(PROP_BOUNDS);

    final boolean fromFab = endBounds.width() > startBounds.width();
    final View view = endValues.view;
    final Rect dialogBounds = fromFab ? endBounds : startBounds;
    final Rect fabBounds = fromFab ? startBounds : endBounds;
    final Interpolator fastOutSlowInInterpolator =
        AnimUtils.getFastOutSlowInInterpolator(sceneRoot.getContext());
    final long duration = getDuration();
    final long halfDuration = duration / 2;
    final long twoThirdsDuration = duration * 2 / 3;

    if (!fromFab) {
      // Force measure / layout the dialog back to it's original bounds
      view.measure(
          makeMeasureSpec(startBounds.width(), View.MeasureSpec.EXACTLY),
          makeMeasureSpec(startBounds.height(), View.MeasureSpec.EXACTLY));
      view.layout(startBounds.left, startBounds.top, startBounds.right, startBounds.bottom);
    }

    final int translationX = startBounds.centerX() - endBounds.centerX();
    final int translationY = startBounds.centerY() - endBounds.centerY();
    if (fromFab) {
      view.setTranslationX(translationX);
      view.setTranslationY(translationY);
    }

    // Add a color overlay to fake appearance of the FAB
    final ColorDrawable fabColor = new ColorDrawable(color);
    fabColor.setBounds(0, 0, dialogBounds.width(), dialogBounds.height());
    if (!fromFab) fabColor.setAlpha(0);
    view.getOverlay().add(fabColor);

    // Add an icon overlay again to fake the appearance of the FAB
    final Drawable fabIcon = ContextCompat.getDrawable(sceneRoot.getContext(), icon).mutate();
    final int iconLeft = (dialogBounds.width() - fabIcon.getIntrinsicWidth()) / 2;
    final int iconTop = (dialogBounds.height() - fabIcon.getIntrinsicHeight()) / 2;
    fabIcon.setBounds(
        iconLeft,
        iconTop,
        iconLeft + fabIcon.getIntrinsicWidth(),
        iconTop + fabIcon.getIntrinsicHeight());
    if (!fromFab) fabIcon.setAlpha(0);
    view.getOverlay().add(fabIcon);

    // Circular clip from/to the FAB size
    final Animator circularReveal;
    if (fromFab) {
      circularReveal =
          ViewAnimationUtils.createCircularReveal(
              view,
              view.getWidth() / 2,
              view.getHeight() / 2,
              startBounds.width() / 2,
              (float) Math.hypot(endBounds.width() / 2, endBounds.height() / 2));
      circularReveal.setInterpolator(
          AnimUtils.getFastOutLinearInInterpolator(sceneRoot.getContext()));
    } else {
      circularReveal =
          ViewAnimationUtils.createCircularReveal(
              view,
              view.getWidth() / 2,
              view.getHeight() / 2,
              (float) Math.hypot(startBounds.width() / 2, startBounds.height() / 2),
              endBounds.width() / 2);
      circularReveal.setInterpolator(
          AnimUtils.getLinearOutSlowInInterpolator(sceneRoot.getContext()));

      // Persist the end clip i.e. stay at FAB size after the reveal has run
      circularReveal.addListener(
          new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
              view.setOutlineProvider(
                  new ViewOutlineProvider() {
                    @Override
                    public void getOutline(View view, Outline outline) {
                      final int left = (view.getWidth() - fabBounds.width()) / 2;
                      final int top = (view.getHeight() - fabBounds.height()) / 2;
                      outline.setOval(
                          left, top, left + fabBounds.width(), top + fabBounds.height());
                      view.setClipToOutline(true);
                    }
                  });
            }
          });
    }
    circularReveal.setDuration(duration);

    // Translate to end position along an arc
    final Animator translate =
        ObjectAnimator.ofFloat(
            view,
            View.TRANSLATION_X,
            View.TRANSLATION_Y,
            fromFab
                ? getPathMotion().getPath(translationX, translationY, 0, 0)
                : getPathMotion().getPath(0, 0, -translationX, -translationY));
    translate.setDuration(duration);
    translate.setInterpolator(fastOutSlowInInterpolator);

    // Fade contents of non-FAB view in/out
    List<Animator> fadeContents = null;
    if (view instanceof ViewGroup) {
      final ViewGroup vg = ((ViewGroup) view);
      fadeContents = new ArrayList<>(vg.getChildCount());
      for (int i = vg.getChildCount() - 1; i >= 0; i--) {
        final View child = vg.getChildAt(i);
        final Animator fade = ObjectAnimator.ofFloat(child, View.ALPHA, fromFab ? 1f : 0f);
        if (fromFab) {
          child.setAlpha(0f);
        }
        fade.setDuration(twoThirdsDuration);
        fade.setInterpolator(fastOutSlowInInterpolator);
        fadeContents.add(fade);
      }
    }

    // Fade in/out the fab color & icon overlays
    final Animator colorFade = ObjectAnimator.ofInt(fabColor, "alpha", fromFab ? 0 : 255);
    final Animator iconFade = ObjectAnimator.ofInt(fabIcon, "alpha", fromFab ? 0 : 255);
    if (!fromFab) {
      colorFade.setStartDelay(halfDuration);
      iconFade.setStartDelay(halfDuration);
    }
    colorFade.setDuration(halfDuration);
    iconFade.setDuration(halfDuration);
    colorFade.setInterpolator(fastOutSlowInInterpolator);
    iconFade.setInterpolator(fastOutSlowInInterpolator);

    // Work around issue with elevation shadows. At the end of the return transition the shared
    // element's shadow is drawn twice (by each activity) which is jarring. This workaround
    // still causes the shadow to snap, but it's better than seeing it double drawn.
    Animator elevation = null;
    if (!fromFab) {
      elevation = ObjectAnimator.ofFloat(view, View.TRANSLATION_Z, -view.getElevation());
      elevation.setDuration(duration);
      elevation.setInterpolator(fastOutSlowInInterpolator);
    }

    // Run all animations together
    final AnimatorSet transition = new AnimatorSet();
    transition.playTogether(circularReveal, translate, colorFade, iconFade);
    transition.playTogether(fadeContents);
    if (elevation != null) transition.play(elevation);
    if (fromFab) {
      transition.addListener(
          new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
              // Clean up
              view.getOverlay().clear();
            }
          });
    }
    return new AnimUtils.NoPauseAnimator(transition);
  }
Example #16
0
  public void btnMenu(View view) {
    //        Animation animation = AnimationUtils.loadAnimation(this,R.anim.anim_menu);
    //        ivMenu.startAnimation(animation);
    ivItem1.setVisibility(View.VISIBLE);
    ivItem2.setVisibility(View.VISIBLE);
    ivItem3.setVisibility(View.VISIBLE);
    ivItem4.setVisibility(View.VISIBLE);
    Animator animator = null;

    current++;
    if (current % 2 == 0) {
      // 进来效果
      animator = AnimatorInflater.loadAnimator(this, R.animator.animator_in_menu);
      animator.setTarget(ivMenu);
      animator.start();
      animator = AnimatorInflater.loadAnimator(this, R.animator.animator_in_item1);
      animator.setTarget(ivItem1);
      animator.setInterpolator(new AnticipateOvershootInterpolator());
      animator.start();
      animator = AnimatorInflater.loadAnimator(this, R.animator.animator_in_item2);
      animator.setTarget(ivItem2);
      animator.setInterpolator(new AnticipateOvershootInterpolator());
      animator.start();
      animator = AnimatorInflater.loadAnimator(this, R.animator.animator_in_item3);
      animator.setTarget(ivItem3);
      animator.setInterpolator(new AnticipateOvershootInterpolator());
      animator.start();
      animator = AnimatorInflater.loadAnimator(this, R.animator.animator_in_item4);
      animator.setTarget(ivItem4);
      animator.setInterpolator(new AnticipateOvershootInterpolator());
      animator.start();
    } else {
      // 出去界面效果
      animator = AnimatorInflater.loadAnimator(this, R.animator.animator_menu);
      animator.setTarget(ivMenu);
      animator.start();

      animator = AnimatorInflater.loadAnimator(this, R.animator.animator_item1);
      animator.setInterpolator(new AnticipateOvershootInterpolator());
      animator.setTarget(ivItem1);
      animator.start();

      animator = AnimatorInflater.loadAnimator(this, R.animator.animator_item2);
      animator.setTarget(ivItem2);
      animator.setInterpolator(new AnticipateOvershootInterpolator());
      animator.start();

      animator = AnimatorInflater.loadAnimator(this, R.animator.animator_item3);
      animator.setTarget(ivItem3);
      animator.setInterpolator(new AnticipateOvershootInterpolator());
      animator.start();
      animator = AnimatorInflater.loadAnimator(this, R.animator.animator_item4);
      animator.setTarget(ivItem4);
      animator.setInterpolator(new AnticipateOvershootInterpolator());
      animator.start();
      animator = AnimatorInflater.loadAnimator(this, R.animator.animator_item4);
      animator.setTarget(ivItem4);
      animator.setInterpolator(new AnticipateOvershootInterpolator());
      animator.start();
    }
  }