Search in sources :

Example 91 with OvershootInterpolator

use of android.view.animation.OvershootInterpolator in project Signal-Android by WhisperSystems.

the class VerificationCodeView method append.

@MainThread
public void append(int value) {
    if (index >= codes.size())
        return;
    setInactive(containers);
    setActive(containers.get(index));
    TextView codeView = codes.get(index++);
    Animation translateIn = new TranslateAnimation(0, 0, codeView.getHeight(), 0);
    translateIn.setInterpolator(new OvershootInterpolator());
    translateIn.setDuration(500);
    Animation fadeIn = new AlphaAnimation(0, 1);
    fadeIn.setDuration(200);
    AnimationSet animationSet = new AnimationSet(false);
    animationSet.addAnimation(fadeIn);
    animationSet.addAnimation(translateIn);
    animationSet.reset();
    animationSet.setStartTime(0);
    codeView.setText(String.valueOf(value));
    codeView.clearAnimation();
    codeView.startAnimation(animationSet);
    if (index == codes.size() && listener != null) {
        listener.onCodeComplete(Stream.of(codes).map(TextView::getText).collect(Collectors.joining()));
    }
}
Also used : OvershootInterpolator(android.view.animation.OvershootInterpolator) TranslateAnimation(android.view.animation.TranslateAnimation) AlphaAnimation(android.view.animation.AlphaAnimation) Animation(android.view.animation.Animation) TranslateAnimation(android.view.animation.TranslateAnimation) TextView(android.widget.TextView) AnimationSet(android.view.animation.AnimationSet) AlphaAnimation(android.view.animation.AlphaAnimation) MainThread(androidx.annotation.MainThread)

Example 92 with OvershootInterpolator

use of android.view.animation.OvershootInterpolator in project InstaMaterial by frogermcs.

the class FeedContextMenuManager method performShowAnimation.

private void performShowAnimation() {
    contextMenuView.setPivotX(contextMenuView.getWidth() / 2);
    contextMenuView.setPivotY(contextMenuView.getHeight());
    contextMenuView.setScaleX(0.1f);
    contextMenuView.setScaleY(0.1f);
    contextMenuView.animate().scaleX(1f).scaleY(1f).setDuration(150).setInterpolator(new OvershootInterpolator()).setListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            isContextMenuShowing = false;
        }
    });
}
Also used : Animator(android.animation.Animator) OvershootInterpolator(android.view.animation.OvershootInterpolator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter)

Example 93 with OvershootInterpolator

use of android.view.animation.OvershootInterpolator in project InstaMaterial by frogermcs.

the class PublishActivity method loadThumbnailPhoto.

private void loadThumbnailPhoto() {
    ivPhoto.setScaleX(0);
    ivPhoto.setScaleY(0);
    Picasso.with(this).load(photoUri).centerCrop().resize(photoSize, photoSize).into(ivPhoto, new Callback() {

        @Override
        public void onSuccess() {
            ivPhoto.animate().scaleX(1.f).scaleY(1.f).setInterpolator(new OvershootInterpolator()).setDuration(400).setStartDelay(200).start();
        }

        @Override
        public void onError() {
        }
    });
}
Also used : Callback(com.squareup.picasso.Callback) OvershootInterpolator(android.view.animation.OvershootInterpolator)

Example 94 with OvershootInterpolator

use of android.view.animation.OvershootInterpolator in project CircularFloatingActionMenu by oguzbilgener.

the class DefaultAnimationHandler method animateMenuOpening.

