List of usage examples for android.support.v4.view ViewPropertyAnimatorCompat scaleX
public ViewPropertyAnimatorCompat scaleX(float f)
From source file:com.twotoasters.jazzylistview.effects.GrowEffect.java
@Override public void setupAnimation(View item, int position, int scrollDirection, ViewPropertyAnimatorCompat animator) { animator.scaleX(1).scaleY(1); }
From source file:aloha.shiningstarbase.util.itemanimator.ScaleInOutItemAnimator.java
protected void animateAddImpl(final RecyclerView.ViewHolder holder) { final View view = holder.itemView; final ViewPropertyAnimatorCompat animation = ViewCompat.animate(view); mAddAnimations.add(holder);/*from w w w. jav a 2 s.c om*/ animation.scaleX(1).scaleY(1).alpha(1).setDuration(getAddDuration()).setListener(new VpaListenerAdapter() { @Override public void onAnimationStart(View view) { dispatchAddStarting(holder); } @Override public void onAnimationCancel(View view) { ViewCompat.setScaleX(view, 1); ViewCompat.setScaleY(view, 1); ViewCompat.setAlpha(view, 1); } @Override public void onAnimationEnd(View view) { animation.setListener(null); ViewCompat.setAlpha(view, 1); ViewCompat.setScaleX(view, 1); ViewCompat.setScaleY(view, 1); dispatchAddFinished(holder); mAddAnimations.remove(holder); dispatchFinishedWhenDone(); } }).start(); }
From source file:aloha.shiningstarbase.util.itemanimator.SlideScaleInOutRightItemAnimator.java
protected void animateAddImpl(final RecyclerView.ViewHolder holder) { final View view = holder.itemView; final ViewPropertyAnimatorCompat animation = ViewCompat.animate(view); mAddAnimations.add(holder);// ww w.j a va 2s.c o m animation.scaleX(1).scaleY(1).translationX(0).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); ViewCompat.setTranslationX(view, 0); ViewCompat.setScaleX(view, 1); ViewCompat.setScaleY(view, 1); } @Override public void onAnimationEnd(View view) { animation.setListener(null); ViewCompat.setAlpha(view, 1); ViewCompat.setTranslationX(view, 0); ViewCompat.setScaleX(view, 1); ViewCompat.setScaleY(view, 1); dispatchAddFinished(holder); mAddAnimations.remove(holder); dispatchFinishedWhenDone(); } }).start(); }
From source file:jp.wasabeef.recyclerview.animators.change.TinyScaleAnimate.java
public void animateChange(final RecyclerView.ViewHolder oldHolder, final RecyclerView.ViewHolder newHolder, int fromX, int fromY, int toX, int toY) { final long duration = (long) (0.5f * mDispatcher.getChangeDuration()); if (oldHolder.itemView != null) { final ViewPropertyAnimatorCompat oldViewAnim = ViewCompat.animate(oldHolder.itemView); oldViewAnim.translationX(toX - fromX); oldViewAnim.translationY(toY - fromY); oldViewAnim.setDuration(duration); oldViewAnim.scaleX(SCALE_VALUE).scaleY(SCALE_VALUE); oldViewAnim.setListener(new ViewPropertyAnimatorListener() { @Override/*w ww . j a va 2s .com*/ public void onAnimationStart(View view) { mDispatcher.dispatchChangeStarting(oldHolder, true); } @Override public void onAnimationEnd(View view) { oldViewAnim.setListener(null); ViewCompat.setAlpha(view, 1); ViewCompat.setTranslationX(view, 0); ViewCompat.setTranslationY(view, 0); mDispatcher.dispatchChangeFinished(oldHolder, true); if (newHolder.itemView != null) { ViewCompat.setScaleX(newHolder.itemView, SCALE_VALUE); ViewCompat.setScaleY(newHolder.itemView, SCALE_VALUE); ViewCompat.setAlpha(newHolder.itemView, 1.f); final ViewPropertyAnimatorCompat newViewAnimation = ViewCompat.animate(newHolder.itemView); newViewAnimation.translationX(0).translationY(0); newViewAnimation.scaleX(1.f).scaleY(1.f); newViewAnimation.setDuration(duration); newViewAnimation.setListener(new ViewPropertyAnimatorListener() { @Override public void onAnimationStart(View view) { mDispatcher.dispatchChangeStarting(newHolder, false); } @Override public void onAnimationEnd(View view) { newViewAnimation.setListener(null); ViewCompat.setAlpha(view, 1); ViewCompat.setTranslationX(view, 0); ViewCompat.setTranslationY(view, 0); mDispatcher.dispatchChangeFinished(newHolder, false); } @Override public void onAnimationCancel(View view) { ViewHelper.clear(view); } }).start(); } } @Override public void onAnimationCancel(View view) { ViewHelper.clear(view); } }).start(); } }
From source file:com.example.recycleviewexample.ScaleInItemAnimator.java
private void animateAddImpl(final ViewHolder holder) { final View view = holder.itemView; mAddAnimations.add(holder);//from w ww .ja va 2 s .c o m ViewCompat.setPivotX(view, 0.0f); ViewCompat.setScaleX(view, 0.0f); ViewCompat.setAlpha(view, 1.0f); final ViewPropertyAnimatorCompat animation = ViewCompat.animate(view); animation.scaleX(1.0f).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.ccb.myrecyclerview.CustomItemAnimator.java
private void animateAddImpl(final ViewHolder holder) { final View view = holder.itemView; mAddAnimations.add(holder);// w w w . j av a2s . c o m final ViewPropertyAnimatorCompat animation = ViewCompat.animate(view); animation.scaleX(1).scaleY(1).alpha(1).setDuration(getAddDuration()).setListener(new VpaListenerAdapter() { @Override public void onAnimationStart(View view) { dispatchAddStarting(holder); } @Override public void onAnimationCancel(View view) { ViewCompat.setScaleX(view, 1); ViewCompat.setScaleY(view, 1); ViewCompat.setAlpha(view, 1); } @Override public void onAnimationEnd(View view) { animation.setListener(null); ViewCompat.setAlpha(view, 1); ViewCompat.setScaleX(view, 1); ViewCompat.setScaleY(view, 1); dispatchAddFinished(holder); mAddAnimations.remove(holder); dispatchFinishedWhenDone(); } }).start(); }
From source file:com.ccb.myrecyclerview.CustomItemAnimator.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); }/* w w w.ja v a 2s.c o m*/ 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. mMoveAnimations.add(holder); final ViewPropertyAnimatorCompat animation = ViewCompat.animate(view); animation.scaleX(1).scaleY(1).alpha(1).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.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// w w w. j a va 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); 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.mwang.irregulargridview.DynamicItemAnimator.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); float scaleX = (float) changeInfo.toWidth / changeInfo.fromWidth; float scaleY = (float) changeInfo.toHeight / changeInfo.fromHeight; if (scaleX == 0) scaleX = 1;/*w w w .j a v a 2 s .c om*/ if (scaleY == 0) scaleY = 1; oldViewAnim.scaleX(scaleX); oldViewAnim.scaleY(scaleY); 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); ViewCompat.setScaleX(view, 1); ViewCompat.setScaleY(view, 1); 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).scaleX(1).scaleY(1).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); ViewCompat.setScaleX(view, 1); ViewCompat.setScaleY(view, 1); dispatchChangeFinished(changeInfo.newHolder, false); mChangeAnimations.remove(changeInfo.newHolder); dispatchFinishedWhenDone(); } }).start(); } }