List of usage examples for android.support.v4.view ViewPropertyAnimatorCompat setListener
public ViewPropertyAnimatorCompat setListener(ViewPropertyAnimatorListener viewPropertyAnimatorListener)
From source file:com.example.lining.mydemo.animator.MyItemAnimator.java
void animateAddImpl(final ViewHolder holder) { final View view = holder.itemView; final ViewPropertyAnimatorCompat animation = ViewCompat.animate(view); mAddAnimations.add(holder);//from w ww . ja v a2 s . c om //animation.alpha(1).setDuration(getAddDuration()). animation.translationX(0).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
void animateAddImpl(final ViewHolder holder) { final View view = holder.itemView; final ViewPropertyAnimatorCompat animation = ViewCompat.animate(view); mAddAnimations.add(holder);/*from w ww .j a v a2 s .c o m*/ animation./*alpha(1)*/translationX(0).setDuration(getAddDuration()).setListener(new VpaListenerAdapter() { @Override public void onAnimationStart(View view) { dispatchAddStarting(holder); } @Override public void onAnimationCancel(View view) { ViewCompat.setAlpha(view, 1); ViewCompat.setTranslationX(view, 0); } @Override public void onAnimationEnd(View view) { animation.setListener(null); dispatchAddFinished(holder); mAddAnimations.remove(holder); dispatchFinishedWhenDone(); } }).start(); }
From source file:com.example.lining.mydemo.animator.MyItemAnimator.java
private void animateRemoveImpl(final ViewHolder holder) { final View view = holder.itemView;//ItemView final ViewPropertyAnimatorCompat animation = ViewCompat.animate(view);//? mRemoveAnimations.add(holder);//?VIew animation.setDuration(getRemoveDuration())// .translationX(view.getWidth()).setListener(new VpaListenerAdapter() {//listener?? @Override/* www .jav a 2 s . c om*/ public void onAnimationStart(View view) { dispatchRemoveStarting(holder); } @Override public void onAnimationEnd(View view) { animation.setListener(null);//??? //ViewCompat.setAlpha(view, 1);//?????? ViewCompat.setTranslationX(view, 0);//?????? dispatchRemoveFinished(holder); mRemoveAnimations.remove(holder); dispatchFinishedWhenDone(); } }).start(); }
From source file:com.mypopsy.floatingsearchview.BaseItemAnimator.java
private void animateAddImpl(final ViewHolder holder) { final ViewPropertyAnimatorCompat animation = onAnimateAdd(holder); if (animation == null) { dispatchAddFinished(holder);/* ww w . j av a2 s .co m*/ return; } mAddAnimations.add(holder); animation.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.jp.wasabeef.recyclerview.animators.BaseItemAnimator.java
private void animateChangeImpl(final ChangeInfo changeInfo) { final ViewHolder holder = changeInfo.oldHolder; final View view = holder == null ? null : holder.itemView; final ViewHolder newHolder = changeInfo.newHolder; final View newView = newHolder != null ? newHolder.itemView : null; if (view != null) { mChangeAnimations.add(changeInfo.oldHolder); final ViewPropertyAnimatorCompat oldViewAnim = ViewCompat.animate(view) .setDuration(getChangeDuration()); oldViewAnim.translationX(-view.getRootView().getWidth()); oldViewAnim.alpha(0).setListener(new VpaListenerAdapter() { @Override//from w ww. j a v a 2s. c om public void onAnimationStart(View view) { dispatchChangeStarting(changeInfo.oldHolder, true); } @Override public void onAnimationEnd(View view) { oldViewAnim.setListener(null); ViewCompat.setAlpha(view, 0); dispatchChangeFinished(changeInfo.oldHolder, true); mChangeAnimations.remove(changeInfo.oldHolder); dispatchFinishedWhenDone(); } }).start(); } // ViewCompat.animate(view) // .translationX(-view.getRootView().getWidth()) // .setDuration(getChangeDuration()) // .start(); // if (view != 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 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(); // } }
From source file:aloha.shiningstarbase.util.itemanimator.BaseItemAnimator.java
private void animateChangeImpl(final ChangeInfo changeInfo) { final RecyclerView.ViewHolder holder = changeInfo.oldHolder; final View view = holder == null ? null : holder.itemView; final RecyclerView.ViewHolder newHolder = changeInfo.newHolder; final View newView = newHolder != null ? newHolder.itemView : null; if (view != null) { final ViewPropertyAnimatorCompat oldViewAnim = ViewCompat.animate(view) .setDuration(getChangeDuration()); mChangeAnimations.add(changeInfo.oldHolder); oldViewAnim.translationX(changeInfo.toX - changeInfo.fromX); oldViewAnim.translationY(changeInfo.toY - changeInfo.fromY); oldViewAnim.alpha(0).setListener(new VpaListenerAdapter() { @Override/*w w w .ja v a 2 s . co 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) { final ViewPropertyAnimatorCompat newViewAnimation = ViewCompat.animate(newView); mChangeAnimations.add(changeInfo.newHolder); 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(); } }
From source file:com.example.recycleviewexample.ScaleInItemAnimator.java
private void animateChangeImpl(final ChangeInfo changeInfo) { final ViewHolder holder = changeInfo.oldHolder; final View view = holder == null ? null : holder.itemView; final ViewHolder newHolder = changeInfo.newHolder; final View newView = newHolder != null ? newHolder.itemView : null; if (view != 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); ViewCompat.setPivotX(view, view.getWidth()); oldViewAnim.scaleX(0).setListener(new VpaListenerAdapter() { @Override//from ww w . j av a2 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); ViewCompat.setPivotX(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); Log.d(Common.Tag, " Pivot : " + ViewCompat.getPivotX(view)); ViewCompat.setPivotX(newView, 0.0f); ViewCompat.setScaleX(newView, 0.0f); newViewAnimation.translationX(0).translationY(0).scaleX(1.0f).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(); } }
From source file:com.rock.recyclerview.TeachItemAnimator.java
private void animateRemoveImpl(final RecyclerView.ViewHolder holder) { final View view = holder.itemView; final ViewPropertyAnimatorCompat animation = ViewCompat.animate(view); mRemoveAnimations.add(holder);/*from ww w . j a v a 2 s.c o m*/ animation.setDuration(getRemoveDuration()) // .alpha(0).setListener(new VpaListenerAdapter() { // .scaleX(0).scaleY(0).setListener(new VpaListenerAdapter() { @Override public void onAnimationStart(View view) { dispatchRemoveStarting(holder); } @Override public void onAnimationEnd(View view) { animation.setListener(null); // ViewCompat.setAlpha(view, 1); // ViewCompat.setScaleX(view, 1); ViewCompat.setScaleY(view, 1); dispatchRemoveFinished(holder); mRemoveAnimations.remove(holder); dispatchFinishedWhenDone(); } }).start(); }
From source file:com.example.administrator.bobomanhua.decoration.MyItemAnimator.java
/** * // w w w .j a va2 s .co m * @param holder */ private void animateRemoveImpl(final ViewHolder holder, int i) { final View view = holder.itemView; final ViewPropertyAnimatorCompat animation = ViewCompat.animate(view); mRemoveAnimations.add(holder); animation.setStartDelay(i * 100).setDuration(getRemoveDuration()).translationX(x - view.getLeft()) .translationY(y - view.getTop()) // .rotationXBy(90) .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.setTranslationY(view, 0); // ViewCompat.setRotationX(view, 0); dispatchRemoveFinished(holder); mRemoveAnimations.remove(holder); dispatchFinishedWhenDone(); } }).start(); }
From source file:android.room.play.com.nasadaily.animators.BaseItemAnimator.java
private void animateChangeImpl(final ChangeInfo changeInfo) { final ViewHolder holder = changeInfo.oldHolder; final View view = holder == null ? null : holder.itemView; final ViewHolder newHolder = changeInfo.newHolder; final View newView = newHolder != null ? newHolder.itemView : null; if (view != 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 ww w .j a va 2s. co 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(); } }