List of usage examples for android.support.v4.view ViewPropertyAnimatorCompat setListener
public ViewPropertyAnimatorCompat setListener(ViewPropertyAnimatorListener viewPropertyAnimatorListener)
From source file:com.brioal.libmanager.itemanimator.BaseItemAnimator.java
private void animateAddImpl(final ViewHolder holder) { final ViewPropertyAnimatorCompat animation = onAnimatedAdd(holder); mAddAnimations.add(holder);// w w w. j av a 2 s. com animation.alpha(1).setDuration(getAddDuration()).setListener(new VpaListenerAdapter() { @Override public void onAnimationStart(View view) { dispatchAddStarting(holder); } @Override public void onAnimationCancel(View view) { ViewCompat.setAlpha(view, 1); } @Override public void onAnimationEnd(View view) { animation.setListener(null); dispatchAddFinished(holder); mAddAnimations.remove(holder); dispatchFinishedWhenDone(); } }).start(); }
From source file:com.example.recyclerview.MyItemAnimator.java
private void animateRemoveImpl(final ViewHolder holder) { final View view = holder.itemView; final ViewPropertyAnimatorCompat animation = ViewCompat.animate(view); mRemoveAnimations.add(holder);/*from w ww . j a v a 2 s .c o m*/ animation.setDuration(getRemoveDuration()).alpha(0).translationX(view.getWidth() / 2) .setListener(new VpaListenerAdapter() { @Override public void onAnimationStart(View view) { dispatchRemoveStarting(holder); } @Override public void onAnimationEnd(View view) { animation.setListener(null); ViewCompat.setTranslationX(view, 0); ViewCompat.setAlpha(view, 1); dispatchRemoveFinished(holder); mRemoveAnimations.remove(holder); dispatchFinishedWhenDone(); } }).start(); }
From source file:com.jash.expandablerecycler.MyItemAnimator.java
private void animateRemoveImpl(final ViewHolder holder, int i) { final View view = holder.itemView; final ViewPropertyAnimatorCompat animation = ViewCompat.animate(view); mRemoveAnimations.add(holder);/*from w ww . j av a 2 s. com*/ animation.setStartDelay(i * 100).setDuration(getRemoveDuration()).translationX(view.getWidth()) .setListener(new VpaListenerAdapter() { @Override public void onAnimationStart(View view) { dispatchRemoveStarting(holder); } @Override public void onAnimationEnd(View view) { animation.setListener(null); ViewCompat.setTranslationX(view, 0); dispatchRemoveFinished(holder); mRemoveAnimations.remove(holder); dispatchFinishedWhenDone(); } }).start(); }
From source file:com.freshdigitable.udonroad.TimelineAnimator.java
private void animateMoveImpl(final Move move) { // Log.d(TAG, "animateMoveImpl: " + debugString(move.holder)); moveAnimations.add(move.holder);//ww w . j a v a 2 s . c o m final ViewPropertyAnimatorCompat animate = ViewCompat.animate(move.holder.itemView); if (move.deltaX() != 0) { animate.translationX(0); } if (move.deltaY() != 0) { animate.translationY(0); } animate.setDuration(getMoveDuration()).setListener(new ViewPropertyAnimatorListenerAdapter() { @Override public void onAnimationStart(View view) { dispatchMoveStarting(move.holder); } @Override public void onAnimationEnd(View view) { animate.setListener(null); dispatchMoveFinished(move.holder); moveAnimations.remove(move.holder); dispatchFinishedWhenDone(); } @Override public void onAnimationCancel(View view) { if (move.deltaX() != 0) { ViewCompat.setTranslationX(view, 0); } if (move.deltaY() != 0) { ViewCompat.setTranslationY(view, 0); } } }).start(); }
From source file:com.hanbing.library.android.view.recycler.animator.BaseItemAnimator.java
protected void animateAddImpl(final RecyclerView.ViewHolder holder) { final View view = holder.itemView; final ViewPropertyAnimatorCompat animation = ViewCompat.animate(view); mAddAnimations.add(holder);// ww w. jav a 2 s . c om animation.setDuration(getAddDuration()).setListener(new VpaListenerAdapter() { @Override public void onAnimationStart(View view) { dispatchAddStarting(holder); } @Override public void onAnimationCancel(View view) { afterAnimateAdd(holder); } @Override public void onAnimationEnd(View view) { animation.setListener(null); dispatchAddFinished(holder); mAddAnimations.remove(holder); dispatchFinishedWhenDone(); } }); actAnimateAdd(holder, animation); }
From source file:android.support.v7.widget.CustomItemAnimator.java
private void animateAddImpl(final ViewHolder holder) { final View view = holder.itemView; final ViewPropertyAnimatorCompat animation = ViewCompat.animate(view); mAddAnimations.add(holder);//from ww w . j a va 2 s .c o m animation.alpha(1).setDuration(getAddDuration()).setListener(new VpaListenerAdapter() { @Override public void onAnimationStart(View view) { dispatchAddStarting(holder); } @Override public void onAnimationCancel(View view) { ViewCompat.setAlpha(view, 1); } @Override public void onAnimationEnd(View view) { animation.setListener(null); dispatchAddFinished(holder); mAddAnimations.remove(holder); dispatchFinishedWhenDone(); } }).start(); }
From source file:net.simonvt.cathode.widget.ScalingItemAnimator.java
private void animateChangeImpl(final ChangeInfo changeInfo) { final ViewHolder holder = changeInfo.oldHolder; final View view = holder.itemView; final ViewHolder newHolder = changeInfo.newHolder; final View newView = newHolder != null ? newHolder.itemView : null; changeAnimations.add(changeInfo.oldHolder); final ViewPropertyAnimatorCompat oldViewAnim = ViewCompat.animate(view).setDuration(getChangeDuration()); oldViewAnim.translationX(changeInfo.toX - changeInfo.fromX); oldViewAnim.translationY(changeInfo.toY - changeInfo.fromY); oldViewAnim.alpha(0).setListener(new VpaListenerAdapter() { @Override//from www . java 2 s .c o m public void onAnimationStart(View view) { dispatchChangeStarting(changeInfo.oldHolder, true); } @Override public void onAnimationEnd(View view) { oldViewAnim.setListener(null); ViewCompat.setAlpha(view, 1); ViewCompat.setTranslationX(view, 0); ViewCompat.setTranslationY(view, 0); dispatchChangeFinished(changeInfo.oldHolder, true); changeAnimations.remove(changeInfo.oldHolder); dispatchFinishedWhenDone(); } }).start(); if (newView != null) { changeAnimations.add(changeInfo.newHolder); final ViewPropertyAnimatorCompat newViewAnimation = ViewCompat.animate(newView); newViewAnimation.translationX(0).translationY(0).setDuration(getChangeDuration()).alpha(1) .setListener(new VpaListenerAdapter() { @Override public void onAnimationStart(View view) { dispatchChangeStarting(changeInfo.newHolder, false); } @Override public void onAnimationEnd(View view) { newViewAnimation.setListener(null); ViewCompat.setAlpha(newView, 1); ViewCompat.setTranslationX(newView, 0); ViewCompat.setTranslationY(newView, 0); dispatchChangeFinished(changeInfo.newHolder, false); changeAnimations.remove(changeInfo.newHolder); dispatchFinishedWhenDone(); } }).start(); } }
From source file:net.simonvt.cathode.widget.ScalingItemAnimator.java
private void animateAddImpl(final ViewHolder holder) { final View view = holder.itemView; addAnimations.add(holder);//from w ww .j a va2 s . com final ViewPropertyAnimatorCompat animation = ViewCompat.animate(view); animation.alpha(1).scaleY(1).setDuration(getAddDuration()).setListener(new VpaListenerAdapter() { @Override public void onAnimationStart(View view) { dispatchAddStarting(holder); } @Override public void onAnimationCancel(View view) { ViewCompat.setAlpha(view, 1); ViewCompat.setScaleY(view, 1); } @Override public void onAnimationEnd(View view) { animation.setListener(null); dispatchAddFinished(holder); addAnimations.remove(holder); dispatchFinishedWhenDone(); } }).start(); }
From source file:com.bwie.myrecyclerviewdemo1.MyitemAnimator.java
void animateAddImpl(final ViewHolder holder) { final View view = holder.itemView; final ViewPropertyAnimatorCompat animation = ViewCompat.animate(view); mAddAnimations.add(holder);/* ww w .j a va 2 s .c o m*/ animation.alpha(1).setDuration(getAddDuration()).setListener(new VpaListenerAdapter() { @Override public void onAnimationStart(View view) { dispatchAddStarting(holder); } @Override public void onAnimationCancel(View view) { ViewCompat.setAlpha(view, 1); } @Override public void onAnimationEnd(View view) { animation.setListener(null); dispatchAddFinished(holder); mAddAnimations.remove(holder); dispatchFinishedWhenDone(); } }).start(); }
From source file:com.example.administrator.demorecyler.MyItemAnimator.java
private void animateChangeImpl(final ChangeInfo changeInfo) { final ViewHolder holder = changeInfo.oldHolder; final View view = holder.itemView; final ViewHolder newHolder = changeInfo.newHolder; final View newView = newHolder != null ? newHolder.itemView : null; mChangeAnimations.add(changeInfo.oldHolder); final ViewPropertyAnimatorCompat oldViewAnim = ViewCompat.animate(view).setDuration(getChangeDuration()); oldViewAnim.translationX(changeInfo.toX - changeInfo.fromX); oldViewAnim.translationY(changeInfo.toY - changeInfo.fromY); oldViewAnim.alpha(0).setListener(new VpaListenerAdapter() { @Override/*from w w w. java 2 s. c o m*/ public void onAnimationStart(View view) { dispatchChangeStarting(changeInfo.oldHolder, true); } @Override public void onAnimationEnd(View view) { oldViewAnim.setListener(null); ViewCompat.setAlpha(view, 1); ViewCompat.setTranslationX(view, 0); ViewCompat.setTranslationY(view, 0); dispatchChangeFinished(changeInfo.oldHolder, true); mChangeAnimations.remove(changeInfo.oldHolder); dispatchFinishedWhenDone(); } }).start(); if (newView != null) { mChangeAnimations.add(changeInfo.newHolder); final ViewPropertyAnimatorCompat newViewAnimation = ViewCompat.animate(newView); newViewAnimation.translationX(0).translationY(0).setDuration(getChangeDuration()).alpha(1) .setListener(new VpaListenerAdapter() { @Override public void onAnimationStart(View view) { dispatchChangeStarting(changeInfo.newHolder, false); } @Override public void onAnimationEnd(View view) { newViewAnimation.setListener(null); ViewCompat.setAlpha(newView, 1); ViewCompat.setTranslationX(newView, 0); ViewCompat.setTranslationY(newView, 0); dispatchChangeFinished(changeInfo.newHolder, false); mChangeAnimations.remove(changeInfo.newHolder); dispatchFinishedWhenDone(); } }).start(); } }