@Override
public void animateMenuOpening(Point center) {
    super.animateMenuOpening(center);
    setAnimating(true);
    Animator lastAnimation = null;
    for (int i = 0; i < menu.getSubActionItems().size(); i++) {
        menu.getSubActionItems().get(i).view.setScaleX(0);
        menu.getSubActionItems().get(i).view.setScaleY(0);
        menu.getSubActionItems().get(i).view.setAlpha(0);
        PropertyValuesHolder pvhX = PropertyValuesHolder.ofFloat(View.TRANSLATION_X, menu.getSubActionItems().get(i).x - center.x + menu.getSubActionItems().get(i).width / 2);
        PropertyValuesHolder pvhY = PropertyValuesHolder.ofFloat(View.TRANSLATION_Y, menu.getSubActionItems().get(i).y - center.y + menu.getSubActionItems().get(i).height / 2);
        PropertyValuesHolder pvhR = PropertyValuesHolder.ofFloat(View.ROTATION, 720);
        PropertyValuesHolder pvhsX = PropertyValuesHolder.ofFloat(View.SCALE_X, 1);
        PropertyValuesHolder pvhsY = PropertyValuesHolder.ofFloat(View.SCALE_Y, 1);
        PropertyValuesHolder pvhA = PropertyValuesHolder.ofFloat(View.ALPHA, 1);
        final ObjectAnimator animation = ObjectAnimator.ofPropertyValuesHolder(menu.getSubActionItems().get(i).view, pvhX, pvhY, pvhR, pvhsX, pvhsY, pvhA);
        animation.setDuration(DURATION);
        animation.setInterpolator(new OvershootInterpolator(0.9f));
        animation.addListener(new SubActionItemAnimationListener(menu.getSubActionItems().get(i), ActionType.OPENING));
        if (i == 0) {
            lastAnimation = animation;
        }
        // Put a slight lag between each of the menu items to make it asymmetric
        animation.setStartDelay((menu.getSubActionItems().size() - i) * LAG_BETWEEN_ITEMS);
        animation.start();
    }
    if (lastAnimation != null) {
        lastAnimation.addListener(new LastAnimationListener());
    }
}
Also used : ObjectAnimator(android.animation.ObjectAnimator) Animator(android.animation.Animator) OvershootInterpolator(android.view.animation.OvershootInterpolator) ObjectAnimator(android.animation.ObjectAnimator) PropertyValuesHolder(android.animation.PropertyValuesHolder) Point(android.graphics.Point)

Example 95 with OvershootInterpolator

use of android.view.animation.OvershootInterpolator in project ENViews by codeestX.

the class ENDownloadView method reset.

public void reset() {
    if (mCurrentState != STATE_RESET) {
        return;
    }
    ValueAnimator resetAnim = ValueAnimator.ofFloat(1.f, 100.f);
    resetAnim.setDuration(500);
    resetAnim.setInterpolator(new OvershootInterpolator());
    resetAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator valueAnimator) {
            mFraction = valueAnimator.getAnimatedFraction();
            invalidate();
        }
    });
    resetAnim.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            mFraction = 0;
            mCurrentState = STATE_PRE;
            if (onDownloadStateListener != null) {
                onDownloadStateListener.onResetFinish();
            }
        }
    });
    resetAnim.start();
}
Also used : Animator(android.animation.Animator) ValueAnimator(android.animation.ValueAnimator) OvershootInterpolator(android.view.animation.OvershootInterpolator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) ValueAnimator(android.animation.ValueAnimator)

Aggregations

OvershootInterpolator (android.view.animation.OvershootInterpolator)131 ObjectAnimator (android.animation.ObjectAnimator)39 Animator (android.animation.Animator)32 View (android.view.View)31 TextView (android.widget.TextView)21 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)18 AccelerateInterpolator (android.view.animation.AccelerateInterpolator)18 AnimatorSet (android.animation.AnimatorSet)17 ValueAnimator (android.animation.ValueAnimator)17 Handler (android.os.Handler)14 Animation (android.view.animation.Animation)12 LinearInterpolator (android.view.animation.LinearInterpolator)11 AccelerateDecelerateInterpolator (android.view.animation.AccelerateDecelerateInterpolator)10 RecyclerView (android.support.v7.widget.RecyclerView)9 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)9 ScaleAnimation (android.view.animation.ScaleAnimation)9 TranslateAnimation (android.view.animation.TranslateAnimation)9 Drawable (android.graphics.drawable.Drawable)8 AnticipateInterpolator (android.view.animation.AnticipateInterpolator)8 PropertyValuesHolder (android.animation.PropertyValuesHolder)6