/**
   * Creates an animator that can be used for x and/or y translations. When interrupted, it sets a
   * tag to keep track of the position so that it may be continued from position.
   *
   * @param view The view being moved. This may be in the overlay for onDisappear.
   * @param values The values containing the view in the view hierarchy.
   * @param viewPosX The x screen coordinate of view
   * @param startX The start translation x of view
   * @param endX The end translation x of view
   * @param interpolator The interpolator to use with this animator.
   * @return An animator that moves from (startX, startY) to (endX, endY) unless there was a
   *     previous interruption, in which case it moves from the current position to (endX, endY).
   */
  static Animator createAnimation(
      View view,
      TransitionValues values,
      int viewPosX,
      float startX,
      float endX,
      TimeInterpolator interpolator,
      Transition transition) {
    float terminalX = view.getTranslationX();
    Integer startPosition = (Integer) values.view.getTag(R.id.transitionPosition);
    if (startPosition != null) {
      startX = startPosition - viewPosX + terminalX;
    }
    // Initial position is at translation startX, startY, so position is offset by that
    // amount
    int startPosX = viewPosX + Math.round(startX - terminalX);

    view.setTranslationX(startX);
    if (startX == endX) {
      return null;
    }
    Path path = new Path();
    path.moveTo(startX, 0);
    path.lineTo(endX, 0);
    ObjectAnimator anim =
        ObjectAnimator.ofFloat(view, View.TRANSLATION_X, View.TRANSLATION_Y, path);

    TransitionPositionListener listener =
        new TransitionPositionListener(view, values.view, startPosX, terminalX);
    transition.addListener(listener);
    anim.addListener(listener);
    anim.addPauseListener(listener);
    anim.setInterpolator(interpolator);
    return anim;
  }
Example #2
0
 /** Return to initial state */
 public void finish(int finishMode) {
   if (!mAttached) {
     return;
   }
   mTextHint.setVisibility(View.GONE);
   if (finishMode == FINISH_SLIDE_OUT) {
     PropertyValuesHolder slideX =
         PropertyValuesHolder.ofFloat(
             "translationX", new float[] {0.0f, mScreenshotView.getWidth()});
     mSlideoutAnimator = ObjectAnimator.ofPropertyValuesHolder(mScreenshotView, slideX);
     mSlideoutAnimator.setInterpolator(new AccelerateInterpolator());
     mSlideoutAnimator.setDuration(SLIDE_OUT_DURATION_MS);
     mSlideoutAnimator.addListener(this);
     mSlideoutAnimator.start();
   } else {
     float currentScale = mScreenshotView.getScaleX();
     float currentAlpha = mScreenshotView.getAlpha();
     PropertyValuesHolder scaleUpX =
         PropertyValuesHolder.ofFloat("scaleX", new float[] {currentScale, 1.0f});
     PropertyValuesHolder scaleUpY =
         PropertyValuesHolder.ofFloat("scaleY", new float[] {currentScale, 1.0f});
     PropertyValuesHolder scaleUpAlpha =
         PropertyValuesHolder.ofFloat("alpha", new float[] {currentAlpha, 1.0f});
     mScaleUpAnimator =
         ObjectAnimator.ofPropertyValuesHolder(mScreenshotView, scaleUpX, scaleUpY, scaleUpAlpha);
     mScaleUpAnimator.setInterpolator(new DecelerateInterpolator());
     mScaleUpAnimator.setDuration(SCALE_UP_DURATION_MS);
     mScaleUpAnimator.addListener(this);
     mScaleUpAnimator.start();
   }
 }
