List of usage examples for android.support.v4.view ViewPropertyAnimatorCompat setStartDelay
public ViewPropertyAnimatorCompat setStartDelay(long j)
From source file:android.support.v7.view.ViewPropertyAnimatorCompatSet.java
public ViewPropertyAnimatorCompatSet playSequentially(ViewPropertyAnimatorCompat anim1, ViewPropertyAnimatorCompat anim2) { mAnimators.add(anim1);/*w ww . ja v a2s. c o m*/ anim2.setStartDelay(anim1.getDuration()); mAnimators.add(anim2); return this; }
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.java 2 s. co m 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.jash.expandablerecycler.MyItemAnimator.java
private void animateAddImpl(final ViewHolder holder, int i) { final View view = holder.itemView; final ViewPropertyAnimatorCompat animation = ViewCompat.animate(view); mAddAnimations.add(holder);//from w ww. ja v a 2 s .com animation.setStartDelay(i * 100).translationX(0).setDuration(getAddDuration()) .setListener(new VpaListenerAdapter() { @Override public void onAnimationStart(View view) { dispatchAddStarting(holder); } @Override public void onAnimationCancel(View view) { 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.administrator.bobomanhua.decoration.MyItemAnimator.java
/** * ?// www . j a v a2 s.com * @param holder */ private void animateAddImpl(final ViewHolder holder, int i) { final View view = holder.itemView; final ViewPropertyAnimatorCompat animation = ViewCompat.animate(view); mAddAnimations.add(holder); animation.setStartDelay(i * 100).translationX(0).translationY(0).setDuration(getAddDuration()) .setListener(new VpaListenerAdapter() { @Override public void onAnimationStart(View view) { dispatchAddStarting(holder); view.setVisibility(View.VISIBLE); } @Override public void onAnimationCancel(View view) { ViewCompat.setTranslationX(view, 0); ViewCompat.setTranslationY(view, 0); } @Override public void onAnimationEnd(View view) { animation.setListener(null); dispatchAddFinished(holder); mAddAnimations.remove(holder); dispatchFinishedWhenDone(); } }).start(); }
From source file:com.example.administrator.bobomanhua.decoration.MyItemAnimator.java
/** * /*from w w w .ja va 2 s. c o 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:com.example.administrator.bobomanhua.decoration.MyItemAnimator.java
private void animateMoveImpl(final ViewHolder holder, int fromX, int fromY, int toX, int toY) { final View view = holder.itemView; final int deltaX = toX - fromX; final int deltaY = toY - fromY; if (deltaX != 0) { ViewCompat.animate(view).translationX(0); }/*from w ww .j a v a 2 s . c om*/ if (deltaY != 0) { ViewCompat.animate(view).translationY(0); } // TODO: make EndActions end listeners instead, since end actions aren't called when // vpas are canceled (and can't end them. why?) // need listener functionality in VPACompat for this. Ick. final ViewPropertyAnimatorCompat animation = ViewCompat.animate(view); mMoveAnimations.add(holder); animation.setStartDelay(0).setDuration(getMoveDuration()).setListener(new VpaListenerAdapter() { @Override public void onAnimationStart(View view) { dispatchMoveStarting(holder); } @Override public void onAnimationCancel(View view) { if (deltaX != 0) { ViewCompat.setTranslationX(view, 0); } if (deltaY != 0) { ViewCompat.setTranslationY(view, 0); } } @Override public void onAnimationEnd(View view) { animation.setListener(null); dispatchMoveFinished(holder); mMoveAnimations.remove(holder); dispatchFinishedWhenDone(); } }).start(); }
From source file:com.jash.expandablerecycler.MyItemAnimator.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) { 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.setStartDelay(0).alpha(0).setListener(new VpaListenerAdapter() { @Override//from ww w. j av a2 s . c om 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.setStartDelay(0).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(); } }