Example usage for android.view.animation AccelerateDecelerateInterpolator AccelerateDecelerateInterpolator

List of usage examples for android.view.animation AccelerateDecelerateInterpolator AccelerateDecelerateInterpolator

Introduction

In this page you can find the example usage for android.view.animation AccelerateDecelerateInterpolator AccelerateDecelerateInterpolator.

Prototype

public AccelerateDecelerateInterpolator() 

Source Link

Usage

From source file:de.mrapp.android.bottomsheet.view.DraggableView.java

/**
 * Hides the view in an animated manner.
 *
 * @param cancel//  ww  w  .  j  ava  2s .  co  m
 *         True, if the view should be canceled, false otherwise
 */
public final void hideView(final boolean cancel) {
    animateHideView(parentHeight - getTopMargin(), animationSpeed, new AccelerateDecelerateInterpolator(),
            cancel);
}

From source file:io.github.data4all.activity.CameraActivity.java

/**
 * This method is the callback for the success-animation of the gallery
 * saving action./*w  ww.  jav a 2  s  . co  m*/
 * 
 * @author tbrose
 */
protected void onGallerySuccess() {
    mCallbackView.animate().alpha(1).setDuration(VIBRATION_DURATION).setInterpolator(new TimeInterpolator() {
        private TimeInterpolator ti = new AccelerateDecelerateInterpolator();

        @Override
        public float getInterpolation(float input) {
            return 2f * (0.5f - Math.abs(-ti.getInterpolation(input) + 0.5f));
        }
    }).withStartAction(new Runnable() {
        @Override
        public void run() {
            mCallbackView.setVisibility(View.VISIBLE);
            Log.i(TAG, "starting success animation");
            mCamera.startPreview();
        }
    }).withEndAction(new Runnable() {
        @Override
        public void run() {
            mCallbackView.setVisibility(View.INVISIBLE);
            mCallbackView.setAlpha(0);
            btnCapture.setEnabled(true);
            Log.i(TAG, "ending success animation");
        }
    }).start();
}

From source file:com.miris.ui.view.WaveView.java

public void startDropAnimation() {
    mDisappearCircleAnimator = ValueAnimator.ofFloat(1.f, 1.f);
    mDisappearCircleAnimator.setDuration(1);
    mDisappearCircleAnimator.start();/*from w  w w  .ja va2 s .c  om*/

    mDropCircleAnimator = ValueAnimator.ofFloat(500 * (mWidth / 1440.f), mMaxDropHeight);
    mDropCircleAnimator.setDuration(DROP_CIRCLE_ANIMATOR_DURATION);
    mDropCircleAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            mCurrentCircleCenterY = (float) animation.getAnimatedValue();
            ViewCompat.postInvalidateOnAnimation(WaveView.this);
        }
    });
    mDropCircleAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
    mDropCircleAnimator.start();

    mDropVertexAnimator = ValueAnimator.ofFloat(0.f, mMaxDropHeight - mDropCircleRadius);
    mDropVertexAnimator.setDuration(DROP_VERTEX_ANIMATION_DURATION);
    mDropVertexAnimator.addUpdateListener(mAnimatorUpdateListener);
    mDropVertexAnimator.start();

    mDropBounceVerticalAnimator = ValueAnimator.ofFloat(0.f, 1.f);
    mDropBounceVerticalAnimator.setDuration(DROP_BOUNCE_ANIMATOR_DURATION);
    mDropBounceVerticalAnimator.addUpdateListener(mAnimatorUpdateListener);
    mDropBounceVerticalAnimator.setInterpolator(new DropBounceInterpolator());
    mDropBounceVerticalAnimator.setStartDelay(DROP_VERTEX_ANIMATION_DURATION);
    mDropBounceVerticalAnimator.start();

    mDropBounceHorizontalAnimator = ValueAnimator.ofFloat(0.f, 1.f);
    mDropBounceHorizontalAnimator.setDuration(DROP_BOUNCE_ANIMATOR_DURATION);
    mDropBounceHorizontalAnimator.addUpdateListener(mAnimatorUpdateListener);
    mDropBounceHorizontalAnimator.setInterpolator(new DropBounceInterpolator());
    mDropBounceHorizontalAnimator
            .setStartDelay((long) (DROP_VERTEX_ANIMATION_DURATION + DROP_BOUNCE_ANIMATOR_DURATION * 0.25));
    mDropBounceHorizontalAnimator.start();
}

From source file:com.jaus.albertogiunta.justintrain_oraritreni.journeyFavourites.FavouriteJourneysActivity.java

@Override
public void onResume() {
    super.onResume();
    //        adView.resume();
    LocalBroadcastManager.getInstance(this).registerReceiver(messageReceiver,
            new IntentFilter(NotificationService.NOTIFICATION_ERROR_EVENT));
    btnSearch.animate().setInterpolator(new AccelerateDecelerateInterpolator()).translationY(0).setDuration(0);
    presenter.setState(getIntent().getExtras());
    iabHelper.isUserPro(this);
}

From source file:com.tiancaicc.springfloatingactionmenu.SpringFloatingActionMenu.java

private void revealIn() {
    mRevealCircle.setVisibility(View.VISIBLE);
    mRevealCircle.animate().scaleX(100).scaleY(100).setDuration(mRevealDuration)
            .setInterpolator(new AccelerateDecelerateInterpolator()).setListener(new AnimatorListenerAdapter() {
                @Override//from   w w w. j  ava2  s  .  c  o  m
                public void onAnimationEnd(Animator animation) {
                    super.onAnimationEnd(animation);
                    mAnimating = false;
                    animation.removeAllListeners();
                }

                @Override
                public void onAnimationStart(Animator animation) {
                    super.onAnimationStart(animation);
                    mAnimating = true;
                }
            }).start();
}

