Search in sources :

Example 46 with ViewPropertyAnimator

use of android.view.ViewPropertyAnimator in project android_packages_apps_Snap by LineageOS.

the class PhotoMenu method animateFadeIn.

public void animateFadeIn(final ListView v) {
    ViewPropertyAnimator vp = v.animate();
    vp.alpha(1f).setDuration(ANIMATION_DURATION);
    vp.start();
}
Also used : ViewPropertyAnimator(android.view.ViewPropertyAnimator)

Example 47 with ViewPropertyAnimator

use of android.view.ViewPropertyAnimator in project android_packages_apps_Snap by LineageOS.

the class VideoMenu method animateFadeOut.

private void animateFadeOut(final ListView v, final int level) {
    if (v == null || mPopupStatus == POPUP_IN_ANIMATION_FADE)
        return;
    mPopupStatus = POPUP_IN_ANIMATION_FADE;
    ViewPropertyAnimator vp = v.animate();
    vp.alpha(0f).setDuration(ANIMATION_DURATION);
    vp.setListener(new AnimatorListener() {

        @Override
        public void onAnimationStart(Animator animation) {
        }

        @Override
        public void onAnimationRepeat(Animator animation) {
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            if (level == 1) {
                mUI.dismissLevel1();
                initializePopup();
                mPopupStatus = POPUP_NONE;
                mUI.cleanupListview();
            } else if (level == 2) {
                mUI.dismissLevel2();
                mPopupStatus = POPUP_FIRST_LEVEL;
            }
        }

        @Override
        public void onAnimationCancel(Animator animation) {
            if (level == 1) {
                mUI.dismissLevel1();
                initializePopup();
                mPopupStatus = POPUP_NONE;
                mUI.cleanupListview();
            } else if (level == 2) {
                mUI.dismissLevel2();
                mPopupStatus = POPUP_FIRST_LEVEL;
            }
        }
    });
    vp.start();
}
Also used : AnimatorListener(android.animation.Animator.AnimatorListener) Animator(android.animation.Animator) ViewPropertyAnimator(android.view.ViewPropertyAnimator) ViewPropertyAnimator(android.view.ViewPropertyAnimator)

Example 48 with ViewPropertyAnimator

use of android.view.ViewPropertyAnimator in project android_packages_apps_Snap by LineageOS.

the class VideoMenu method animateFadeIn.

public void animateFadeIn(final ListView v) {
    ViewPropertyAnimator vp = v.animate();
    vp.alpha(1f).setDuration(ANIMATION_DURATION);
    vp.start();
}
Also used : ViewPropertyAnimator(android.view.ViewPropertyAnimator)

Example 49 with ViewPropertyAnimator

use of android.view.ViewPropertyAnimator in project android_packages_apps_Dialer by MoKee.

the class CallCardFragment method doActionOnPredraw.

private void doActionOnPredraw(final boolean visible, final boolean isLayoutRtl, final View videoView, final float spaceBesideCallCard) {
    float videoViewTranslation = 0f;
    // Translate the call card to its pre-animation state.
    if (!mIsLandscape) {
        mPrimaryCallCardContainer.setTranslationY(visible ? -mPrimaryCallCardContainer.getHeight() : 0);
        ViewGroup.LayoutParams p = videoView.getLayoutParams();
        videoViewTranslation = p.height / 2 - spaceBesideCallCard / 2;
    }
    // Perform animation of video view.
    ViewPropertyAnimator videoViewAnimator = videoView.animate().setInterpolator(AnimUtils.EASE_OUT_EASE_IN).setDuration(mVideoAnimationDuration);
    if (mIsLandscape) {
        videoViewAnimator.translationX(visible ? videoViewTranslation : 0);
    } else {
        videoViewAnimator.translationY(visible ? videoViewTranslation : 0);
    }
    videoViewAnimator.start();
    // Animate the call card sliding.
    ViewPropertyAnimator callCardAnimator = mPrimaryCallCardContainer.animate().setInterpolator(AnimUtils.EASE_OUT_EASE_IN).setDuration(mVideoAnimationDuration).setListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            if (!visible) {
                mPrimaryCallCardContainer.setVisibility(View.GONE);
            }
        }

        @Override
        public void onAnimationStart(Animator animation) {
            super.onAnimationStart(animation);
            if (visible) {
                mPrimaryCallCardContainer.setVisibility(View.VISIBLE);
            }
        }
    });
    if (mIsLandscape) {
        float translationX = mPrimaryCallCardContainer.getWidth();
        translationX *= isLayoutRtl ? 1 : -1;
        callCardAnimator.translationX(visible ? 0 : translationX).start();
    } else {
        callCardAnimator.translationY(visible ? 0 : -mPrimaryCallCardContainer.getHeight()).start();
    }
}
Also used : Animator(android.animation.Animator) ObjectAnimator(android.animation.ObjectAnimator) ViewPropertyAnimator(android.view.ViewPropertyAnimator) ViewGroup(android.view.ViewGroup) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) ViewPropertyAnimator(android.view.ViewPropertyAnimator)

