Search in sources :

Example 1 with ProgressCardView

use of org.wikipedia.feed.progress.ProgressCardView in project apps-android-wikipedia by wikimedia.

the class FeedItemAnimator method animateAddImpl.

private void animateAddImpl(final ViewHolder holder) {
    final View view = holder.itemView;
    if (view instanceof ProgressCardView) {
        view.setAlpha(1);
        view.setTranslationY(0);
        dispatchAddFinished(holder);
        mAddAnimations.remove(holder);
        return;
    }
    final ViewPropertyAnimator animation = view.animate();
    mAddAnimations.add(holder);
    animation.alpha(1).translationY(0).setDuration(getAddDuration()).setListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationStart(Animator animator) {
            dispatchAddStarting(holder);
        }

        @Override
        public void onAnimationCancel(Animator animator) {
            view.setTranslationY(0);
        }

        @Override
        public void onAnimationEnd(Animator animator) {
            animation.setListener(null);
            dispatchAddFinished(holder);
            mAddAnimations.remove(holder);
            dispatchFinishedWhenDone();
        }
    }).start();
}
Also used : Animator(android.animation.Animator) ViewPropertyAnimator(android.view.ViewPropertyAnimator) ValueAnimator(android.animation.ValueAnimator) SimpleItemAnimator(android.support.v7.widget.SimpleItemAnimator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) View(android.view.View) ProgressCardView(org.wikipedia.feed.progress.ProgressCardView) ProgressCardView(org.wikipedia.feed.progress.ProgressCardView) ViewPropertyAnimator(android.view.ViewPropertyAnimator)

Aggregations

Animator (android.animation.Animator)1 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)1 ValueAnimator (android.animation.ValueAnimator)1 SimpleItemAnimator (android.support.v7.widget.SimpleItemAnimator)1 View (android.view.View)1 ViewPropertyAnimator (android.view.ViewPropertyAnimator)1 ProgressCardView (org.wikipedia.feed.progress.ProgressCardView)1