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:net.huannguyen.conductorexample.transition.DetailPopAnimChangeHandler.java

@NonNull
@Override/*from w ww  .j a va  2  s  . co  m*/
protected Animator getAnimator(@NonNull ViewGroup container, @Nullable View from, @Nullable View to,
        boolean isPush, boolean toAddedToContainer) {

    // Make sure the from view is a CountryDetailView
    if (from == null || !(from instanceof CountryDetailView))
        throw new IllegalArgumentException("The from view must be a CountryDetailView");

    if (to == null)
        throw new IllegalArgumentException("The to view must not be null");

    final CountryDetailView detailView = (CountryDetailView) from;

    AnimatorSet animatorSet = new AnimatorSet();

    // Set the to View's alpha to 0 to hide it at the beginning.
    to.setAlpha(0);

    // Scale down to hide the fab button
    PropertyValuesHolder fabScaleX = PropertyValuesHolder.ofFloat(View.SCALE_X, 0);
    PropertyValuesHolder fabScaleY = PropertyValuesHolder.ofFloat(View.SCALE_Y, 0);
    Animator hideFabButtonAnimator = ObjectAnimator.ofPropertyValuesHolder(detailView.favouriteFab, fabScaleX,
            fabScaleY);

    // Slide up the flag
    Animator flagAnimator = ObjectAnimator.ofFloat(detailView.flagView, View.TRANSLATION_Y, 0,
            -detailView.flagView.getHeight());

    // Slide down the details
    Animator detailAnimator = ObjectAnimator.ofFloat(detailView.detailGroup, View.TRANSLATION_Y, 0,
            detailView.detailGroup.getHeight());

    // Show the new view
    Animator showToViewAnimator = ObjectAnimator.ofFloat(to, View.ALPHA, 0, 1);

    animatorSet.playTogether(hideFabButtonAnimator, flagAnimator, detailAnimator, showToViewAnimator);
    animatorSet.setDuration(300);
    animatorSet.setInterpolator(new FastOutLinearInInterpolator());

    animatorSet.start();

    return animatorSet;
}

From source file:com.nononsenseapps.feeder.ui.SwipeDismissTouchListener.java

/**
 * Constructs a new swipe-to-dismiss touch listener for the given view.
 *
 * @param view     The view to make dismissable.
 * @param token    An optional token/cookie object to be passed through to the callback.
 * @param callbacks The callback to trigger when the user has indicated that she would like to
 *                 dismiss this view.//from   w w w .j  a v a 2  s  . c  o m
 */
public SwipeDismissTouchListener(View view, Object token, DismissCallbacks callbacks) {
    ViewConfiguration vc = ViewConfiguration.get(view.getContext());
    mSlop = vc.getScaledTouchSlop();
    mMinFlingVelocity = vc.getScaledMinimumFlingVelocity() * 16;
    mMaxFlingVelocity = vc.getScaledMaximumFlingVelocity();
    mAnimationTime = view.getContext().getResources().getInteger(android.R.integer.config_shortAnimTime);
    mView = view;
    mSwipingView = callbacks.getSwipingView();

    mToken = token;
    mCallbacks = callbacks;

    mInterpolator = new FastOutLinearInInterpolator();
}

From source file:org.onebusaway.android.view.RealtimeIndicatorView.java

/**
 * Setup the animation/*from ww  w . j  a va  2s  .  c o  m*/
 */
private synchronized void initAnimation() {
    // Animate circle expand/contract
    mAnimation1 = new Animation() {
        @Override
        protected void applyTransformation(float interpolatedTime, Transformation t) {
            int height = getHeight();
            mNewRadius = height * interpolatedTime;
            invalidate();
        }
    };

    mAnimation1.setDuration(mDuration);
    mAnimation1.setRepeatMode(Animation.REVERSE);
    mAnimation1.setInterpolator(new FastOutLinearInInterpolator());
    mAnimation1.setRepeatCount(Animation.INFINITE);
    startAnimation(mAnimation1);
    mInitComplete = true;
}

From source file:sg.fxl.topekaport.QuizFragment.java