Example #3
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) {}
        });
  }
  /**
   * ��ת����
   *
   * @param one
   * @param two
   */
  private void flipit(View one, View two) {
    final View visible;
    final View invisible;
    if (one.getVisibility() == View.GONE) {
      visible = two;
      invisible = one;

    } else {
      invisible = two;
      visible = one;
    }
    ObjectAnimator visToInvis = ObjectAnimator.ofFloat(visible, "rotationY", 0f, 90f);
    visToInvis.setDuration(500);
    visToInvis.setInterpolator(accelerator);
    final ObjectAnimator invisToVis = ObjectAnimator.ofFloat(invisible, "rotationY", -90f, 0f);
    invisToVis.setDuration(500);
    invisToVis.setInterpolator(decelerator);
    visToInvis.addListener(
        new AnimatorListenerAdapter() {
          @Override
          public void onAnimationEnd(Animator anim) {
            visible.setVisibility(View.GONE);
            invisToVis.start();
            invisible.setVisibility(View.VISIBLE);
          }
        });
    visToInvis.start();
  }
 private ViewFader(View view) {
   mView = Preconditions.checkNotNull(view);
   mFadeOutAnimation =
       ObjectAnimator.ofFloat(view, View.ALPHA, 1, 0).setDuration(FADE_OUT_DURATION);
   mFadeInAnimation =
       ObjectAnimator.ofFloat(view, View.ALPHA, 0, 1).setDuration(FADE_IN_DURATION);
 }
 void doTransition(View view, float to) {
   if (mAnim != null) {
     mAnim.cancel();
   }
   mAnim = ObjectAnimator.ofFloat(view, "alpha", to);
   mAnim.start();
 }
Example #7
0
 private void fadeIn(View v) {
   v.setAlpha(0f);
   ObjectAnimator alphaAnimator = ObjectAnimator.ofFloat(v, "alpha", 1f);
   alphaAnimator.setDuration(
       v.getContext().getResources().getInteger(android.R.integer.config_mediumAnimTime));
   alphaAnimator.start();
 }
  @Override
  public void onTextSizeChanged(final TextView textView, float oldSize) {
    if (mCurrentState != CalculatorState.INPUT) { // TODO dont animate when showing graph
      // Only animate text changes that occur from user input.
      return;
    }

    // Calculate the values needed to perform the scale and translation animations,
    // maintaining the same apparent baseline for the displayed text.
    final float textScale = oldSize / textView.getTextSize();
    final float translationX;
    if (android.os.Build.VERSION.SDK_INT >= 17) {
      translationX = (1.0f - textScale) * (textView.getWidth() / 2.0f - textView.getPaddingEnd());
    } else {
      translationX = (1.0f - textScale) * (textView.getWidth() / 2.0f - textView.getPaddingRight());
    }
    final float translationY =
        (1.0f - textScale) * (textView.getHeight() / 2.0f - textView.getPaddingBottom());
    final AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.playTogether(
        ObjectAnimator.ofFloat(textView, View.SCALE_X, textScale, 1.0f),
        ObjectAnimator.ofFloat(textView, View.SCALE_Y, textScale, 1.0f),
        ObjectAnimator.ofFloat(textView, View.TRANSLATION_X, translationX, 0.0f),
        ObjectAnimator.ofFloat(textView, View.TRANSLATION_Y, translationY, 0.0f));
    animatorSet.setDuration(getResources().getInteger(android.R.integer.config_mediumAnimTime));
    animatorSet.setInterpolator(new AccelerateDecelerateInterpolator());
    animatorSet.start();
  }
Example #9
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();
 }
 public void setPressed(boolean pressed) {
   if (mGlowBG != null) {
     if (pressed != isPressed()) {
       if (mPressedAnim != null && mPressedAnim.isRunning()) {
         mPressedAnim.cancel();
       }
       final AnimatorSet as = mPressedAnim = new AnimatorSet();
       if (pressed) {
         if (mGlowScale < GLOW_MAX_SCALE_FACTOR) mGlowScale = GLOW_MAX_SCALE_FACTOR;
         if (mGlowAlpha < BUTTON_QUIESCENT_ALPHA) mGlowAlpha = BUTTON_QUIESCENT_ALPHA;
         setDrawingAlpha(1f);
         as.playTogether(
             ObjectAnimator.ofFloat(this, "glowAlpha", 1f),
             ObjectAnimator.ofFloat(this, "glowScale", GLOW_MAX_SCALE_FACTOR));
         as.setDuration(50);
       } else {
         as.playTogether(
             ObjectAnimator.ofFloat(this, "glowAlpha", 0f),
             ObjectAnimator.ofFloat(this, "glowScale", 1f),
             ObjectAnimator.ofFloat(this, "drawingAlpha", BUTTON_QUIESCENT_ALPHA));
         as.setDuration(500);
       }
       as.start();
     }
   }
   super.setPressed(pressed);
 }
