Example usage for android.view.animation OvershootInterpolator OvershootInterpolator

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

Introduction

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

Prototype

public OvershootInterpolator(float tension) 

Source Link

Usage

From source file:com.ushahidi.android.presentation.view.ui.activity.PostActivity.java

private void startContentAnimation() {
    mFab.animate().translationY(0).setInterpolator(new OvershootInterpolator(1.f))
            .setStartDelay(START_DELAY_ANIM).setDuration(DURATION_ANIM).start();
    // Cause the post list to reload
    UshahidiApplication.getRxEventBusInstance().send(new ReloadPostEvent(null));
}

From source file:io.digibyte.tools.animation.BRAnimator.java

public static void animateSignalSlide(ViewGroup signalLayout, final boolean reverse,
        final OnSlideAnimationEnd listener) {
    float translationY = signalLayout.getTranslationY();
    float signalHeight = signalLayout.getHeight();
    signalLayout.setTranslationY(reverse ? translationY : translationY + signalHeight);

    signalLayout.animate().translationY(reverse ? BreadActivity.screenParametersPoint.y : translationY)
            .setDuration(SLIDE_ANIMATION_DURATION)
            .setInterpolator(reverse ? new DecelerateInterpolator() : new OvershootInterpolator(0.7f))
            .setListener(new AnimatorListenerAdapter() {
                @Override//from w w  w  .  j  av a 2s  .c  om
                public void onAnimationEnd(Animator animation) {
                    super.onAnimationEnd(animation);
                    if (listener != null)
                        listener.onAnimationEnd();
                }
            });

}

From source file:in.andres.kandroid.ui.TaskDetailActivity.java

private void expandFABMenu() {
    Log.i(Constants.TAG, "Expand FAB.");
    ViewCompat.animate(fabMenu).rotation(90.0F).withLayer().setDuration(300)
            .setInterpolator(new OvershootInterpolator(5.0F)).start();
    findViewById(R.id.fab_menu_item0).startAnimation(fabOpenAnimation);
    findViewById(R.id.fab_menu_item1).startAnimation(fabOpenAnimation);
    findViewById(R.id.fab_menu_item2).startAnimation(fabOpenAnimation);
    findViewById(R.id.fab_menu_item3).startAnimation(fabOpenAnimation);
    findViewById(R.id.fab_menu_item4).startAnimation(fabOpenAnimation);
    fabMenuButtonRemoveTask.setClickable(true);
    fabMenuButtonOpenCloseTask.setClickable(true);
    fabMenuButtonNewComment.setClickable(true);
    fabMenuButtonNewSubtask.setClickable(true);
    fabMenuButtonEditTask.setClickable(true);
    isFABMenuOpen = true;/*from ww w.  j  a va2 s.  com*/
}

From source file:in.andres.kandroid.ui.TaskDetailActivity.java

private void collapseFABMenu() {
    Log.i(Constants.TAG, "Collapse FAB.");
    ViewCompat.animate(fabMenu).rotation(0.0F).withLayer().setDuration(300)
            .setInterpolator(new OvershootInterpolator(5.0F)).start();
    findViewById(R.id.fab_menu_item0).startAnimation(fabCloseAnimation);
    findViewById(R.id.fab_menu_item1).startAnimation(fabCloseAnimation);
    findViewById(R.id.fab_menu_item2).startAnimation(fabCloseAnimation);
    findViewById(R.id.fab_menu_item3).startAnimation(fabCloseAnimation);
    findViewById(R.id.fab_menu_item4).startAnimation(fabCloseAnimation);
    fabMenuButtonRemoveTask.setClickable(false);
    fabMenuButtonOpenCloseTask.setClickable(false);
    fabMenuButtonNewComment.setClickable(false);
    fabMenuButtonNewSubtask.setClickable(false);
    fabMenuButtonEditTask.setClickable(false);
    isFABMenuOpen = false;//from w ww  .  ja  v  a 2 s .  co  m
}

From source file:support.plus.reportit.rv.FragmentActivity.java