Example 50 with ViewPropertyAnimator

use of android.view.ViewPropertyAnimator in project apps-android-wikipedia by wikimedia.

the class FeedItemAnimator method animateMoveImpl.

void animateMoveImpl(final ViewHolder holder, int fromX, int fromY, int toX, int toY) {
    final View view = holder.itemView;
    final int deltaX = toX - fromX;
    final int deltaY = toY - fromY;
    if (deltaX != 0) {
        view.animate().translationX(0);
    }
    if (deltaY != 0) {
        view.animate().translationY(0);
    }
    // TODO: make EndActions end listeners instead, since end actions aren't called when
    // vpas are canceled (and can't end them. why?)
    // need listener functionality in VPACompat for this. Ick.
    final ViewPropertyAnimator animation = view.animate();
    mMoveAnimations.add(holder);
    animation.setDuration(getMoveDuration()).setListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationStart(Animator animator) {
            dispatchMoveStarting(holder);
        }

        @Override
        public void onAnimationCancel(Animator animator) {
            if (deltaX != 0) {
                view.setTranslationX(0);
            }
            if (deltaY != 0) {
                view.setTranslationY(0);
            }
        }

        @Override
        public void onAnimationEnd(Animator animator) {
            animation.setListener(null);
            dispatchMoveFinished(holder);
            mMoveAnimations.remove(holder);
            dispatchFinishedWhenDone();
        }
    }).start();
}
Also used : Animator(android.animation.Animator) ViewPropertyAnimator(android.view.ViewPropertyAnimator) ValueAnimator(android.animation.ValueAnimator) SimpleItemAnimator(android.support.v7.widget.SimpleItemAnimator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) View(android.view.View) ProgressCardView(org.wikipedia.feed.progress.ProgressCardView) ViewPropertyAnimator(android.view.ViewPropertyAnimator)

Aggregations

ViewPropertyAnimator (android.view.ViewPropertyAnimator)63 Animator (android.animation.Animator)31 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)13 View (android.view.View)9 AnimatorListener (android.animation.Animator.AnimatorListener)7 ValueAnimator (android.animation.ValueAnimator)7 ObjectAnimator (android.animation.ObjectAnimator)4 SimpleItemAnimator (android.support.v7.widget.SimpleItemAnimator)4 ProgressCardView (org.wikipedia.feed.progress.ProgressCardView)4 ViewTreeObserver (android.view.ViewTreeObserver)3 AccelerateDecelerateInterpolator (android.view.animation.AccelerateDecelerateInterpolator)3 ImageView (android.widget.ImageView)3 Point (android.graphics.Point)2 AccelerateInterpolator (android.view.animation.AccelerateInterpolator)2 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)2 AdapterView (android.widget.AdapterView)2 TextView (android.widget.TextView)2 TimeInterpolator (android.animation.TimeInterpolator)1 TargetApi (android.annotation.TargetApi)1 Resources (android.content.res.Resources)1