Example #11
0
  private void showPostVoteAnimation(Vote vote) {
    if (vote == null || vote == Vote.NEUTRAL) return;

    // quickly center the vote button
    simulateScroll();

    String text = vote == Vote.UP ? "+" : (vote == Vote.DOWN ? "-" : "*");
    voteAnimationIndicator.setText(text);

    voteAnimationIndicator.setVisibility(View.VISIBLE);
    voteAnimationIndicator.setAlpha(0);
    voteAnimationIndicator.setScaleX(0.7f);
    voteAnimationIndicator.setScaleY(0.7f);

    ObjectAnimator animator =
        ObjectAnimator.ofPropertyValuesHolder(
            voteAnimationIndicator,
            ofFloat(View.ALPHA, 0, 0.6f, 0.7f, 0.6f, 0),
            ofFloat(View.SCALE_X, 0.7f, 1.3f),
            ofFloat(View.SCALE_Y, 0.7f, 1.3f));

    animator.start();
    animator.addListener(
        new AnimatorListenerAdapter() {
          @Override
          public void onAnimationEnd(Animator animation) {
            View view = PostFragment.this.voteAnimationIndicator;
            if (view != null) {
              view.setVisibility(View.GONE);
            }
          }
        });
  }
  private void animateHide() {
    bubbleHideAnimator = new AnimatorSet();
    this.setPivotX(this.getWidth());
    this.setPivotY(this.getHeight());
    Animator shrinkerX =
        ObjectAnimator.ofFloat(this, SCALE_X, 1f, 0f).setDuration(BUBBLE_ANIMATION_DURATION);
    Animator shrinkerY =
        ObjectAnimator.ofFloat(this, SCALE_Y, 1f, 0f).setDuration(BUBBLE_ANIMATION_DURATION);
    Animator alpha =
        ObjectAnimator.ofFloat(this, ALPHA, 1f, 0f).setDuration(BUBBLE_ANIMATION_DURATION);
    bubbleHideAnimator.setInterpolator(new AccelerateInterpolator());
    bubbleHideAnimator.playTogether(shrinkerX, shrinkerY, alpha);
    bubbleHideAnimator.addListener(
        new AnimatorListenerAdapter() {
          @Override
          public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            FastScrollBubble.this.setVisibility(INVISIBLE);
            bubbleHideAnimator = null;
          }

          @Override
          public void onAnimationCancel(Animator animation) {
            super.onAnimationCancel(animation);
            FastScrollBubble.this.setVisibility(INVISIBLE);
            bubbleHideAnimator = null;
          }
        });
    bubbleHideAnimator.start();
  }
 public void setPressed(boolean pressed) {
   if (mGlowBG != null) {
     if (pressed != isPressed()) {
       if (mPressedAnim != null && mPressedAnim.isRunning()) {
         mPressedAnim.cancel();
       }
       final AnimatorSet as = mPressedAnim = new AnimatorSet();
       if (pressed) {
         if (mGlowScale < GLOW_MAX_SCALE_FACTOR) mGlowScale = GLOW_MAX_SCALE_FACTOR;
         if (mGlowAlpha < mQuiescentAlpha) mGlowAlpha = mQuiescentAlpha;
         setDrawingAlpha(1f);
         as.playTogether(
             ObjectAnimator.ofFloat(this, "glowAlpha", 1f),
             ObjectAnimator.ofFloat(this, "glowScale", GLOW_MAX_SCALE_FACTOR));
         as.setDuration(50);
       } else {
         mAnimateToQuiescent.cancel();
         mAnimateToQuiescent = animateToQuiescent();
         as.playTogether(
             ObjectAnimator.ofFloat(this, "glowAlpha", 0f),
             ObjectAnimator.ofFloat(this, "glowScale", 1f),
             mAnimateToQuiescent);
         as.setDuration(500);
       }
       as.start();
     }
   }
   super.setPressed(pressed);
 }
 private void performSwitch() {
   ObjectAnimator animator1 =
       ObjectAnimator.ofFloat(
           mFirstView, "translationY", mFirstView.getTranslationY() - mBannerHeight);
   ObjectAnimator animator2 =
       ObjectAnimator.ofFloat(
           mSecondView, "translationY", mSecondView.getTranslationY() - mBannerHeight);
   AnimatorSet set = new AnimatorSet();
   set.playTogether(animator1, animator2);
   set.addListener(
       new AnimatorListenerAdapter() {
         @Override
         public void onAnimationEnd(Animator animation) {
           mFirstView.setTranslationY(0);
           mSecondView.setTranslationY(0);
           View removedView = getChildAt(0);
           mPosition++;
           mAdapter.setItem(removedView, mAdapter.getItem(mPosition % mAdapter.getCount()));
           removeView(removedView);
           addView(removedView, 1);
         }
       });
   set.setDuration(mAnimDuration);
   set.start();
 }
 @Override
 public void prepare(View target) {
   getAnimatorAgent()
       .playTogether(
           ObjectAnimator.ofFloat(target, "alpha", 1, 0),
           ObjectAnimator.ofFloat(target, "translationX", 0, -target.getWidth() / 4));
 }
          @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 rotateLogo() {
    btnScan.setText(ctx.getString(R.string.stop_scan));
    if (logoAnimator != null) logoAnimator.cancel();
    logoAnimator = ObjectAnimator.ofFloat(imgLogo, "rotation", 0, 360);
    logoAnimator.setDuration(200);
    logoAnimator.setInterpolator(new AccelerateInterpolator());
    logoAnimator.addListener(
        new Animator.AnimatorListener() {
          @Override
          public void onAnimationStart(Animator animation) {}

          @Override
          public void onAnimationEnd(Animator animation) {
            if (!pleaseStop) {
              rotateLogo();
            } else {
              pleaseStop = false;
              resetLogo();
              Log.w(LOG, "#### not repeating the logo anim anymore");
            }
          }

          @Override
          public void onAnimationCancel(Animator animation) {}

          @Override
          public void onAnimationRepeat(Animator animation) {}
        });
    // logoAnimator.start();
    // flashAccuracy();
  }