From source file:com.taobao.weex.ui.animation.WXAnimationModule.java

private static @Nullable Interpolator createTimeInterpolator(@NonNull WXAnimationBean animation) {
    String interpolator = animation.timingFunction;
    if (!TextUtils.isEmpty(interpolator)) {
        switch (interpolator) {
        case WXAnimationBean.EASE_IN:
            return new AccelerateInterpolator();
        case WXAnimationBean.EASE_OUT:
            return new DecelerateInterpolator();
        case WXAnimationBean.EASE_IN_OUT:
            return new AccelerateDecelerateInterpolator();
        case WXAnimationBean.LINEAR:
            return new LinearInterpolator();
        default:/*from w  w  w  .  j  a  v a 2  s .c om*/
            //Parse cubic-bezier
            try {
                SingleFunctionParser<Float> parser = new SingleFunctionParser<>(animation.timingFunction,
                        new SingleFunctionParser.FlatMapper<Float>() {
                            @Override
                            public Float map(String raw) {
                                return Float.parseFloat(raw);
                            }
                        });
                List<Float> params = parser.parse(WXAnimationBean.CUBIC_BEZIER);
                if (params != null && params.size() == WXAnimationBean.NUM_CUBIC_PARAM) {
                    return PathInterpolatorCompat.create(params.get(0), params.get(1), params.get(2),
                            params.get(3));
                } else {
                    return null;
                }
            } catch (RuntimeException e) {
                return null;
            }
        }
    }
    return null;
}

From source file:de.mrapp.android.view.FloatingActionButton.java

/**
 * Animates changing the visibility of the floating action button.
 *
 * @param visibility//  w  w  w.j  a  va 2 s  . c om
 *         The visibility, which should be set, as an {@link Integer} value. The visibility may
 *         be <code>View.VISIBLE</code>, <code>View.INVISIBLE</code> or <code>View.GONE</code>
 * @param duration
 *         The duration of the animation in milliseconds as a {@link Long} value
 */
private void animateVisibility(final int visibility, final long duration) {
    if (visibilityAnimator != null) {
        visibilityAnimator.cancel();
    }

    AnimatorListener listener = createVisibilityAnimatorListener(visibility);
    float targetScale = visibility == View.VISIBLE ? 1 : 0;
    long animationDuration = Math.round(Math.abs(getScaleX() - targetScale) * duration);
    Interpolator interpolator = new AccelerateDecelerateInterpolator();
    visibilityAnimator = animate().setInterpolator(interpolator).scaleX(targetScale).scaleY(targetScale)
            .setDuration(animationDuration).setListener(listener);
}

From source file:com.tiancaicc.springfloatingactionmenu.SpringFloatingActionMenu.java

private void revealOut() {
    mRevealCircle.animate().scaleX(1).scaleY(1).setDuration(mRevealDuration)
            .setInterpolator(new AccelerateDecelerateInterpolator()).setListener(new AnimatorListenerAdapter() {
                @Override/*from  w w w  .j a v a  2s .c  om*/
                public void onAnimationEnd(Animator animation) {
                    super.onAnimationEnd(animation);
                    mRevealCircle.setVisibility(View.GONE);
                    animation.removeAllListeners();
                    mAnimating = false;
                }

                @Override
                public void onAnimationStart(Animator animation) {
                    super.onAnimationStart(animation);
                    mAnimating = true;
                }
            }).start();
}

From source file:ca.zadrox.dota2esportticker.ui.LiveContentView.java

@Override
public void updatePlayerMapIcon(int playerSlot, float x, float y, int resId) {
    int scaledX = DotaMapModel.scaleXFromAPI(x, mapX);
    int scaledY = DotaMapModel.scaleYFromAPI(y, mapY);

    (findViewById(mPlayerMiniMapIcons[playerSlot])).animate().setDuration(250).translationX(scaledX)
            .translationY(scaledY).setInterpolator(new AccelerateDecelerateInterpolator()).start();

    findViewById(mPlayerMiniMapIcons[playerSlot]).setBackground(getResources().getDrawable(resId));
}

From source file:com.ruesga.rview.wizard.WizardActivity.java

private Animator createHeaderAnimation(int from, int to) {
    final ValueAnimator animator = ValueAnimator.ofInt(from, to);
    animator.setInterpolator(new AccelerateDecelerateInterpolator());
    animator.setDuration(250L);/*from   w  ww  . j a v  a  2 s.c o  m*/
    animator.addUpdateListener(animation -> {
        final View v = mBinding.pageHeader;
        v.getLayoutParams().height = (Integer) animation.getAnimatedValue();
        v.requestLayout();
    });
    animator.addListener(new Animator.AnimatorListener() {
        @Override
        public void onAnimationStart(Animator animator) {
            mWorkflow.isBackEnabled = false;
            mWorkflow.isForwardEnabled = false;
            mBinding.setWorkflow(mWorkflow);
            mIsHeaderAnimatorRunning = true;
        }

        @Override
        public void onAnimationEnd(Animator animator) {
            if (mCurrentPageFragment != null) {
                onValidationChanged(mCurrentPageFragment);
            }
            mBinding.setWorkflow(mWorkflow);
            mIsHeaderAnimatorRunning = false;
        }

        @Override
        public void onAnimationCancel(Animator animator) {
        }

        @Override
        public void onAnimationRepeat(Animator animator) {
        }
    });
    return animator;
}