@SuppressWarnings("ConstantConditions")
private void setAvatarDrawable(AvatarView avatarView) {
    avatarView.setAvatar(R.drawable.avatar_1);
    ViewCompat.animate(avatarView).setInterpolator(new FastOutLinearInInterpolator()).setStartDelay(500)
            .scaleX(1).scaleY(1).start();
}

From source file:is.hello.go99.example.view.InfoTooltipView.java

/**
 * Animates the tooltip into view with a simple slide and fade animation,
 * then schedules the tooltip to automatically dismiss itself.
 *
 * @param onDismissListener A functor to call if the tooltip is dismissed without user intervention.
 */// w w w .  j  a  va  2 s .c  om
private void animateInText(final @NonNull OnDismissListener onDismissListener) {
    final int overlap = getResources().getDimensionPixelSize(R.dimen.view_info_tooltip_overlap);
    animatorFor(text, animatorContext).withInterpolator(new FastOutLinearInInterpolator())
            .slideYAndFade(overlap, 0f, 0f, 1f).addOnAnimationCompleted(new OnAnimationCompleted() {
                @Override
                public void onAnimationCompleted(boolean finished) {
                    postDelayed(new Runnable() {
                        @Override
                        public void run() {
                            if (Anime.isAnimating(text) || !isShown()) {
                                return;
                            }

                            onDismissListener.onInfoTooltipDismissed();
                            dismiss(false);
                        }
                    }, VISIBLE_DURATION);
                }
            }).start();
}

From source file:com.appsummary.luoxf.myappsummary.recyclerView.fastscroll.Views.FastScroller.java

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

    Resources resources = context.getResources();

    mRecyclerView = recyclerView;/*from  ww  w. ja v  a 2s .  co  m*/
    mPopup = new FastScrollPopup(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);

        mTrack.setColor(trackColor);
        mThumb.setColor(thumbColor);
        mPopup.setBgColor(popupBgColor);
        mPopup.setTextColor(popupTextColor);
    } 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.gxy.fastscrollrecyclerview.views.FastScroller.java

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

    Resources resources = context.getResources();
    mRecyclerView = recyclerView;/* w w  w  .ja v  a2 s .c o  m*/
    mPopup = new FastScrollPopup(resources, recyclerView);
    mThumbHeight = Utils.toPixels(resources, 32);
    mWidth = Utils.toPixels(resources, 4);
    mWidthBg = Utils.toPixels(resources, 2);
    mTouchInset = Utils.toPixels(resources, -30);
    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);

        mTrack.setColor(trackColor);
        mThumb.setColor(thumbColor);
        mPopup.setBgColor(popupBgColor);
        mPopup.setTextColor(popupTextColor);
    } 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:io.hefuyi.listener.widget.fastscroller.FastScroller.java

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

    Resources resources = context.getResources();

    mRecyclerView = recyclerView;/*from  w  ww.  j  a  va2s  .  co  m*/
    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,
                ATEUtil.getThemePrimaryColor(context));
        int popupBgColor = typedArray.getColor(R.styleable.FastScrollRecyclerView_fastScrollPopupBgColor,
                ATEUtil.getThemePrimaryColor(context));
        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",
                        (ListenerUtil.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.google.samples.apps.topeka.fragment.QuizFragment.java

@SuppressWarnings("ConstantConditions")
private void setAvatarDrawable(AvatarView avatarView) {
    Player player = PreferencesHelper.getPlayer(getActivity());
    avatarView.setAvatar(player.getAvatar().getDrawableId());
    ViewCompat.animate(avatarView).setInterpolator(new FastOutLinearInInterpolator()).setStartDelay(500)
            .scaleX(1).scaleY(1).start();
}

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

private static ViewPropertyAnimator animateFadeOut(View view, int duration, int delay,
        TimeInterpolator interpolator) {
    view.setAlpha(1);/* www.  j a va  2s .c o  m*/
    ViewPropertyAnimator propertyAnimator = view.animate().alpha(0).setStartDelay(delay).setDuration(duration);
    if (interpolator != null) {
        propertyAnimator.setInterpolator(interpolator);
    } else {
        propertyAnimator.setInterpolator(new FastOutLinearInInterpolator());
    }

    return propertyAnimator;
}