Example usage for android.support.v4.view.animation FastOutLinearInInterpolator FastOutLinearInInterpolator

List of usage examples for android.support.v4.view.animation FastOutLinearInInterpolator FastOutLinearInInterpolator

Introduction

In this page you can find the example usage for android.support.v4.view.animation FastOutLinearInInterpolator FastOutLinearInInterpolator.

Prototype

public FastOutLinearInInterpolator() 

Source Link

Usage

From source file:com.ninghoo.beta17ma27.weydio2.FastScrollView.FastScroller.java

public FastScroller(Context context, FastScrollRecyclerView recyclerView, AttributeSet attrs) {

    Resources resources = context.getResources();

    mRecyclerView = recyclerView;/*ww w  . j a  va  2s  .c  om*/
    mPopup = new FastScrollPopup(resources, recyclerView);

    // fast?
    mThumbHeight = Utils.toPixels(resources, 310);
    mWidth = Utils.toPixels(resources, 3);

    // 2???fastscroll
    mTouchInset = Utils.toPixels(resources, -24);

    mThumb = new Paint(Paint.ANTI_ALIAS_FLAG);
    mTrack = new Paint(Paint.ANTI_ALIAS_FLAG);

    TypedArray typedArray = context.getTheme().obtainStyledAttributes(attrs, R.styleable.FastScrollRecyclerView,
            0, 0);
    try {
        mAutoHideEnabled = typedArray.getBoolean(R.styleable.FastScrollRecyclerView_fastScrollAutoHide, true);
        mAutoHideDelay = typedArray.getInteger(R.styleable.FastScrollRecyclerView_fastScrollAutoHideDelay,
                DEFAULT_AUTO_HIDE_DELAY);

        int trackColor = typedArray.getColor(R.styleable.FastScrollRecyclerView_fastScrollTrackColor,
                0x1f000000);
        int thumbColor = typedArray.getColor(R.styleable.FastScrollRecyclerView_fastScrollThumbColor,
                0xff000000);
        int popupBgColor = typedArray.getColor(R.styleable.FastScrollRecyclerView_fastScrollPopupBgColor,
                0xff000000);
        int popupTextColor = typedArray.getColor(R.styleable.FastScrollRecyclerView_fastScrollPopupTextColor,
                0xffffffff);
        int popupTextSize = typedArray.getDimensionPixelSize(
                R.styleable.FastScrollRecyclerView_fastScrollPopupTextSize,
                Utils.toScreenPixels(resources, 56));
        int popupBackgroundSize = typedArray.getDimensionPixelSize(
                R.styleable.FastScrollRecyclerView_fastScrollPopupBackgroundSize,
                Utils.toPixels(resources, 88));

        mTrack.setColor(trackColor);
        mThumb.setColor(thumbColor);
        mPopup.setBgColor(popupBgColor);
        mPopup.setTextColor(popupTextColor);
        mPopup.setTextSize(popupTextSize);
        mPopup.setBackgroundSize(popupBackgroundSize);
    } finally {
        typedArray.recycle();
    }

    mHideRunnable = new Runnable() {
        @Override
        public void run() {
            if (!mIsDragging) {
                if (mAutoHideAnimator != null) {
                    mAutoHideAnimator.cancel();
                }
                mAutoHideAnimator = ObjectAnimator.ofInt(FastScroller.this, "offsetX",
                        (Utils.isRtl(mRecyclerView.getResources()) ? -1 : 1) * mWidth);
                mAutoHideAnimator.setInterpolator(new FastOutLinearInInterpolator());
                // 
                mAutoHideAnimator.setDuration(200);
                mAutoHideAnimator.start();
            }
        }
    };

    mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
        @Override
        public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
            super.onScrolled(recyclerView, dx, dy);
            show();
        }
    });

    if (mAutoHideEnabled) {
        postAutoHideDelayed();
    }
}

From source file:com.libs.golomb.extendedrecyclerview.Scroller.FastScroller2.java

