Search in sources :

Example 81 with ViewPropertyAnimator

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

the class CaptureUI method animateSlideIn.

public void animateSlideIn(View v, int delta, boolean forcePortrait) {
    int orientation = getOrientation();
    if (!forcePortrait)
        orientation = 0;
    ViewPropertyAnimator vp = v.animate();
    float dest;
    if (View.LAYOUT_DIRECTION_RTL == TextUtils.getLayoutDirectionFromLocale(Locale.getDefault())) {
        switch(orientation) {
            case 0:
                dest = v.getX();
                v.setX(-(dest - delta));
                vp.translationX(dest);
                break;
            case 90:
                dest = v.getY();
                v.setY(-(dest + delta));
                vp.translationY(dest);
                break;
            case 180:
                dest = v.getX();
                v.setX(-(dest + delta));
                vp.translationX(dest);
                break;
            case 270:
                dest = v.getY();
                v.setY(-(dest - delta));
                vp.translationY(dest);
                break;
        }
    } else {
        switch(orientation) {
            case 0:
                dest = v.getX();
                v.setX(dest - delta);
                vp.translationX(dest);
                break;
            case 90:
                dest = v.getY();
                v.setY(dest + delta);
                vp.translationY(dest);
                break;
            case 180:
                dest = v.getX();
                v.setX(dest + delta);
                vp.translationX(dest);
                break;
            case 270:
                dest = v.getY();
                v.setY(dest - delta);
                vp.translationY(dest);
                break;
        }
    }
    vp.setDuration(ANIMATION_DURATION).start();
}
Also used : Point(android.graphics.Point) ViewPropertyAnimator(android.view.ViewPropertyAnimator)

Example 82 with ViewPropertyAnimator

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

the class CaptureUI method animateFadeIn.

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

Example 83 with ViewPropertyAnimator

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

the class PhotoMenu 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 84 with ViewPropertyAnimator

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

the class PhotoMenu method animateSlideOut.

private void animateSlideOut(final View v) {
    if (v == null || mPreviewMenuStatus == PREVIEW_MENU_IN_ANIMATION)
        return;
    mPreviewMenuStatus = PREVIEW_MENU_IN_ANIMATION;
    ViewPropertyAnimator vp = v.animate();
    if (View.LAYOUT_DIRECTION_RTL == TextUtils.getLayoutDirectionFromLocale(Locale.getDefault())) {
        vp.translationXBy(v.getWidth()).setDuration(ANIMATION_DURATION);
    } else {
        vp.translationXBy(-v.getWidth()).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) {
            closeSceneMode();
            mPreviewMenuStatus = PREVIEW_MENU_NONE;
        }

        @Override
        public void onAnimationCancel(Animator animation) {
            closeSceneMode();
            mPreviewMenuStatus = PREVIEW_MENU_NONE;
        }
    });
    vp.start();
}
Also used : AnimatorListener(android.animation.Animator.AnimatorListener) Animator(android.animation.Animator) ViewPropertyAnimator(android.view.ViewPropertyAnimator) ViewPropertyAnimator(android.view.ViewPropertyAnimator)

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

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