Search in sources :

Example 1 with ViewPropertyAnimator

use of android.view.ViewPropertyAnimator in project android_frameworks_base by DirtyUnicorns.

the class RecentsView method onBusEvent.

public final void onBusEvent(DraggingInRecentsEndedEvent event) {
    ViewPropertyAnimator animator = animate();
    if (event.velocity > mFlingAnimationUtils.getMinVelocityPxPerSecond()) {
        animator.translationY(getHeight());
        animator.withEndAction(new Runnable() {

            @Override
            public void run() {
                WindowManagerProxy.getInstance().maximizeDockedStack();
            }
        });
        mFlingAnimationUtils.apply(animator, getTranslationY(), getHeight(), event.velocity);
    } else {
        animator.translationY(0f);
        animator.setListener(null);
        mFlingAnimationUtils.apply(animator, getTranslationY(), 0, event.velocity);
    }
    animator.start();
}
Also used : ViewPropertyAnimator(android.view.ViewPropertyAnimator)

Example 2 with ViewPropertyAnimator

use of android.view.ViewPropertyAnimator in project LookLook by xinghongfei.

the class Fabbehavior method show.

//显示时的动画
private void show(final View view) {
    ViewPropertyAnimator animator = view.animate().translationY(0).setInterpolator(INTERPOLATOR).setDuration(200);
    animator.setListener(new Animator.AnimatorListener() {

        @Override
        public void onAnimationStart(Animator animator) {
            view.setVisibility(View.VISIBLE);
            isAnimate = true;
        }

        @Override
        public void onAnimationEnd(Animator animator) {
            isAnimate = false;
        }

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

        @Override
        public void onAnimationRepeat(Animator animator) {
        }
    });
    animator.start();
}
Also used : Animator(android.animation.Animator) ViewPropertyAnimator(android.view.ViewPropertyAnimator) ViewPropertyAnimator(android.view.ViewPropertyAnimator)

Example 3 with ViewPropertyAnimator

use of android.view.ViewPropertyAnimator in project LookLook by xinghongfei.

the class Fabbehavior method hide.

//隐藏时的动画
private void hide(final View view) {
    ViewPropertyAnimator animator = view.animate().translationY(viewY).setInterpolator(INTERPOLATOR).setDuration(200);
    animator.setListener(new Animator.AnimatorListener() {

        @Override
        public void onAnimationStart(Animator animator) {
            isAnimate = true;
        }

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

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

        @Override
        public void onAnimationRepeat(Animator animator) {
        }
    });
    animator.start();
}
Also used : Animator(android.animation.Animator) ViewPropertyAnimator(android.view.ViewPropertyAnimator) ViewPropertyAnimator(android.view.ViewPropertyAnimator)

Example 4 with ViewPropertyAnimator

use of android.view.ViewPropertyAnimator in project GitTest by xiaoxige.

the class TitleChanger method doChange.

private void doChange(final long now, final CalendarDay currentMonth, boolean animate) {
    title.animate().cancel();
    doTranslation(title, 0);
    title.setAlpha(1);
    lastAnimTime = now;
    final CharSequence newTitle = titleFormatter.format(currentMonth);
    if (!animate) {
        title.setText(newTitle);
    } else {
        final int translation = translate * (previousMonth.isBefore(currentMonth) ? 1 : -1);
        final ViewPropertyAnimator viewPropertyAnimator = title.animate();
        if (orientation == MaterialCalendarView.HORIZONTAL) {
            viewPropertyAnimator.translationX(translation * -1);
        } else {
            viewPropertyAnimator.translationY(translation * -1);
        }
        viewPropertyAnimator.alpha(0).setDuration(animDuration).setInterpolator(interpolator).setListener(new AnimatorListener() {

            @Override
            public void onAnimationCancel(Animator animator) {
                doTranslation(title, 0);
                title.setAlpha(1);
            }

            @Override
            public void onAnimationEnd(Animator animator) {
                title.setText(newTitle);
                doTranslation(title, translation);
                final ViewPropertyAnimator viewPropertyAnimator = title.animate();
                if (orientation == MaterialCalendarView.HORIZONTAL) {
                    viewPropertyAnimator.translationX(0);
                } else {
                    viewPropertyAnimator.translationY(0);
                }
                viewPropertyAnimator.alpha(1).setDuration(animDuration).setInterpolator(interpolator).setListener(new AnimatorListener()).start();
            }
        }).start();
    }
    previousMonth = currentMonth;
}
Also used : Animator(android.animation.Animator) ViewPropertyAnimator(android.view.ViewPropertyAnimator) ViewPropertyAnimator(android.view.ViewPropertyAnimator)

Example 5 with ViewPropertyAnimator

use of android.view.ViewPropertyAnimator in project MTweaks-KernelAdiutorMOD by morogoku.

the class FrequencyButtonView method rotate.

private void rotate(final View v, boolean reverse) {
    ViewPropertyAnimator animator = v.animate().setDuration(500).rotation(reverse ? -360 : 360);
    animator.setListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            v.setRotation(0);
        }
    });
    animator.start();
}
Also used : Animator(android.animation.Animator) ViewPropertyAnimator(android.view.ViewPropertyAnimator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) ViewPropertyAnimator(android.view.ViewPropertyAnimator)

Aggregations

ViewPropertyAnimator (android.view.ViewPropertyAnimator)64 Animator (android.animation.Animator)31 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)13 View (android.view.View)10 AnimatorListener (android.animation.Animator.AnimatorListener)7 ValueAnimator (android.animation.ValueAnimator)7 ObjectAnimator (android.animation.ObjectAnimator)4 SimpleItemAnimator (android.support.v7.widget.SimpleItemAnimator)4 ImageView (android.widget.ImageView)4 ProgressCardView (org.wikipedia.feed.progress.ProgressCardView)4 ViewTreeObserver (android.view.ViewTreeObserver)3 AccelerateDecelerateInterpolator (android.view.animation.AccelerateDecelerateInterpolator)3 Point (android.graphics.Point)2 Nullable (android.support.annotation.Nullable)2 AccelerateInterpolator (android.view.animation.AccelerateInterpolator)2 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)2 AdapterView (android.widget.AdapterView)2 TextView (android.widget.TextView)2 LayoutHelper (com.alibaba.android.vlayout.LayoutHelper)2 BaseLayoutHelper (com.alibaba.android.vlayout.layout.BaseLayoutHelper)2