public FastScroller2(Context context, FastScrollRecyclerView2 recyclerView, AttributeSet attrs) {

    Resources resources = context.getResources();

    mRecyclerView = recyclerView;/*from w  ww.j ava2s. com*/
    mPopup = new FastScrollPopup2(resources, recyclerView);

    mThumbHeight = Utils.toPixels(resources, 48);
    mWidth = Utils.toPixels(resources, 8);

    mTouchInset = Utils.toPixels(resources, -24);

    mThumb = new Paint(Paint.ANTI_ALIAS_FLAG);
    mTrack = new Paint(Paint.ANTI_ALIAS_FLAG);

    TypedArray typedArray = context.getTheme().obtainStyledAttributes(attrs, R.styleable.FastScrollRecyclerView,
            0, 0);
    try {
        mAutoHideEnabled = typedArray.getBoolean(R.styleable.FastScrollRecyclerView_fastScrollAutoHide, true);
        mAutoHideDelay = typedArray.getInteger(R.styleable.FastScrollRecyclerView_fastScrollAutoHideDelay,
                DEFAULT_AUTO_HIDE_DELAY);

        int trackColor = typedArray.getColor(R.styleable.FastScrollRecyclerView_fastScrollTrackColor,
                0x1f000000);
        int thumbColor = typedArray.getColor(R.styleable.FastScrollRecyclerView_fastScrollThumbColor,
                0xff000000);
        int popupBgColor = typedArray.getColor(R.styleable.FastScrollRecyclerView_fastScrollPopupBgColor,
                0xff000000);
        int popupTextColor = typedArray.getColor(R.styleable.FastScrollRecyclerView_fastScrollPopupTextColor,
                0xffffffff);
        int popupTextSize = typedArray.getDimensionPixelSize(
                R.styleable.FastScrollRecyclerView_fastScrollPopupTextSize,
                Utils.toScreenPixels(resources, 56));
        int popupBackgroundSize = typedArray.getDimensionPixelSize(
                R.styleable.FastScrollRecyclerView_fastScrollPopupBackgroundSize,
                Utils.toPixels(resources, 88));

        mTrack.setColor(trackColor);
        mThumb.setColor(thumbColor);
        mPopup.setBgColor(popupBgColor);
        mPopup.setTextColor(popupTextColor);
        mPopup.setTextSize(popupTextSize);
        mPopup.setBackgroundSize(popupBackgroundSize);
    } finally {
        typedArray.recycle();
    }

    mHideRunnable = new Runnable() {
        @Override
        public void run() {
            if (!mIsDragging) {
                if (mAutoHideAnimator != null) {
                    mAutoHideAnimator.cancel();
                }
                mAutoHideAnimator = ObjectAnimator.ofInt(FastScroller2.this, "offsetX",
                        (Utils.isRtl(mRecyclerView.getResources()) ? -1 : 1) * mWidth);
                mAutoHideAnimator.setInterpolator(new FastOutLinearInInterpolator());
                mAutoHideAnimator.setDuration(200);
                mAutoHideAnimator.start();
            }
        }
    };

    mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
        @Override
        public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
            //TODO
            Log.d("TGolomb", "onScrolled: " + scrollY.addAndGet(dy));
            show();
        }
    });

    if (mAutoHideEnabled) {
        postAutoHideDelayed();
    }
}

From source file:io.github.marktony.espresso.component.FastScroller.java

