Search in sources :

Example 51 with Animator

use of com.nineoldandroids.animation.Animator in project ride-read-android by Ride-Read.

the class ShowPictureActivity method MoveView.

private void MoveView() {
    ObjectAnimator.ofFloat(mainView, "alpha", 0.8f).setDuration(0).start();
    mainView.setVisibility(View.VISIBLE);
    AnimatorSet set = new AnimatorSet();
    set.playTogether(ObjectAnimator.ofFloat(showImageView, "translationX", tx).setDuration(200), ObjectAnimator.ofFloat(showImageView, "translationY", ty).setDuration(200), ObjectAnimator.ofFloat(mainView, "alpha", 1).setDuration(200));
    set.addListener(new Animator.AnimatorListener() {

        @Override
        public void onAnimationStart(Animator animator) {
        }

        @Override
        public void onAnimationEnd(Animator animator) {
            showImageView.setScaleType(ImageView.ScaleType.FIT_XY);
            spring.setEndValue(1);
        }

        @Override
        public void onAnimationCancel(Animator animator) {
        }

        @Override
        public void onAnimationRepeat(Animator animator) {
        }
    });
    set.start();
}
Also used : Animator(com.nineoldandroids.animation.Animator) ObjectAnimator(com.nineoldandroids.animation.ObjectAnimator) AnimatorSet(com.nineoldandroids.animation.AnimatorSet)

Example 52 with Animator

use of com.nineoldandroids.animation.Animator in project ride-read-android by Ride-Read.

the class ShowPictureActivity method MoveBackView.

private void MoveBackView() {
    AnimatorSet set = new AnimatorSet();
    set.playTogether(ObjectAnimator.ofFloat(showImageView, "translationX", to_x).setDuration(200), ObjectAnimator.ofFloat(showImageView, "translationY", to_y).setDuration(200));
    set.addListener(new Animator.AnimatorListener() {

        @Override
        public void onAnimationStart(Animator animator) {
        }

        @Override
        public void onAnimationEnd(Animator animator) {
            finish();
        }

        @Override
        public void onAnimationCancel(Animator animator) {
        }

        @Override
        public void onAnimationRepeat(Animator animator) {
        }
    });
    set.start();
}
Also used : Animator(com.nineoldandroids.animation.Animator) ObjectAnimator(com.nineoldandroids.animation.ObjectAnimator) AnimatorSet(com.nineoldandroids.animation.AnimatorSet)

Example 53 with Animator

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

the class SwipeListViewTouchListener method generateRevealAnimate.

/**
     * Create reveal animation
     *
     * @param view      affected view
     * @param swap      If will change state. If "false" returns to the original position
     * @param swapRight If swap is true, this parameter tells if movement is toward right or left
     * @param position  list position
     */
private void generateRevealAnimate(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);
        }
    }
    animate(view).translationX(moveTo).setDuration(animationTime).setListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            swipeListView.resetScrolling();
            if (swap) {
                boolean aux = !opened.get(position);
                opened.set(position, aux);
                if (aux) {
                    swipeListView.onOpened(position, swapRight);
                    openedRight.set(position, swapRight);
                } else {
                    swipeListView.onClosed(position, openedRight.get(position));
                }
            }
            resetCell();
        }
    });
}
Also used : ValueAnimator(com.nineoldandroids.animation.ValueAnimator) Animator(com.nineoldandroids.animation.Animator) AnimatorListenerAdapter(com.nineoldandroids.animation.AnimatorListenerAdapter)

Example 54 with Animator

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

the class SwipeListViewTouchListener method performDismiss.

/**
     * Perform dismiss action
     *
     * @param dismissView     View
     * @param dismissPosition Position of list
     */
protected void performDismiss(final View dismissView, final int dismissPosition, boolean doPendingDismiss) {
    final ViewGroup.LayoutParams lp = dismissView.getLayoutParams();
    final int originalHeight = dismissView.getHeight();
    ValueAnimator animator = ValueAnimator.ofInt(originalHeight, 1).setDuration(animationTime);
    if (doPendingDismiss) {
        animator.addListener(new AnimatorListenerAdapter() {

            @Override
            public void onAnimationEnd(Animator animation) {
                --dismissAnimationRefCount;
                if (dismissAnimationRefCount == 0) {
                    removePendingDismisses(originalHeight);
                }
            }
        });
    }
    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator valueAnimator) {
            lp.height = (Integer) valueAnimator.getAnimatedValue();
            dismissView.setLayoutParams(lp);
        }
    });
    pendingDismisses.add(new PendingDismissData(dismissPosition, dismissView));
    animator.start();
}
Also used : ValueAnimator(com.nineoldandroids.animation.ValueAnimator) Animator(com.nineoldandroids.animation.Animator) AnimatorListenerAdapter(com.nineoldandroids.animation.AnimatorListenerAdapter) ValueAnimator(com.nineoldandroids.animation.ValueAnimator)

Example 55 with Animator

use of com.nineoldandroids.animation.Animator in project AndroidSweetSheet by zzz40500.

the class Delegate method dismissShowdown.

/**
     * 隐藏模糊背景
     */
protected void dismissShowdown() {
    ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(mBg, "alpha", 1, 0);
    objectAnimator.setDuration(400);
    objectAnimator.start();
    objectAnimator.addListener(new SimpleAnimationListener() {

        @Override
        public void onAnimationEnd(Animator animation) {
            mParentVG.removeView(mBg);
        }
    });
}
Also used : ObjectAnimator(com.nineoldandroids.animation.ObjectAnimator) Animator(com.nineoldandroids.animation.Animator) ObjectAnimator(com.nineoldandroids.animation.ObjectAnimator) SimpleAnimationListener(com.mingle.SimpleAnimationListener)

Aggregations

Animator (com.nineoldandroids.animation.Animator)136 ValueAnimator (com.nineoldandroids.animation.ValueAnimator)81 AnimatorListenerAdapter (com.nineoldandroids.animation.AnimatorListenerAdapter)68 ObjectAnimator (com.nineoldandroids.animation.ObjectAnimator)49 StateAnimator (carbon.animation.StateAnimator)29 View (android.view.View)24 AnimatorSet (com.nineoldandroids.animation.AnimatorSet)24 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)11 Interpolator (android.view.animation.Interpolator)11 Reveal (carbon.internal.Reveal)11 RecyclerView (android.support.v7.widget.RecyclerView)5 AccelerateDecelerateInterpolator (android.view.animation.AccelerateDecelerateInterpolator)5 AccelerateInterpolator (android.view.animation.AccelerateInterpolator)5 Paint (android.graphics.Paint)4 SimpleItemAnimator (android.support.v7.widget.SimpleItemAnimator)4 ViewGroup (android.view.ViewGroup)4 OvershootInterpolator (android.view.animation.OvershootInterpolator)4 ArcAnimator (io.codetail.animation.arcanimator.ArcAnimator)4 GestureDetector (android.view.GestureDetector)3 MotionEvent (android.view.MotionEvent)3