Example #18
0
  private ObjectAnimator buildOpeningAnimation() {
    ObjectAnimator rotationAnimator =
        initAnimator(
            ObjectAnimator.ofFloat(
                mGuillotineView, ROTATION, GUILLOTINE_CLOSED_ANGLE, GUILLOTINE_OPENED_ANGLE));
    rotationAnimator.setInterpolator(mInterpolator);
    rotationAnimator.setDuration(mDuration);
    rotationAnimator.addListener(
        new Animator.AnimatorListener() {
          @Override
          public void onAnimationStart(Animator animation) {
            mGuillotineView.setVisibility(View.VISIBLE);
            isOpening = true;
          }

          @Override
          public void onAnimationEnd(Animator animation) {
            isOpening = false;
            if (mListener != null) {
              mListener.onGuillotineOpened();
            }
          }

          @Override
          public void onAnimationCancel(Animator animation) {}

          @Override
          public void onAnimationRepeat(Animator animation) {}
        });
    return rotationAnimator;
  }
  /** 下落 */
  public void freeFall() {

    ObjectAnimator objectAnimator =
        ObjectAnimator.ofFloat(shapeLoadingView, "translationY", 0, mDistance);
    ObjectAnimator scaleIndication = ObjectAnimator.ofFloat(indicationIm, "scaleX", 1, 0.2f);

    objectAnimator.setDuration(ANIMATION_DURATION);
    objectAnimator.setInterpolator(new AccelerateInterpolator());
    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.setDuration(ANIMATION_DURATION);
    animatorSet.playTogether(objectAnimator, scaleIndication);
    animatorSet.addListener(
        new Animator.AnimatorListener() {
          @Override
          public void onAnimationStart(Animator animation) {}

          @Override
          public void onAnimationEnd(Animator animation) {

            shapeLoadingView.changeShape();
            upThrow();
          }

          @Override
          public void onAnimationCancel(Animator animation) {}

          @Override
          public void onAnimationRepeat(Animator animation) {}
        });
    animatorSet.start();
  }
