List of usage examples for android.support.v4.view ViewPropertyAnimatorCompat setListener
public ViewPropertyAnimatorCompat setListener(ViewPropertyAnimatorListener viewPropertyAnimatorListener)
From source file:Main.java
public static void animteViewsOut(ViewPropertyAnimatorListener listener, View... views) { for (int i = 0; i < views.length; i++) { ViewPropertyAnimatorCompat animator = ViewCompat.animate(views[i]).alpha(0f).setDuration(800) .setStartDelay(i * 100).setInterpolator(new AccelerateInterpolator()); if ((i + 1) == views.length) { animator.setListener(listener).start(); } else {// w w w.jav a 2s.c o m animator.start(); } } }
From source file:com.example.carlitos.swipeitemrecycler.view.animation.swipe_item.animator.impl.BaseItemAnimationManager.java
protected void startActiveItemAnimation(T info, RecyclerView.ViewHolder holder, ViewPropertyAnimatorCompat animator) { animator.setListener(new BaseAnimatorListener(this, info, holder, animator)); addActiveAnimationTarget(holder);/*w w w .j av a 2s . c o m*/ animator.start(); }
From source file:de.base.utility.animators.FadeInAnimator.java
private void animateAdd(View view, @Nullable RecyclerView.ViewHolder holder, Runnable startAction, Runnable endAction) {// w w w.ja va 2s . c o m ViewPropertyAnimatorCompat viewAnimator = ViewCompat.animate(view).alpha(1).setDuration(getAddDuration()) .setInterpolator(mInterpolator); if (holder != null) viewAnimator.setListener(new DefaultAddVpaListener(holder)); if (startAction != null) viewAnimator.withStartAction(startAction); if (endAction != null) viewAnimator.withEndAction(endAction); viewAnimator.start(); }
From source file:de.base.utility.animators.FadeInAnimator.java
private void animateRemove(View view, @Nullable RecyclerView.ViewHolder holder, Runnable startAction, Runnable endAction) {/* w ww . j a v a 2 s . c o m*/ ViewPropertyAnimatorCompat viewAnimator = ViewCompat.animate(view).alpha(0).setDuration(getRemoveDuration()) .setInterpolator(mInterpolator); if (holder != null) viewAnimator.setListener(new DefaultRemoveVpaListener(holder)); if (startAction != null) viewAnimator.withStartAction(startAction); if (endAction != null) viewAnimator.withEndAction(endAction); viewAnimator.start(); }
From source file:de.base.utility.animators.SlideInDownAnimator.java
private void animateAdd(View view, @Nullable RecyclerView.ViewHolder holder) { ViewPropertyAnimatorCompat viewAnimator = ViewCompat.animate(view).translationY(0).alpha(1) .setDuration(getAddDuration()).setInterpolator(mInterpolator); if (holder != null) { viewAnimator.setListener(new DefaultAddVpaListener(holder)); }/* w w w. j a v a 2 s . c om*/ viewAnimator.start(); }
From source file:de.base.utility.animators.ScaleInAnimator.java
private void animateAdd(View view, float scale, Runnable startAction, Runnable endAction, @Nullable RecyclerView.ViewHolder holder) { ViewPropertyAnimatorCompat viewAnimator = ViewCompat.animate(view).scaleX(scale).scaleY(scale) .setDuration(getAddDuration()).setInterpolator(mInterpolator); if (holder != null) viewAnimator.setListener(new DefaultAddVpaListener(holder)); if (startAction != null) viewAnimator.withStartAction(startAction); if (endAction != null) viewAnimator.withEndAction(endAction); viewAnimator.start();// w w w .j a va2s. co m }
From source file:de.base.utility.animators.ScaleInAnimator.java
private void animateRemove(View view, float scale, Runnable startAction, Runnable endAction, @Nullable RecyclerView.ViewHolder holder) { ViewPropertyAnimatorCompat viewAnimator = ViewCompat.animate(view).scaleX(scale).scaleY(scale) .setDuration(getRemoveDuration()).setInterpolator(mInterpolator); if (holder != null) viewAnimator.setListener(new DefaultRemoveVpaListener(holder)); if (startAction != null) viewAnimator.withStartAction(startAction); if (endAction != null) viewAnimator.withEndAction(endAction); viewAnimator.start();//from w ww. ja v a 2 s . c o m }
From source file:de.base.utility.animators.SlideInUpAnimator.java
private void animateRemove(View view, @Nullable RecyclerView.ViewHolder holder) { ViewPropertyAnimatorCompat viewAnimator = ViewCompat.animate(view).translationY(view.getHeight()).alpha(0) .setDuration(getRemoveDuration()).setInterpolator(mInterpolator); if (holder != null) { viewAnimator.setListener(new DefaultRemoveVpaListener(holder)); }/*from w w w . java 2s. c o m*/ viewAnimator.start(); }
From source file:de.base.utility.animators.SlideInDownAnimator.java
private void animateRemove(View view, @Nullable RecyclerView.ViewHolder holder) { ViewPropertyAnimatorCompat viewAnimator = ViewCompat.animate(view).translationY(-view.getHeight()).alpha(0) .setDuration(getRemoveDuration()).setInterpolator(mInterpolator); if (holder != null) { viewAnimator.setListener(new DefaultRemoveVpaListener(holder)); }/*from w w w . j a v a 2s . co m*/ viewAnimator.start(); }
From source file:vc908.stickerfactory.ui.advancedrecyclerview.draggable.BaseDraggableItemDecorator.java
protected void moveToDefaultPosition(View targetView, boolean animate) { final int curTranslationY = (int) (ViewCompat.getTranslationY(targetView)); final int halfItemHeight = targetView.getHeight() / 2; final float translationProportion = (halfItemHeight > 0) ? Math.abs((float) curTranslationY / halfItemHeight) : 0;/* www . j a va 2 s . co m*/ final float t = 1.0f - Math.min(translationProportion, 1.0f); final int animDuration = (int) (mReturnToDefaultPositionDuration * (1.0f - (t * t)) + 0.5f); if (supportsViewPropertyAnimation() && animate && (animDuration > RETURN_TO_DEFAULT_POS_ANIMATE_THRESHOLD_MSEC) && (Math.abs(curTranslationY) > mReturnToDefaultPositionAnimateThreshold)) { final ViewPropertyAnimatorCompat animator = ViewCompat.animate(targetView); animator.cancel(); animator.setDuration(animDuration); animator.setInterpolator(mReturnToDefaultPositionInterpolator); animator.translationY(0.0f); animator.setListener(new ViewPropertyAnimatorListener() { @Override public void onAnimationStart(View view) { } @Override public void onAnimationEnd(View view) { animator.setListener(null); ViewCompat.setTranslationY(view, 0); // invalidate explicitly to refresh other decorations if (view.getParent() instanceof RecyclerView) { ViewCompat.postInvalidateOnAnimation((RecyclerView) view.getParent()); } } @Override public void onAnimationCancel(View view) { } }); animator.start(); } else { ViewCompat.setTranslationY(targetView, 0); } }