private void createCustomAnimation() {
    final FloatingActionMenu menu3 = (FloatingActionMenu) findViewById(R.id.menuShareReport);

    AnimatorSet set = new AnimatorSet();

    ObjectAnimator scaleOutX = ObjectAnimator.ofFloat(menu3.getMenuIconView(), "scaleX", 1.0f, 0.2f);
    ObjectAnimator scaleOutY = ObjectAnimator.ofFloat(menu3.getMenuIconView(), "scaleY", 1.0f, 0.2f);

    ObjectAnimator scaleInX = ObjectAnimator.ofFloat(menu3.getMenuIconView(), "scaleX", 0.2f, 1.0f);
    ObjectAnimator scaleInY = ObjectAnimator.ofFloat(menu3.getMenuIconView(), "scaleY", 0.2f, 1.0f);

    scaleOutX.setDuration(50);//  w  w  w  .  ja v  a2 s  . c o  m
    scaleOutY.setDuration(50);

    scaleInX.setDuration(150);
    scaleInY.setDuration(150);

    scaleInX.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationStart(Animator animation) {
            menu3.getMenuIconView().setImageResource(
                    menu3.isOpened() ? R.drawable.ic_unarchive_white_24dp : R.drawable.ic_done_white_24dp);
        }
    });

    set.play(scaleOutX).with(scaleOutY);
    set.play(scaleInX).with(scaleInY).after(scaleOutX);
    set.setInterpolator(new OvershootInterpolator(2));

    menu3.setIconToggleAnimatorSet(set);
}

From source file:com.juick.android.ThreadFragment.java

private void openNavigationMenu(float currentTranslation) {
    try {//from ww  w. j  a  v a2s  . c om
        navigationMenuShown = true;
        for (final FlyingItem item : flyingItems) {
            item.setVisibility(View.VISIBLE);
            item.ani = new TranslateAnimation(Animation.ABSOLUTE, 300, Animation.ABSOLUTE, item.designedX,
                    Animation.ABSOLUTE, 0, Animation.ABSOLUTE, item.designedY);

            item.ani.setInterpolator(new OvershootInterpolator(2));
            item.ani.setDuration(500);
            item.ani.setFillAfter(true);
            item.ani.setAnimationListener(new Animation.AnimationListener() {
                @Override
                public void onAnimationStart(Animation animation) {
                    //To change body of implemented methods use File | Settings | File Templates.
                }

                @Override
                public void onAnimationEnd(Animation animation) {
                    // this code is very ugly because it's all android 2.3 animations.
                    item.widget.getHitRect(item.originalHitRect);
                    item.widget.clearAnimation();
                    item.widget.layout(item.originalHitRect.left + (int) item.widget.initialTranslationX,
                            item.originalHitRect.top + (int) item.widget.initialTranslationY,
                            item.originalHitRect.right + (int) item.widget.initialTranslationX,
                            item.originalHitRect.bottom + (int) item.widget.initialTranslationY);
                    item.widget.disableReposition = true;
                }

                @Override
                public void onAnimationRepeat(Animation animation) {
                    //To change body of implemented methods use File | Settings | File Templates.
                }
            });
            item.widget.startAnimation(item.ani);
        }
        TranslateAnimation aniOut = new TranslateAnimation(Animation.ABSOLUTE, currentTranslation,
                Animation.ABSOLUTE, -1.2f * getActivity().getWindowManager().getDefaultDisplay().getWidth(),
                Animation.ABSOLUTE, 0, Animation.ABSOLUTE, 0);
        aniOut.setInterpolator(new DecelerateInterpolator(1));
        aniOut.setDuration(700);
        aniOut.setFillAfter(true);
        navMenu.startAnimation(aniOut);

        getListView().performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
    } catch (Throwable e) {
        e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
    }
}

From source file:com.klinker.android.launcher.launcher3.Launcher.java

private ValueAnimator createNewAppBounceAnimation(View v, int i) {
    ValueAnimator bounceAnim = LauncherAnimUtils.ofPropertyValuesHolder(v,
            PropertyValuesHolder.ofFloat("alpha", 1f), PropertyValuesHolder.ofFloat("scaleX", 1f),
            PropertyValuesHolder.ofFloat("scaleY", 1f));
    bounceAnim.setDuration(InstallShortcutReceiver.NEW_SHORTCUT_BOUNCE_DURATION);
    bounceAnim.setStartDelay(i * InstallShortcutReceiver.NEW_SHORTCUT_STAGGER_DELAY);
    bounceAnim.setInterpolator(new OvershootInterpolator(BOUNCE_ANIMATION_TENSION));
    return bounceAnim;
}

From source file:com.android.launcher3.Launcher.java

private ValueAnimator createNewAppBounceAnimation(View v, int i) {
    ValueAnimator bounceAnim = LauncherAnimUtils.ofViewAlphaAndScale(v, 1, 1, 1);
    bounceAnim.setDuration(InstallShortcutReceiver.NEW_SHORTCUT_BOUNCE_DURATION);
    bounceAnim.setStartDelay(i * InstallShortcutReceiver.NEW_SHORTCUT_STAGGER_DELAY);
    bounceAnim.setInterpolator(new OvershootInterpolator(BOUNCE_ANIMATION_TENSION));
    return bounceAnim;
}