public FastScroller(Context context, FastScrollRecyclerView recyclerView, AttributeSet attrs) {

    Resources resources = context.getResources();

    mRecyclerView = recyclerView;/*from ww  w  .  j  a v a 2 s . com*/
    mPopup = new FastScrollPopup(resources, recyclerView);

    mThumbHeight = DensityUtil.dip2px(context, 48);
    mWidth = DensityUtil.dip2px(context, 8);

    mTouchInset = DensityUtil.dip2px(context, -24);

    mThumb = new Paint(Paint.ANTI_ALIAS_FLAG);
    mTrack = new Paint(Paint.ANTI_ALIAS_FLAG);

    TypedArray typedArray = context.getTheme().obtainStyledAttributes(attrs, R.styleable.FastScrollRecyclerView,
            0, 0);
    try {
        mAutoHideEnabled = typedArray.getBoolean(R.styleable.FastScrollRecyclerView_fastScrollAutoHide, true);
        mAutoHideDelay = typedArray.getInteger(R.styleable.FastScrollRecyclerView_fastScrollAutoHideDelay,
                DEFAULT_AUTO_HIDE_DELAY);

        int trackColor = typedArray.getColor(R.styleable.FastScrollRecyclerView_fastScrollTrackColor,
                0x1f000000);
        int thumbColor = typedArray.getColor(R.styleable.FastScrollRecyclerView_fastScrollThumbColor,
                ContextCompat.getColor(context, R.color.colorPrimary));
        int popupBgColor = typedArray.getColor(R.styleable.FastScrollRecyclerView_fastScrollPopupBgColor,
                ContextCompat.getColor(context, R.color.colorPrimary));
        int popupTextColor = typedArray.getColor(R.styleable.FastScrollRecyclerView_fastScrollPopupTextColor,
                0xffffffff);
        int popupTextSize = typedArray.getDimensionPixelSize(
                R.styleable.FastScrollRecyclerView_fastScrollPopupTextSize, DensityUtil.dip2sp(context, 56));
        int popupBackgroundSize = typedArray.getDimensionPixelSize(
                R.styleable.FastScrollRecyclerView_fastScrollPopupBackgroundSize,
                DensityUtil.dip2px(context, 88));

        mTrack.setColor(trackColor);
        mThumb.setColor(thumbColor);
        mPopup.setBgColor(popupBgColor);
        mPopup.setTextColor(popupTextColor);
        mPopup.setTextSize(popupTextSize);
        mPopup.setBackgroundSize(popupBackgroundSize);
    } finally {
        typedArray.recycle();
    }

    mHideRunnable = new Runnable() {
        @Override
        public void run() {
            if (!mIsDragging) {
                if (mAutoHideAnimator != null) {
                    mAutoHideAnimator.cancel();
                }
                mAutoHideAnimator = ObjectAnimator.ofInt(FastScroller.this, "offsetX",
                        (mRecyclerView.getResources().getConfiguration()
                                .getLayoutDirection() == View.LAYOUT_DIRECTION_RTL ? -1 : 1) * mWidth);
                mAutoHideAnimator.setInterpolator(new FastOutLinearInInterpolator());
                mAutoHideAnimator.setDuration(200);
                mAutoHideAnimator.start();
            }
        }
    };

    mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
        @Override
        public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
            super.onScrolled(recyclerView, dx, dy);
            show();
        }
    });

    if (mAutoHideEnabled) {
        postAutoHideDelayed();
    }
}

From source file:com.simplecityapps.recyclerview_fastscroll.views.FastScroller.java

@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void hideRunnable_11() {
    if (mAutoHideAnimator != null) {
        mAutoHideAnimator.cancel();/*  ww  w.j  a v  a  2s  . c  om*/
    }
    mAutoHideAnimator = mFastScrollerOffsetxObjectAnimator.getOffsetXAnimator(FastScroller.this,
            (Utils.isRtl(mRecyclerView.getResources()) ? -1 : 1) * mWidth);
    mAutoHideAnimator.setInterpolator(new FastOutLinearInInterpolator());
    mAutoHideAnimator.setDuration(200);
    try {
        mAutoHideAnimator.start();
    } catch (NullPointerException ignore) {
        // found in wild.  Possible due to view already destroying since
        // this is posted delayed.
    }
}

From source file:com.erevacation.challenge.rxjavaanimator.ViewAnimatorCreator.java

