Search in sources :

Example 26 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 27 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 28 with ViewPropertyAnimator

use of android.view.ViewPropertyAnimator in project Genius-Android by qiujuer.

the class BalloonMarker method onOpeningComplete.

@Override
public void onOpeningComplete() {
    mNumber.setVisibility(View.VISIBLE);
    ViewPropertyAnimator animator = mNumber.animate();
    animator.alpha(1f);
    animator.setDuration(100);
    animator.start();
    if (getParent() instanceof BalloonMarkerDrawable.MarkerAnimationListener) {
        ((BalloonMarkerDrawable.MarkerAnimationListener) getParent()).onOpeningComplete();
    }
}
Also used : ViewPropertyAnimator(android.view.ViewPropertyAnimator)

Example 29 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)

Example 30 with ViewPropertyAnimator

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

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)32 Animator (android.animation.Animator)11 View (android.view.View)4 AccelerateDecelerateInterpolator (android.view.animation.AccelerateDecelerateInterpolator)3 ImageView (android.widget.ImageView)3 ViewTreeObserver (android.view.ViewTreeObserver)2 TextView (android.widget.TextView)2 AnimatorListener (android.animation.Animator.AnimatorListener)1 TimeInterpolator (android.animation.TimeInterpolator)1 TargetApi (android.annotation.TargetApi)1 PointF (android.graphics.PointF)1 Nullable (android.support.annotation.Nullable)1 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)1 AdapterView (android.widget.AdapterView)1 LayoutHelper (com.alibaba.android.vlayout.LayoutHelper)1 BaseLayoutHelper (com.alibaba.android.vlayout.layout.BaseLayoutHelper)1 FixAreaLayoutHelper (com.alibaba.android.vlayout.layout.FixAreaLayoutHelper)1 MarginLayoutHelper (com.alibaba.android.vlayout.layout.MarginLayoutHelper)1 AnimatorAdapter (com.saulmm.material.utils.AnimatorAdapter)1 CardSupport (com.tmall.wireless.tangram.support.CardSupport)1