Search in sources :

Example 66 with AnimatorListenerAdapter

use of com.nineoldandroids.animation.AnimatorListenerAdapter in project PhotoNoter by yydcdut.

the class ZoomHeaderImageView method doAnimation.

private void doAnimation() {
    AnimatorSet animatorSet = new AnimatorSet();
    if (mCurrentIndex % 2 == 0) {
        animatorSet.playTogether(ObjectAnimator.ofFloat(mImageView0, "scaleX", 1f, 1.3f), ObjectAnimator.ofFloat(mImageView0, "scaleY", 1f, 1.3f), ObjectAnimator.ofFloat(mImageView0, "alpha", 1f, 0.0f), ObjectAnimator.ofFloat(mImageView1, "scaleX", 1.3f, 1.0f), ObjectAnimator.ofFloat(mImageView1, "scaleY", 1.3f, 1.0f), ObjectAnimator.ofFloat(mImageView1, "alpha", 0.0f, 1.0f));
    } else {
        animatorSet.playTogether(ObjectAnimator.ofFloat(mImageView1, "scaleX", 1f, 1.3f), ObjectAnimator.ofFloat(mImageView1, "scaleY", 1f, 1.3f), ObjectAnimator.ofFloat(mImageView1, "alpha", 1f, 0.0f), ObjectAnimator.ofFloat(mImageView0, "scaleX", 1.3f, 1.0f), ObjectAnimator.ofFloat(mImageView0, "scaleY", 1.3f, 1.0f), ObjectAnimator.ofFloat(mImageView0, "alpha", 0.0f, 1.0f));
    }
    animatorSet.setDuration(400).addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationStart(Animator animation) {
            mImageView0.setVisibility(VISIBLE);
            mImageView1.setVisibility(VISIBLE);
            if (mCurrentIndex % 2 == 0) {
                mImageView1.setImageResource(mResArray[(mCurrentIndex + 1) % 5]);
            } else {
                mImageView0.setImageResource(mResArray[(mCurrentIndex + 1) % 5]);
            }
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            mCurrentIndex++;
            if (mCurrentIndex % 2 == 0) {
                mImageView1.setVisibility(INVISIBLE);
            } else {
                mImageView0.setVisibility(INVISIBLE);
            }
            mHandler.sendEmptyMessageDelayed(0, 3000);
        }
    });
    animatorSet.start();
}
Also used : ObjectAnimator(com.nineoldandroids.animation.ObjectAnimator) Animator(com.nineoldandroids.animation.Animator) AnimatorListenerAdapter(com.nineoldandroids.animation.AnimatorListenerAdapter) AnimatorSet(com.nineoldandroids.animation.AnimatorSet)

Example 67 with AnimatorListenerAdapter

use of com.nineoldandroids.animation.AnimatorListenerAdapter in project AisenWeiBo by wangdan.

the class FabAnimation method startArcAnim.

protected void startArcAnim(View view, float endX, float endY, float degrees, Side side, long duration, Interpolator interpolator, final AnimationListener listener) {
    // Setup animation
    // Cast end coordinates to ints so that the FAB will be animated to the same position even
    // when there are minute differences in the coordinates
    ArcAnimator anim = ArcAnimator.createArcAnimator(view, (int) endX, (int) endY, degrees, side);
    anim.setDuration(duration);
    anim.setInterpolator(interpolator);
    // Add listener
    anim.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationStart(Animator animation) {
            if (listener != null) {
                listener.onStart();
            }
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            if (listener != null) {
                listener.onEnd();
            }
        }
    });
    // Start animation
    anim.start();
}
Also used : Animator(com.nineoldandroids.animation.Animator) ArcAnimator(org.aisen.weibo.sina.ui.widget.io.codetail.animation.arcanimator.ArcAnimator) AnimatorListenerAdapter(com.nineoldandroids.animation.AnimatorListenerAdapter) ArcAnimator(org.aisen.weibo.sina.ui.widget.io.codetail.animation.arcanimator.ArcAnimator)

Example 68 with AnimatorListenerAdapter

use of com.nineoldandroids.animation.AnimatorListenerAdapter in project SunDay by iQuick.

the class SwipeListViewTouchListener method generateDismissAnimate.

/**
     * Create dismiss animation
     *
     * @param view      affected view
     * @param swap      If will change state. If is "false" returns to the original position
     * @param swapRight If swap is true, this parameter tells if move is to the right or left
     * @param position  Position of list
     */
private void generateDismissAnimate(final View view, final boolean swap, final boolean swapRight, final int position) {
    int moveTo = 0;
    if (opened.get(position)) {
        if (!swap) {
            moveTo = openedRight.get(position) ? (int) (viewWidth - rightOffset) : (int) (-viewWidth + leftOffset);
        }
    } else {
        if (swap) {
            moveTo = swapRight ? (int) (viewWidth - rightOffset) : (int) (-viewWidth + leftOffset);
        }
    }
    int alpha = 1;
    if (swap) {
        ++dismissAnimationRefCount;
        alpha = 0;
    }
    animate(view).translationX(moveTo).alpha(alpha).setDuration(animationTime).setListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            if (swap) {
                closeOpenedItems();
                performDismiss(view, position, true);
            }
            resetCell();
        }
    });
}
Also used : ValueAnimator(com.nineoldandroids.animation.ValueAnimator) Animator(com.nineoldandroids.animation.Animator) AnimatorListenerAdapter(com.nineoldandroids.animation.AnimatorListenerAdapter)

Aggregations

Animator (com.nineoldandroids.animation.Animator)68 AnimatorListenerAdapter (com.nineoldandroids.animation.AnimatorListenerAdapter)68 ValueAnimator (com.nineoldandroids.animation.ValueAnimator)49 StateAnimator (carbon.animation.StateAnimator)29 ObjectAnimator (com.nineoldandroids.animation.ObjectAnimator)16 Interpolator (android.view.animation.Interpolator)11 Reveal (carbon.internal.Reveal)11 AnimatorSet (com.nineoldandroids.animation.AnimatorSet)11 View (android.view.View)10 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)7 RecyclerView (android.support.v7.widget.RecyclerView)5 SimpleItemAnimator (android.support.v7.widget.SimpleItemAnimator)4 MotionEvent (android.view.MotionEvent)3 ViewGroup (android.view.ViewGroup)3 ViewPropertyAnimator (android.view.ViewPropertyAnimator)3 AbsListView (android.widget.AbsListView)2 ListView (android.widget.ListView)2 TextView (android.widget.TextView)2 IDetailView (com.yydcdut.note.views.note.IDetailView)2 FontTextView (com.yydcdut.note.widget.FontTextView)2