Example #20
0
  private ObjectAnimator buildClosingAnimation() {
    ObjectAnimator rotationAnimator =
        initAnimator(
            ObjectAnimator.ofFloat(
                mGuillotineView, ROTATION, GUILLOTINE_OPENED_ANGLE, GUILLOTINE_CLOSED_ANGLE));
    rotationAnimator.setDuration((long) (mDuration * GuillotineInterpolator.ROTATION_TIME));
    rotationAnimator.addListener(
        new Animator.AnimatorListener() {
          @Override
          public void onAnimationStart(Animator animation) {
            isClosing = true;
            mGuillotineView.setVisibility(View.VISIBLE);
          }

          @Override
          public void onAnimationEnd(Animator animation) {
            isClosing = false;
            mGuillotineView.setVisibility(View.GONE);
            startActionBarAnimation();

            if (mListener != null) {
              mListener.onGuillotineClosed();
            }
          }

          @Override
          public void onAnimationCancel(Animator animation) {}

          @Override
          public void onAnimationRepeat(Animator animation) {}
        });
    return rotationAnimator;
  }
 public void a()
 {
   hph localhph = a;
   ObjectAnimator localObjectAnimator = ObjectAnimator.ofPropertyValuesHolder(this, new PropertyValuesHolder[] { PropertyValuesHolder.ofFloat("alpha", new float[] { 0.0F, 1.0F }), PropertyValuesHolder.ofFloat("translationY", new float[] { getHeight(), 0.0F }) });
   localObjectAnimator.addListener(new hpr(this));
   localhph.a(localObjectAnimator);
 }
