Search in sources :

Example 51 with AnimatorListenerAdapter

use of android.animation.AnimatorListenerAdapter in project platform_frameworks_base by android.

the class TaskStackAnimationHelper method startDeleteTaskAnimation.

/**
     * Starts the delete animation for the specified {@link TaskView}.
     */
public void startDeleteTaskAnimation(final TaskView deleteTaskView, final ReferenceCountedTrigger postAnimationTrigger) {
    TaskStackViewTouchHandler touchHandler = mStackView.getTouchHandler();
    touchHandler.onBeginManualDrag(deleteTaskView);
    postAnimationTrigger.increment();
    postAnimationTrigger.addLastDecrementRunnable(() -> {
        touchHandler.onChildDismissed(deleteTaskView);
    });
    final float dismissSize = touchHandler.getScaledDismissSize();
    ValueAnimator animator = ValueAnimator.ofFloat(0f, 1f);
    animator.setDuration(400);
    animator.addUpdateListener((animation) -> {
        float progress = (Float) animation.getAnimatedValue();
        deleteTaskView.setTranslationX(progress * dismissSize);
        touchHandler.updateSwipeProgress(deleteTaskView, true, progress);
    });
    animator.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            postAnimationTrigger.decrement();
        }
    });
    animator.start();
}
Also used : Animator(android.animation.Animator) ValueAnimator(android.animation.ValueAnimator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) ValueAnimator(android.animation.ValueAnimator)

Example 52 with AnimatorListenerAdapter

use of android.animation.AnimatorListenerAdapter in project platform_frameworks_base by android.

the class ScrimController method startScrimAnimation.

private void startScrimAnimation(final View scrim, float target) {
    float current = getCurrentScrimAlpha(scrim);
    ValueAnimator anim = ValueAnimator.ofFloat(current, target);
    anim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            float alpha = (float) animation.getAnimatedValue();
            setCurrentScrimAlpha(scrim, alpha);
            updateScrimColor(scrim);
        }
    });
    anim.setInterpolator(getInterpolator());
    anim.setStartDelay(mAnimationDelay);
    anim.setDuration(mDurationOverride != -1 ? mDurationOverride : ANIMATION_DURATION);
    anim.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            if (mOnAnimationFinished != null) {
                mOnAnimationFinished.run();
                mOnAnimationFinished = null;
            }
            if (mKeyguardFadingOutInProgress) {
                mKeyguardFadeoutAnimation = null;
                mKeyguardFadingOutInProgress = false;
            }
            scrim.setTag(TAG_KEY_ANIM, null);
            scrim.setTag(TAG_KEY_ANIM_TARGET, null);
        }
    });
    anim.start();
    if (mAnimateKeyguardFadingOut) {
        mKeyguardFadingOutInProgress = true;
        mKeyguardFadeoutAnimation = anim;
    }
    if (mSkipFirstFrame) {
        anim.setCurrentPlayTime(16);
    }
    scrim.setTag(TAG_KEY_ANIM, anim);
    scrim.setTag(TAG_KEY_ANIM_TARGET, target);
}
Also used : Animator(android.animation.Animator) StackStateAnimator(com.android.systemui.statusbar.stack.StackStateAnimator) ValueAnimator(android.animation.ValueAnimator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) ValueAnimator(android.animation.ValueAnimator)

Example 53 with AnimatorListenerAdapter

use of android.animation.AnimatorListenerAdapter in project platform_frameworks_base by android.

the class KeyguardUserSwitcher method startAppearAnimation.

private void startAppearAnimation() {
    int count = mUserSwitcher.getChildCount();
    View[] objects = new View[count];
    for (int i = 0; i < count; i++) {
        objects[i] = mUserSwitcher.getChildAt(i);
    }
    mUserSwitcher.setClipChildren(false);
    mUserSwitcher.setClipToPadding(false);
    mAppearAnimationUtils.startAnimation(objects, new Runnable() {

        @Override
        public void run() {
            mUserSwitcher.setClipChildren(true);
            mUserSwitcher.setClipToPadding(true);
        }
    });
    mAnimating = true;
    mBgAnimator = ObjectAnimator.ofInt(mBackground, "alpha", 0, 255);
    mBgAnimator.setDuration(400);
    mBgAnimator.setInterpolator(Interpolators.ALPHA_IN);
    mBgAnimator.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            mBgAnimator = null;
            mAnimating = false;
        }
    });
    mBgAnimator.start();
}
Also used : ObjectAnimator(android.animation.ObjectAnimator) Animator(android.animation.Animator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) UserDetailItemView(com.android.systemui.qs.tiles.UserDetailItemView) NotificationPanelView(com.android.systemui.statusbar.phone.NotificationPanelView) View(android.view.View) KeyguardStatusBarView(com.android.systemui.statusbar.phone.KeyguardStatusBarView)

