Search in sources :

Example 66 with AnimatorListenerAdapter

use of android.animation.AnimatorListenerAdapter in project mortar by square.

the class SimplePathContainer method runAnimation.

private void runAnimation(final ViewGroup container, final View from, final View to, Flow.Direction direction, final Flow.TraversalCallback callback) {
    Animator animator = createSegue(from, to, direction);
    animator.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            container.removeView(from);
            callback.onTraversalCompleted();
        }
    });
    animator.start();
}
Also used : ObjectAnimator(android.animation.ObjectAnimator) Animator(android.animation.Animator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter)

Example 67 with AnimatorListenerAdapter

use of android.animation.AnimatorListenerAdapter in project TwinklingRefreshLayout by lcodecorex.

the class AnimProcessor method animHeadHideByVy.

/**
     * 5.当刷新处于可见状态,向上滑动屏幕时,隐藏刷新控件
     *
     * @param vy 手指向上滑动速度
     */
public void animHeadHideByVy(int vy) {
    isAnimHeadHide = true;
    cp.onRefreshCanceled();
    vy = Math.abs(vy);
    if (vy < 5000)
        vy = 8000;
    animLayoutByTime(getVisibleHeadHeight(), 0, 5 * Math.abs(getVisibleHeadHeight() * 1000 / vy), animHeadUpListener, new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            isAnimHeadHide = false;
            cp.resetHeaderView();
        }
    });
}
Also used : Animator(android.animation.Animator) ValueAnimator(android.animation.ValueAnimator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter)

Example 68 with AnimatorListenerAdapter

use of android.animation.AnimatorListenerAdapter in project TwinklingRefreshLayout by lcodecorex.

the class AnimProcessor method animBottomHideByVy.

/**
     * 6.当加载更多处于可见状态时,向下滑动屏幕,隐藏加载更多控件
     *
     * @param vy 手指向下滑动的速度
     */
public void animBottomHideByVy(int vy) {
    isAnimBottomHide = true;
    cp.onLoadmoreCanceled();
    vy = Math.abs(vy);
    if (vy < 5000)
        vy = 8000;
    animLayoutByTime(getVisibleFootHeight(), 0, 5 * getVisibleFootHeight() * 1000 / vy, animBottomUpListener, new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            isAnimBottomHide = false;
            cp.resetBottomView();
        }
    });
}
Also used : Animator(android.animation.Animator) ValueAnimator(android.animation.ValueAnimator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter)

Example 69 with AnimatorListenerAdapter

use of android.animation.AnimatorListenerAdapter in project TwinklingRefreshLayout by lcodecorex.

the class AnimProcessor method animOverScrollBottom.

/**
     * 8.执行底部越界
     *
     * @param vy           满足越界条件的手指滑动速度
     * @param computeTimes 从满足条件到滚动到顶部总共计算的次数
     */
public void animOverScrollBottom(float vy, int computeTimes) {
    if (isOverScrollBottomLocked)
        return;
    cp.setStatePBU();
    int oh = (int) Math.abs(vy / computeTimes / 2);
    final int overHeight = oh > cp.getOsHeight() ? cp.getOsHeight() : oh;
    final int time = overHeight <= 50 ? 115 : (int) (0.3 * overHeight + 100);
    if (cp.autoLoadMore()) {
        cp.startLoadMore();
    } else {
        isOverScrollBottomLocked = true;
        isAnimOsBottom = true;
        animLayoutByTime(0, overHeight, time, overScrollBottomUpListener, new AnimatorListenerAdapter() {

            @Override
            public void onAnimationEnd(Animator animation) {
                animLayoutByTime(overHeight, 0, 2 * time, overScrollBottomUpListener, new AnimatorListenerAdapter() {

                    @Override
                    public void onAnimationEnd(Animator animation) {
                        isAnimOsBottom = false;
                        isOverScrollBottomLocked = false;
                    }
                });
            }
        });
    }
}
Also used : Animator(android.animation.Animator) ValueAnimator(android.animation.ValueAnimator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter)

Example 70 with AnimatorListenerAdapter

use of android.animation.AnimatorListenerAdapter in project NotificationPeekPort by lzanita09.

the class EverythingCard method hideOptions.

private void hideOptions() {
    if (!mOptionsShowing) {
        return;
    }
    mQuietHour.reset();
    if (mPanelSwitcher.getDisplayedChild() == 1) {
        mPanelSwitcher.showPrevious();
    }
    final int originalHeight = mPanelSwitcher.getHeight();
    ValueAnimator animator = ValueAnimator.ofInt(mPanelSwitcher.getHeight(), 0);
    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            ViewGroup.LayoutParams params = mPanelSwitcher.getLayoutParams();
            params.height = (Integer) animation.getAnimatedValue();
            mPanelSwitcher.setLayoutParams(params);
        }
    });
    animator.setDuration(ANIM_DURATION);
    animator.setInterpolator(new DecelerateInterpolator());
    animator.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            mPanelSwitcher.setVisibility(GONE);
            ViewGroup.LayoutParams params = mPanelSwitcher.getLayoutParams();
            params.height = originalHeight;
            mPanelSwitcher.setLayoutParams(params);
            mFromBtn.setText(getContext().getString(R.string.from));
            mToBtn.setText(getContext().getString(R.string.to));
        }
    });
    animator.start();
    mOptionsShowing = false;
}
Also used : DecelerateInterpolator(android.view.animation.DecelerateInterpolator) Animator(android.animation.Animator) 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