Search in sources :

Example 66 with ViewPropertyAnimator

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

the class RecentsPanelView method animateInIconOfFirstTask.

private void animateInIconOfFirstTask() {
    if (mItemToAnimateInWhenWindowAnimationIsFinished != null && !mRecentTasksLoader.isFirstScreenful()) {
        int timeSinceWindowAnimation = (int) (System.currentTimeMillis() - mWindowAnimationStartTime);
        final int minStartDelay = 150;
        final int startDelay = Math.max(0, Math.min(minStartDelay - timeSinceWindowAnimation, minStartDelay));
        final int duration = 250;
        final ViewHolder holder = mItemToAnimateInWhenWindowAnimationIsFinished;
        final TimeInterpolator cubic = new DecelerateInterpolator(1.5f);
        FirstFrameAnimatorHelper.initializeDrawListener(holder.iconView);
        for (View v : new View[] { holder.iconView, holder.labelView, holder.calloutLine }) {
            if (v != null) {
                ViewPropertyAnimator vpa = v.animate().translationX(0).translationY(0).alpha(1f).setStartDelay(startDelay).setDuration(duration).setInterpolator(cubic);
                FirstFrameAnimatorHelper h = new FirstFrameAnimatorHelper(vpa, v);
            }
        }
        mItemToAnimateInWhenWindowAnimationIsFinished = null;
        mAnimateIconOfFirstTask = false;
    }
}
Also used : DecelerateInterpolator(android.view.animation.DecelerateInterpolator) TimeInterpolator(android.animation.TimeInterpolator) ImageView(android.widget.ImageView) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) ViewPropertyAnimator(android.view.ViewPropertyAnimator)

Example 67 with ViewPropertyAnimator

use of android.view.ViewPropertyAnimator in project platform_frameworks_base by android.

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 68 with ViewPropertyAnimator

use of android.view.ViewPropertyAnimator in project wire-android by wireapp.

the class SingleImageFragment method backToConversation.

private void backToConversation(boolean afterFling) {
    if (isClosing) {
        return;
    }
    isClosing = true;
    loadClickedImageSizeAndPosition();
    initAnimatingImageView(afterFling);
    getControllerFactory().getSingleImageController().hideSingleImage();
    fadeControls(false);
    PointF currentFocusPoint = messageTouchImageView.getScrollPosition();
    if (currentFocusPoint == null) {
        getControllerFactory().getSingleImageController().clearReferences();
        getFragmentManager().popBackStack();
        return;
    }
    TouchImageView.FocusAndScale startFocusAndScale = new TouchImageView.FocusAndScale(currentFocusPoint.x, currentFocusPoint.y, messageTouchImageView.getCurrentZoom());
    TouchImageView.FocusAndScale finishFocusAndScale = new TouchImageView.FocusAndScale(0.5f, 0.5f, 1f);
    if ((MathUtils.floatEqual(currentFocusPoint.x, 0.5f) || MathUtils.floatEqual(currentFocusPoint.y, 0.5f)) && MathUtils.floatEqual(messageTouchImageView.getCurrentZoom(), 1f)) {
        zoomOutAndRotateBackOnCloseDuration = 1;
    }
    ObjectAnimator.ofObject(messageTouchImageView, "focusAndScale", new TouchImageView.FocusAndScaleEvaluator(), startFocusAndScale, finishFocusAndScale).setDuration(zoomOutAndRotateBackOnCloseDuration).start();
    final boolean imageOffScreenInList = getControllerFactory().getSingleImageController().isContainerOutOfScreen();
    ViewPropertyAnimator exitAnimation = animatingImageView.animate();
    if (imageOffScreenInList) {
        exitAnimation.alpha(0);
    } else {
        exitAnimation.x(clickedImageLocation.x).y(clickedImageLocation.y).rotation(0f).scaleX(1f).scaleY(1f);
    }
    exitAnimation.setDuration(openAnimationDuration).setStartDelay(zoomOutAndRotateBackOnCloseDuration).setInterpolator(new Expo.EaseOut()).withStartAction(new Runnable() {

        @Override
        public void run() {
            animatingImageView.setVisibility(View.VISIBLE);
            messageTouchImageView.setVisibility(View.GONE);
            if (imageOffScreenInList) {
                getControllerFactory().getSingleImageController().getImageContainer().setVisibility(View.VISIBLE);
            } else {
                getControllerFactory().getSingleImageController().getImageContainer().setVisibility(View.INVISIBLE);
            }
        }
    }).withEndAction(new Runnable() {

        @Override
        public void run() {
            getControllerFactory().getSingleImageController().getImageContainer().setVisibility(View.VISIBLE);
            getControllerFactory().getSingleImageController().clearReferences();
            getFragmentManager().popBackStack();
        }
    });
    exitAnimation.start();
    background.animate().alpha(0f).setStartDelay(zoomOutAndRotateBackOnCloseDuration + closeAnimationBackgroundDelay).setDuration(openAnimationBackgroundDuration).setInterpolator(new Quart.EaseOut()).start();
}
Also used : Expo(com.waz.zclient.ui.animation.interpolators.penner.Expo) PointF(android.graphics.PointF) TouchImageView(com.waz.zclient.views.images.TouchImageView) ViewPropertyAnimator(android.view.ViewPropertyAnimator)

Example 69 with ViewPropertyAnimator

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

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 70 with ViewPropertyAnimator

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

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)

Aggregations

ViewPropertyAnimator (android.view.ViewPropertyAnimator)104 Animator (android.animation.Animator)59 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)36 View (android.view.View)30 ValueAnimator (android.animation.ValueAnimator)23 ObjectAnimator (android.animation.ObjectAnimator)11 RecyclerView (androidx.recyclerview.widget.RecyclerView)9 AnimatorListener (android.animation.Animator.AnimatorListener)8 SimpleItemAnimator (androidx.recyclerview.widget.SimpleItemAnimator)7 SimpleItemAnimator (android.support.v7.widget.SimpleItemAnimator)4 ViewGroup (android.view.ViewGroup)4 ImageView (android.widget.ImageView)4 FastOutSlowInInterpolator (androidx.interpolator.view.animation.FastOutSlowInInterpolator)4 ProgressCardView (org.wikipedia.feed.progress.ProgressCardView)4 Paint (android.graphics.Paint)3 ViewTreeObserver (android.view.ViewTreeObserver)3 AccelerateDecelerateInterpolator (android.view.animation.AccelerateDecelerateInterpolator)3 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)3 DialogCell (org.telegram.ui.Cells.DialogCell)3 Point (android.graphics.Point)2