Пример #1
0
  private void hide(final View view) {
    ViewPropertyAnimator animator =
        view.animate()
            .translationY(view.getHeight())
            .setInterpolator(INTERPOLATOR)
            .setDuration(200);
    animator.setListener(
        new Animator.AnimatorListener() {
          @Override
          public void onAnimationStart(Animator animator) {}

          @Override
          public void onAnimationEnd(Animator animator) {
            view.setVisibility(View.GONE);
          }

          @Override
          public void onAnimationCancel(Animator animator) {
            show(view);
          }

          @Override
          public void onAnimationRepeat(Animator animator) {}
        });
    animator.start();
  }
Пример #2
0
  public void verticalRun() {

    ViewPropertyAnimator animator1 =
        mRecyclerView.animate().scaleX(0.95f).scaleY(0.95f).setDuration(200);
    // 可以不用start
    animator1.start();
  }
Пример #3
0
  @Override
  public void hideOverlay(final boolean closeShortcutWindow) {
    ViewPropertyAnimator animator =
        mOverlay
            .animate()
            .setDuration(AppConstant.Anim.ANIM_DURATION_NORMAL)
            .translationX(mInitialOverlayTranslationX)
            .setInterpolator(new AccelerateInterpolator());
    animator.setListener(
        new Animator.AnimatorListener() {
          @Override
          public void onAnimationStart(Animator animation) {}

          @Override
          public void onAnimationEnd(Animator animation) {
            mGestureOverLay.setVisibility(GONE);
            EventBus.getDefault().post(new EventToKnob(EventToKnob.END_STATE_RIGHT));
            if (closeShortcutWindow) {
              startCloseAnim();
            }
          }

          @Override
          public void onAnimationCancel(Animator animation) {}

          @Override
          public void onAnimationRepeat(Animator animation) {}
        });
    animator.start();
  }
Пример #4
0
  @Override
  public void showOverlay() {
    if (mCurrentOverlayMode == OverlayMoveMode.BY_GESTURE) {
      mGestureOverLay.setVisibility(VISIBLE);
      ViewPropertyAnimator animator =
          mOverlay
              .animate()
              .setDuration(AppConstant.Anim.ANIM_DURATION_NORMAL)
              .translationX(mTargetOverlayTranslationX)
              .setInterpolator(new DecelerateInterpolator())
              .setListener(
                  new Animator.AnimatorListener() {
                    @Override
                    public void onAnimationStart(Animator animation) {
                      mGestureOverLay.setVisibility(VISIBLE);
                    }

                    @Override
                    public void onAnimationEnd(Animator animation) {
                      EventBus.getDefault().post(new EventToKnob(EventToKnob.END_STATE_LEFT));
                    }

                    @Override
                    public void onAnimationCancel(Animator animation) {}

                    @Override
                    public void onAnimationRepeat(Animator animation) {}
                  });
      animator.start();
    }
  }
 @Override
 private void start(View view, long l, float f, float f2, float f3, float f4, float f5, float f6) {
   view.setScaleX(f);
   view.setScaleY(f);
   view.setTranslationX(f3);
   view.setTranslationY(f4);
   ViewPropertyAnimator viewPropertyAnimator =
       view.animate().translationX(f5).translationY(f6).scaleX(f2).scaleY(f2).setDuration(l);
   viewPropertyAnimator.start();
 }
  public void flip(float sgn) {
    mPanel[0].animate().cancel();
    mPanel[1].animate().cancel();

    float frontY = mPanel[0].getRotationY();
    float backY = mPanel[1].getRotationY();
    float frontA = mPanel[0].getAlpha();
    float backA = mPanel[1].getAlpha();

    frontY = wrap360(frontY);
    backY = wrap360(backY);

    mPanel[0].setRotationY(frontY);
    mPanel[1].setRotationY(backY);

    frontY = lockTo180(frontY + sgn * 180f);
    backY = lockTo180(backY + sgn * 180f);
    frontA = 1f - frontA;
    backA = 1f - backA;

    // Don't rotate
    frontY = backY = 0f;

    ViewPropertyAnimator frontAnim =
        mPanel[0].animate().rotationY(frontY).alpha(frontA).setDuration(mFlipDuration);
    ViewPropertyAnimator backAnim =
        mPanel[1]
            .animate()
            .rotationY(backY)
            .alpha(backA)
            .setDuration(mFlipDuration)
            .withEndAction(
                new Runnable() {
                  @Override
                  public void run() {
                    maybeLoadMore();
                  }
                });

    frontAnim.start();
    backAnim.start();
  }
Пример #7
0
 public void fadeIn() {
   // The selector starts with a height of 0. In order to scale up
   // from
   // 0 we first need the set the height to 1 and scale form there.
   int selectorHeight = mSelectorView.getHeight();
   if (selectorHeight == 0) {
     LayoutParams lp = mSelectorView.getLayoutParams();
     lp.height =
         selectorHeight =
             mSelectorView
                 .getContext()
                 .getResources()
                 .getDimensionPixelSize(R.dimen.lb_action_fragment_selector_min_height);
     mSelectorView.setLayoutParams(lp);
   }
   View focusedChild = mParentView.getFocusedChild();
   if (focusedChild != null) {
     float scaleY = (float) focusedChild.getHeight() / selectorHeight;
     ViewPropertyAnimator animation =
         mSelectorView
             .animate()
             .alpha(1f)
             .setListener(new Listener(false))
             .setDuration(mAnimationDuration)
             .setInterpolator(new DecelerateInterpolator(2f));
     if (mFadedOut) {
       // selector is completely faded out, so we can just
       // scale
       // before fading in.
       mSelectorView.setScaleY(scaleY);
     } else {
       // selector is not faded out, so we must animate the
       // scale
       // as we fade in.
       animation.scaleY(scaleY);
     }
     animation.start();
   }
 }
Пример #8
0
 private void start(
     View view,
     long duration,
     float fromScale,
     float toScale,
     float fromTranslationX,
     float fromTranslationY,
     float toTranslationX,
     float toTranslationY) {
   view.setScaleX(fromScale);
   view.setScaleY(fromScale);
   view.setTranslationX(fromTranslationX);
   view.setTranslationY(fromTranslationY);
   ViewPropertyAnimator propertyAnimator =
       view.animate()
           .translationX(toTranslationX)
           .translationY(toTranslationY)
           .scaleX(toScale)
           .scaleY(toScale)
           .setDuration(duration);
   propertyAnimator.start();
   DebugUtils.log("KenBurnsView: starting Ken Burns animation " + propertyAnimator);
 }
Пример #9
0
 public void gverticalRun() {
   ViewPropertyAnimator animator1 =
       mRecyclerView.animate().scaleX(1.0f).scaleY(1.0f).setDuration(200);
   animator1.start();
 }