Search in sources :

Example 76 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 77 with ViewPropertyAnimator

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

the class AnimUtils method fadeIn.

public static void fadeIn(final View fadeIn, int durationMs, int delay, final AnimationCallback callback) {
    fadeIn.setAlpha(0);
    final ViewPropertyAnimator animator = fadeIn.animate();
    animator.cancel();
    animator.setStartDelay(delay);
    animator.alpha(1).withLayer().setListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationStart(Animator animation) {
            fadeIn.setVisibility(View.VISIBLE);
        }

        @Override
        public void onAnimationCancel(Animator animation) {
            fadeIn.setAlpha(1);
            if (callback != null) {
                callback.onAnimationCancel();
            }
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            if (callback != null) {
                callback.onAnimationEnd();
            }
        }
    });
    if (durationMs != DEFAULT_DURATION) {
        animator.setDuration(durationMs);
    }
    animator.start();
}
Also used : Animator(android.animation.Animator) ViewPropertyAnimator(android.view.ViewPropertyAnimator) ValueAnimator(android.animation.ValueAnimator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) ViewPropertyAnimator(android.view.ViewPropertyAnimator)

Example 78 with ViewPropertyAnimator

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

the class DialpadView method animateShow.

public void animateShow() {
    // This is a hack; without this, the setTranslationY is delayed in being applied, and the
    // numbers appear at their original position (0) momentarily before animating.
    final AnimatorListenerAdapter showListener = new AnimatorListenerAdapter() {
    };
    for (int i = 0; i < BUTTON_IDS.length; i++) {
        int delay = (int) (getKeyButtonAnimationDelay(BUTTON_IDS[i]) * DELAY_MULTIPLIER);
        int duration = (int) (getKeyButtonAnimationDuration(BUTTON_IDS[i]) * DURATION_MULTIPLIER);
        final DialpadKeyButton dialpadKey = (DialpadKeyButton) findViewById(BUTTON_IDS[i]);
        ViewPropertyAnimator animator = dialpadKey.animate();
        if (isLandscapeMode) {
            // Landscape orientation requires translation along the X axis.
            // For RTL locales, ensure we translate negative on the X axis.
            dialpadKey.setTranslationX((isRtl ? -1 : 1) * translateDistance);
            animator.translationX(0);
        } else {
            // Portrait orientation requires translation along the Y axis.
            dialpadKey.setTranslationY(translateDistance);
            animator.translationY(0);
        }
        animator.setInterpolator(AnimUtils.EASE_OUT_EASE_IN).setStartDelay(delay).setDuration(duration).setListener(showListener).start();
    }
}
Also used : AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) ViewPropertyAnimator(android.view.ViewPropertyAnimator)

Example 79 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 80 with ViewPropertyAnimator

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

the class AnimUtils method fadeIn.

public static void fadeIn(final View fadeIn, int durationMs, int delay, final AnimationCallback callback) {
    fadeIn.setAlpha(0);
    final ViewPropertyAnimator animator = fadeIn.animate();
    animator.cancel();
    animator.setStartDelay(delay);
    animator.alpha(1).withLayer().setListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationStart(Animator animation) {
            fadeIn.setVisibility(View.VISIBLE);
        }

        @Override
        public void onAnimationCancel(Animator animation) {
            fadeIn.setAlpha(1);
            if (callback != null) {
                callback.onAnimationCancel();
            }
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            if (callback != null) {
                callback.onAnimationEnd();
            }
        }
    });
    if (durationMs != DEFAULT_DURATION) {
        animator.setDuration(durationMs);
    }
    animator.start();
}
Also used : Animator(android.animation.Animator) ViewPropertyAnimator(android.view.ViewPropertyAnimator) ValueAnimator(android.animation.ValueAnimator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) 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