private static ViewPropertyAnimator animateTranslate(View view, int duration, int delay, int dx,
        TimeInterpolator interpolator) {
    Timber.d("Translate for dx: " + dx);
    view.setAlpha(1);/*from  www .j av  a2s .c  om*/
    ViewPropertyAnimator propertyAnimator = view.animate().translationX(dx).setStartDelay(delay)
            .setDuration(duration);
    if (interpolator != null) {
        propertyAnimator.setInterpolator(interpolator);
    } else {
        propertyAnimator.setInterpolator(new FastOutLinearInInterpolator());
    }

    return propertyAnimator;
}

From source file:com.google.samples.apps.topeka.view.quiz.QuizFragment.java

public void displayAvatar(Avatar avatar) {
    this.avatar.setAvatar(avatar.getDrawableId());
    ViewCompat.animate(this.avatar).setInterpolator(new FastOutLinearInInterpolator()).setStartDelay(500)
            .scaleX(1).scaleY(1).start();
}

From source file:de.dreier.mytargets.utils.transitions.FabTransform.java

@Override
public Animator createAnimator(@NonNull final ViewGroup sceneRoot, final TransitionValues startValues,
        final TransitionValues endValues) {
    if (startValues == null || endValues == null) {
        return null;
    }//  www  .ja  v  a  2  s  .  c  om

    final Rect startBounds = (Rect) startValues.values.get(PROP_BOUNDS);
    final Rect endBounds = (Rect) endValues.values.get(PROP_BOUNDS);

    final boolean fromFab = endBounds.width() > startBounds.width();
    final View view = endValues.view;
    final Rect dialogBounds = fromFab ? endBounds : startBounds;
    final Rect fabBounds = fromFab ? startBounds : endBounds;
    final Interpolator fastOutSlowInInterpolator = new FastOutSlowInInterpolator();
    final long duration = getDuration();
    final long halfDuration = duration / 2;
    final long twoThirdsDuration = duration * 2 / 3;

    if (!fromFab) {
        // Force measure / layout the dialog back to it's original bounds
        view.measure(makeMeasureSpec(startBounds.width(), View.MeasureSpec.EXACTLY),
                makeMeasureSpec(startBounds.height(), View.MeasureSpec.EXACTLY));
        view.layout(startBounds.left, startBounds.top, startBounds.right, startBounds.bottom);
    }

    final int translationX = startBounds.centerX() - endBounds.centerX();
    final int translationY = startBounds.centerY() - endBounds.centerY();
    if (fromFab) {
        view.setTranslationX(translationX);
        view.setTranslationY(translationY);
    }

    // Add a color overlay to fake appearance of the FAB
    final ColorDrawable fabColor = new ColorDrawable(color);
    fabColor.setBounds(0, 0, dialogBounds.width(), dialogBounds.height());
    if (!fromFab) {
        fabColor.setAlpha(0);
    }
    view.getOverlay().add(fabColor);

    // Add an icon overlay again to fake the appearance of the FAB
    final Drawable fabIcon = ContextCompat.getDrawable(sceneRoot.getContext(), icon).mutate();
    final int iconLeft = (dialogBounds.width() - fabIcon.getIntrinsicWidth()) / 2;
    final int iconTop = (dialogBounds.height() - fabIcon.getIntrinsicHeight()) / 2;
    fabIcon.setBounds(iconLeft, iconTop, iconLeft + fabIcon.getIntrinsicWidth(),
            iconTop + fabIcon.getIntrinsicHeight());
    if (!fromFab) {
        fabIcon.setAlpha(0);
    }
    view.getOverlay().add(fabIcon);

    // Circular clip from/to the FAB size
    final Animator circularReveal;
    if (fromFab) {
        circularReveal = ViewAnimationUtils.createCircularReveal(view, view.getWidth() / 2,
                view.getHeight() / 2, startBounds.width() / 2,
                (float) Math.hypot(endBounds.width() / 2, endBounds.height() / 2));
        circularReveal.setInterpolator(new FastOutLinearInInterpolator());
    } else {
        circularReveal = ViewAnimationUtils.createCircularReveal(view, view.getWidth() / 2,
                view.getHeight() / 2, (float) Math.hypot(startBounds.width() / 2, startBounds.height() / 2),
                endBounds.width() / 2);
        circularReveal.setInterpolator(new LinearOutSlowInInterpolator());

        // Persist the end clip i.e. stay at FAB size after the reveal has run
        circularReveal.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                view.setOutlineProvider(new ViewOutlineProvider() {
                    @Override
                    public void getOutline(View view, Outline outline) {
                        final int left = (view.getWidth() - fabBounds.width()) / 2;
                        final int top = (view.getHeight() - fabBounds.height()) / 2;
                        outline.setOval(left, top, left + fabBounds.width(), top + fabBounds.height());
                        view.setClipToOutline(true);
                    }
                });
            }
        });
    }
    circularReveal.setDuration(duration);

    // Translate to end position along an arc
    final Animator translate = ObjectAnimator.ofFloat(view, View.TRANSLATION_X, View.TRANSLATION_Y,
            fromFab ? getPathMotion().getPath(translationX, translationY, 0, 0)
                    : getPathMotion().getPath(0, 0, -translationX, -translationY));
    translate.setDuration(duration);
    translate.setInterpolator(fastOutSlowInInterpolator);

    // Fade contents of non-FAB view in/out
    List<Animator> fadeContents = null;
    if (view instanceof ViewGroup) {
        final ViewGroup vg = ((ViewGroup) view);
        fadeContents = new ArrayList<>(vg.getChildCount());
        for (int i = vg.getChildCount() - 1; i >= 0; i--) {
            final View child = vg.getChildAt(i);
            final Animator fade = ObjectAnimator.ofFloat(child, View.ALPHA, fromFab ? 1f : 0f);
            if (fromFab) {
                child.setAlpha(0f);
            }
            fade.setDuration(twoThirdsDuration);
            fade.setInterpolator(fastOutSlowInInterpolator);
            fadeContents.add(fade);
        }
    }

    // Fade in/out the fab color & icon overlays
    final Animator colorFade = ObjectAnimator.ofInt(fabColor, "alpha", fromFab ? 0 : 255);
    final Animator iconFade = ObjectAnimator.ofInt(fabIcon, "alpha", fromFab ? 0 : 255);
    if (!fromFab) {
        colorFade.setStartDelay(halfDuration);
        iconFade.setStartDelay(halfDuration);
    }
    colorFade.setDuration(halfDuration);
    iconFade.setDuration(halfDuration);
    colorFade.setInterpolator(fastOutSlowInInterpolator);
    iconFade.setInterpolator(fastOutSlowInInterpolator);

    // Work around issue with elevation shadows. At the end of the return transition the shared
    // element's shadow is drawn twice (by each activity) which is jarring. This workaround
    // still causes the shadow to snap, but it's better than seeing it double drawn.
    Animator elevation = null;
    if (!fromFab) {
        elevation = ObjectAnimator.ofFloat(view, View.TRANSLATION_Z, -view.getElevation());
        elevation.setDuration(duration);
        elevation.setInterpolator(fastOutSlowInInterpolator);
    }

    // Run all animations together
    final AnimatorSet transition = new AnimatorSet();
    transition.playTogether(circularReveal, translate, colorFade, iconFade);
    transition.playTogether(fadeContents);
    if (elevation != null) {
        transition.play(elevation);
    }
    if (fromFab) {
        transition.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                // Clean up
                view.getOverlay().clear();
            }
        });
    }
    return new NoPauseAnimator(transition);
}