Example #22
0
 public void setAnimation(View view) {
   animatorSet.playTogether(
       new Animator[] {
         ObjectAnimator.ofFloat(view, "scaleX", new float[] {1.0F, 1.5F}),
         ObjectAnimator.ofFloat(view, "scaleY", new float[] {1.0F, 1.5F})
       });
 }
 @Override
 public void prepare(View target) {
   getAnimatorAgent()
       .playTogether(
           ObjectAnimator.ofFloat(target, "alpha", 0, 1),
           ObjectAnimator.ofFloat(target, "translationY", -target.getHeight() / 4, 0));
 }
  /** 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;
  }
Example #25
0
  private void startAnimation(View img, final Intent intent) {
    // ObjectAnimator oaTranslationX = ObjectAnimator.ofFloat(img,
    // "translationX", 0, mScreenWidth / 2);
    // ObjectAnimator oaTranslationY = ObjectAnimator.ofFloat(img,
    // "translationY", 0, mScreenHeight / 2);
    ObjectAnimator oaScaleX = ObjectAnimator.ofFloat(img, "scaleX", 0.5f, 1.2f, 1f);
    ObjectAnimator oaScaleY = ObjectAnimator.ofFloat(img, "scaleY", 0.5f, 1.2f, 1f);

    // oaTranslationX.setDuration(1000);
    // oaTranslationY.setDuration(1000);
    // oaScaleX.setDuration(1000);
    // oaScaleY.setDuration(1000);
    AnimatorSet set = new AnimatorSet();
    set.addListener(
        new AnimatorListenerAdapter() {
          @Override
          public void onAnimationStart(Animator animation) {
            isLocked = true;
            super.onAnimationStart(animation);
          }

          @Override
          public void onAnimationEnd(Animator animation) {
            Log.e("", "动画完成");
            isLocked = false;

            startActivity(intent);
          }
        });
    set.play(oaScaleX).with(oaScaleY);
    set.setDuration(500);
    if (!isLocked) {
      set.start();
    }
  }
  private void createDefaultIconAnimation() {
    ObjectAnimator collapseAnimator =
        ObjectAnimator.ofFloat(
            mImageToggle,
            "rotation",
            mLabelsPosition == LABELS_POSITION_LEFT
                ? OPENED_PLUS_ROTATION_LEFT
                : OPENED_PLUS_ROTATION_RIGHT,
            CLOSED_PLUS_ROTATION);

    ObjectAnimator expandAnimator =
        ObjectAnimator.ofFloat(
            mImageToggle,
            "rotation",
            CLOSED_PLUS_ROTATION,
            mLabelsPosition == LABELS_POSITION_LEFT
                ? OPENED_PLUS_ROTATION_LEFT
                : OPENED_PLUS_ROTATION_RIGHT);

    mOpenAnimatorSet.play(expandAnimator);
    mCloseAnimatorSet.play(collapseAnimator);

    mOpenAnimatorSet.setInterpolator(mOpenInterpolator);
    mCloseAnimatorSet.setInterpolator(mCloseInterpolator);

    mOpenAnimatorSet.setDuration(ANIMATION_DURATION);
    mCloseAnimatorSet.setDuration(ANIMATION_DURATION);
  }
Example #27
0
 void hide() {
   Xlog.i(TAG, "bottom bar hide(), showing: " + mShowing);
   if (mUseQuickControls || mUseFullScreen) {
     cancelBottomBarAnimation();
     int visibleHeight = getVisibleBottomHeight();
     float startPos = getTranslationY();
     this.setLayerType(View.LAYER_TYPE_HARDWARE, null);
     mBottomBarAnimator =
         ObjectAnimator.ofFloat(this, "translationY", startPos, startPos + visibleHeight);
     mBottomBarAnimator.addListener(mHideBottomBarAnimatorListener);
     setupBottomBarAnimator(mBottomBarAnimator);
     mBottomBarAnimator.start();
     this.setVisibility(View.GONE);
     mShowing = false;
     return;
   } else {
     this.setVisibility(View.VISIBLE);
     cancelBottomBarAnimation();
     int visibleHeight = getVisibleBottomHeight();
     float startPos = getTranslationY();
     Xlog.i(TAG, "hide(): visibleHeight: " + visibleHeight);
     Xlog.i(TAG, "hide(): startPos: " + startPos);
     this.setLayerType(View.LAYER_TYPE_HARDWARE, null);
     mBottomBarAnimator =
         ObjectAnimator.ofFloat(this, "translationY", startPos, startPos + visibleHeight);
     mBottomBarAnimator.addListener(mHideBottomBarAnimatorListener);
     setupBottomBarAnimator(mBottomBarAnimator);
     mBottomBarAnimator.start();
   }
   mShowing = false;
 }
 public static Animator createIndeterminateRotation(Object paramObject) {
   paramObject = ObjectAnimator.ofFloat(paramObject, "rotation", new float[] {0.0F, 720.0F});
   ((ObjectAnimator) paramObject).setDuration(6665L);
   ((ObjectAnimator) paramObject).setInterpolator(Interpolators.LINEAR.INSTANCE);
   ((ObjectAnimator) paramObject).setRepeatCount(-1);
   return (Animator) paramObject;
 }
  public void animateClosed() {
    if (!(getParent() instanceof DragLayer)) return;
    PropertyValuesHolder alpha = PropertyValuesHolder.ofFloat("alpha", 0);
    PropertyValuesHolder scaleX = PropertyValuesHolder.ofFloat("scaleX", 0.9f);
    PropertyValuesHolder scaleY = PropertyValuesHolder.ofFloat("scaleY", 0.9f);
    final ObjectAnimator oa = LauncherAnimUtils.ofPropertyValuesHolder(this, alpha, scaleX, scaleY);

    oa.addListener(
        new AnimatorListenerAdapter() {
          @Override
          public void onAnimationEnd(Animator animation) {
            onCloseComplete();
            setLayerType(LAYER_TYPE_NONE, null);
            mState = STATE_SMALL;
          }

          @Override
          public void onAnimationStart(Animator animation) {
            sendCustomAccessibilityEvent(
                AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED,
                getContext().getString(R.string.folder_closed));
            mState = STATE_ANIMATING;
          }
        });
    oa.setDuration(mExpandDuration);
    setLayerType(LAYER_TYPE_HARDWARE, null);
    oa.start();
  }
Example #30
0
  /** Show post-send animation */
  public void showPostSend() {
    if (!mAttached) {
      return;
    }

    mSlowSendAnimator.cancel();
    mTextHint.setVisibility(View.GONE);

    float currentScale = mScreenshotView.getScaleX();

    // Modify the fast clone parameters to match the current scale
    PropertyValuesHolder postX =
        PropertyValuesHolder.ofFloat("scaleX", new float[] {currentScale, 0.0f});
    PropertyValuesHolder postY =
        PropertyValuesHolder.ofFloat("scaleY", new float[] {currentScale, 0.0f});
    PropertyValuesHolder alpha = PropertyValuesHolder.ofFloat("alpha", new float[] {1.0f, 0.0f});
    mFastCloneAnimator.setValues(postX, postY, alpha);

    // Modify the fadeIn parameters to match the current scale
    PropertyValuesHolder fadeIn = PropertyValuesHolder.ofFloat("alpha", new float[] {0.0f, 1.0f});
    mFadeInAnimator.setValues(fadeIn);

    if (mFireflyRenderThread != null) {
      mFireflyRenderThread.fadeOut();
    }

    mSuccessAnimatorSet.start();
  }