Example 54 with AnimatorListenerAdapter

use of android.animation.AnimatorListenerAdapter in project platform_frameworks_base by android.

the class PanelView method startUnlockHintAnimationPhase1.

/**
     * Phase 1: Move everything upwards.
     */
private void startUnlockHintAnimationPhase1(final Runnable onAnimationFinished) {
    float target = Math.max(0, getMaxPanelHeight() - mHintDistance);
    ValueAnimator animator = createHeightAnimator(target);
    animator.setDuration(250);
    animator.setInterpolator(Interpolators.FAST_OUT_SLOW_IN);
    animator.addListener(new AnimatorListenerAdapter() {

        private boolean mCancelled;

        @Override
        public void onAnimationCancel(Animator animation) {
            mCancelled = true;
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            if (mCancelled) {
                mHeightAnimator = null;
                onAnimationFinished.run();
            } else {
                startUnlockHintAnimationPhase2(onAnimationFinished);
            }
        }
    });
    animator.start();
    mHeightAnimator = animator;
    mKeyguardBottomArea.getIndicationView().animate().translationY(-mHintDistance).setDuration(250).setInterpolator(Interpolators.FAST_OUT_SLOW_IN).withEndAction(new Runnable() {

        @Override
        public void run() {
            mKeyguardBottomArea.getIndicationView().animate().translationY(0).setDuration(450).setInterpolator(mBounceInterpolator).start();
        }
    }).start();
}
Also used : Animator(android.animation.Animator) ObjectAnimator(android.animation.ObjectAnimator) ValueAnimator(android.animation.ValueAnimator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) ValueAnimator(android.animation.ValueAnimator)

Example 55 with AnimatorListenerAdapter

use of android.animation.AnimatorListenerAdapter in project platform_frameworks_base by android.

the class PanelView method startUnlockHintAnimationPhase2.

/**
     * Phase 2: Bounce down.
     */
private void startUnlockHintAnimationPhase2(final Runnable onAnimationFinished) {
    ValueAnimator animator = createHeightAnimator(getMaxPanelHeight());
    animator.setDuration(450);
    animator.setInterpolator(mBounceInterpolator);
    animator.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            mHeightAnimator = null;
            onAnimationFinished.run();
            notifyBarPanelExpansionChanged();
        }
    });
    animator.start();
    mHeightAnimator = animator;
}
Also used : Animator(android.animation.Animator) ObjectAnimator(android.animation.ObjectAnimator) ValueAnimator(android.animation.ValueAnimator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) ValueAnimator(android.animation.ValueAnimator)

Aggregations

Animator (android.animation.Animator)868 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)868 ObjectAnimator (android.animation.ObjectAnimator)464 ValueAnimator (android.animation.ValueAnimator)459 AnimatorSet (android.animation.AnimatorSet)144 View (android.view.View)131 ViewGroup (android.view.ViewGroup)92 PropertyValuesHolder (android.animation.PropertyValuesHolder)70 StackStateAnimator (com.android.systemui.statusbar.stack.StackStateAnimator)70 AnimatorUpdateListener (android.animation.ValueAnimator.AnimatorUpdateListener)62 ImageView (android.widget.ImageView)45 TextView (android.widget.TextView)43 Interpolator (android.view.animation.Interpolator)42 Paint (android.graphics.Paint)41 AccelerateInterpolator (android.view.animation.AccelerateInterpolator)41 Rect (android.graphics.Rect)40 RenderNodeAnimator (android.view.RenderNodeAnimator)36 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)36 TimeAnimator (android.animation.TimeAnimator)30 TargetApi (android.annotation.TargetApi)30