From source file:com.artemchep.horario.ui.widgets.ContainersLayout.java

private void animateOutFrameDetails() {
    ViewUtils.onLaidOut(frameDetails, new Runnable() {
        @Override/*from  www .j  a  v  a  2s. c o m*/
        public void run() {
            if (!frameDetails.isShown()) {
                return;
            }
            ObjectAnimator alpha = ObjectAnimator.ofFloat(frameDetails, View.ALPHA, 1f, 0f);
            ObjectAnimator translate = ofFloat(frameDetails, View.TRANSLATION_Y, 0f,
                    frameDetails.getHeight() * 0.3f);

            AnimatorSet set = new AnimatorSet();
            set.playTogether(alpha, translate);
            set.setDuration(ANIM_DURATION);
            set.setInterpolator(new FastOutLinearInInterpolator());
            set.addListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator animation) {
                    super.onAnimationEnd(animation);
                    frameDetails.setAlpha(1f);
                    frameDetails.setTranslationY(0);
                    frameDetails.setVisibility(View.GONE);
                }
            });
            set.start();
        }
    });
}

From source file:com.github.takahirom.plaidanimation.transition.FabTransform.java

@Override
public Animator createAnimator(final ViewGroup sceneRoot, final TransitionValues startValues,
        final TransitionValues endValues) {
    if (startValues == null || endValues == null)
        return null;

    final Rect startBounds = (Rect) startValues.values.get(PROP_BOUNDS);
    final Rect endBounds = (Rect) endValues.values.get(PROP_BOUNDS);

    final boolean fromFab = endBounds.width() > startBounds.width();
    final View view = endValues.view;
    final Rect dialogBounds = fromFab ? endBounds : startBounds;
    final Rect fabBounds = fromFab ? startBounds : endBounds;
    final Interpolator fastOutSlowInInterpolator = new FastOutSlowInInterpolator();
    final long duration = getDuration();
    final long halfDuration = duration / 2;
    final long twoThirdsDuration = duration * 2 / 3;

    if (!fromFab) {
        // Force measure / layout the dialog back to it's original bounds
        view.measure(makeMeasureSpec(startBounds.width(), View.MeasureSpec.EXACTLY),
                makeMeasureSpec(startBounds.height(), View.MeasureSpec.EXACTLY));
        view.layout(startBounds.left, startBounds.top, startBounds.right, startBounds.bottom);
    }//from   w w w . j  a v  a 2s.c o m

    final int translationX = startBounds.centerX() - endBounds.centerX();
    final int translationY = startBounds.centerY() - endBounds.centerY();
    if (fromFab) {
        view.setTranslationX(translationX);
        view.setTranslationY(translationY);
    }

    // Add a color overlay to fake appearance of the FAB
    final ColorDrawable fabColor = new ColorDrawable(color);
    fabColor.setBounds(0, 0, dialogBounds.width(), dialogBounds.height());
    if (!fromFab)
        fabColor.setAlpha(0);
    view.getOverlay().add(fabColor);

    // Add an icon overlay again to fake the appearance of the FAB
    final Drawable fabIcon = ContextCompat.getDrawable(sceneRoot.getContext(), icon).mutate();
    final int iconLeft = (dialogBounds.width() - fabIcon.getIntrinsicWidth()) / 2;
    final int iconTop = (dialogBounds.height() - fabIcon.getIntrinsicHeight()) / 2;
    fabIcon.setBounds(iconLeft, iconTop, iconLeft + fabIcon.getIntrinsicWidth(),
            iconTop + fabIcon.getIntrinsicHeight());
    if (!fromFab)
        fabIcon.setAlpha(0);
    view.getOverlay().add(fabIcon);

    // Circular clip from/to the FAB size
    final Animator circularReveal;
    if (fromFab) {
        circularReveal = ViewAnimationUtils.createCircularReveal(view, view.getWidth() / 2,
                view.getHeight() / 2, startBounds.width() / 2,
                (float) Math.hypot(endBounds.width() / 2, endBounds.height() / 2));
        circularReveal.setInterpolator(new FastOutLinearInInterpolator());
    } else {
        circularReveal = ViewAnimationUtils.createCircularReveal(view, view.getWidth() / 2,
                view.getHeight() / 2, (float) Math.hypot(startBounds.width() / 2, startBounds.height() / 2),
                endBounds.width() / 2);
        circularReveal.setInterpolator(new LinearOutSlowInInterpolator());

        // Persist the end clip i.e. stay at FAB size after the reveal has run
        circularReveal.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                view.setOutlineProvider(new ViewOutlineProvider() {
                    @Override
                    public void getOutline(View view, Outline outline) {
                        final int left = (view.getWidth() - fabBounds.width()) / 2;
                        final int top = (view.getHeight() - fabBounds.height()) / 2;
                        outline.setOval(left, top, left + fabBounds.width(), top + fabBounds.height());
                        view.setClipToOutline(true);
                    }
                });
            }
        });
    }
    circularReveal.setDuration(duration);

    // Translate to end position along an arc
    final Animator translate = ObjectAnimator.ofFloat(view, View.TRANSLATION_X, View.TRANSLATION_Y,
            fromFab ? getPathMotion().getPath(translationX, translationY, 0, 0)
                    : getPathMotion().getPath(0, 0, -translationX, -translationY));
    translate.setDuration(duration);
    translate.setInterpolator(fastOutSlowInInterpolator);

    // Fade contents of non-FAB view in/out
    List<Animator> fadeContents = null;
    if (view instanceof ViewGroup) {
        final ViewGroup vg = ((ViewGroup) view);
        fadeContents = new ArrayList<>(vg.getChildCount());
        for (int i = vg.getChildCount() - 1; i >= 0; i--) {
            final View child = vg.getChildAt(i);
            final Animator fade = ObjectAnimator.ofFloat(child, View.ALPHA, fromFab ? 1f : 0f);
            if (fromFab) {
                child.setAlpha(0f);
            }
            fade.setDuration(twoThirdsDuration);
            fade.setInterpolator(fastOutSlowInInterpolator);
            fadeContents.add(fade);
        }
    }

    // Fade in/out the fab color & icon overlays
    final Animator colorFade = ObjectAnimator.ofInt(fabColor, "alpha", fromFab ? 0 : 255);
    final Animator iconFade = ObjectAnimator.ofInt(fabIcon, "alpha", fromFab ? 0 : 255);
    if (!fromFab) {
        colorFade.setStartDelay(halfDuration);
        iconFade.setStartDelay(halfDuration);
    }
    colorFade.setDuration(halfDuration);
    iconFade.setDuration(halfDuration);
    colorFade.setInterpolator(fastOutSlowInInterpolator);
    iconFade.setInterpolator(fastOutSlowInInterpolator);

    // Work around issue with elevation shadows. At the end of the return transition the shared
    // element's shadow is drawn twice (by each activity) which is jarring. This workaround
    // still causes the shadow to snap, but it's better than seeing it double drawn.
    Animator elevation = null;
    if (!fromFab) {
        elevation = ObjectAnimator.ofFloat(view, View.TRANSLATION_Z, -view.getElevation());
        elevation.setDuration(duration);
        elevation.setInterpolator(fastOutSlowInInterpolator);
    }

    // Run all animations together
    final AnimatorSet transition = new AnimatorSet();
    transition.playTogether(circularReveal, translate, colorFade, iconFade);
    transition.playTogether(fadeContents);
    if (elevation != null)
        transition.play(elevation);
    if (fromFab) {
        transition.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                // Clean up
                view.getOverlay().clear();
            }
        });
    }
    return new AnimUtils.NoPauseAnimator(transition);
}

From source file:com.savvasdalkitsis.betwixt.Interpolators.java

/**
 * <strong>ANDROID INTERPOLATOR</strong><br/><br/>
 * Interpolator corresponding to fast_out_linear_in. Uses a lookup table for the Bezier curve
 * from (0,0) to (1,1) with control points: P0 (0, 0) P1 (0.4, 0) P2 (1.0, 1.0) P3 (1.0, 1.0)
 */// www  .j a  v a 2s  .c  om
@NonNull
public static Interpolator fastOutLinearIn() {
    return new FastOutLinearInInterpolator();
}