Example usage for android.support.v4.view ViewPropertyAnimatorCompat setDuration

List of usage examples for android.support.v4.view ViewPropertyAnimatorCompat setDuration

Introduction

In this page you can find the example usage for android.support.v4.view ViewPropertyAnimatorCompat setDuration.

Prototype

public ViewPropertyAnimatorCompat setDuration(long j) 

Source Link

Usage

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 av  a 2 s  .  co  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:net.nym.napply.library.recycler.BaseItemAnimator.java

private void animateRemoveImpl(final RecyclerView.ViewHolder holder) {
    final ViewPropertyAnimatorCompat animation = getRemoveAnimator(holder);
    mRemoveAnimations.add(holder);/*  ww  w  . j a v  a 2s  .com*/
    animation.setDuration(getRemoveDuration()).setListener(new VpaListenerAdapter() {
        @Override
        public void onAnimationStart(View view) {
            dispatchRemoveStarting(holder);
        }

        @Override
        public void onAnimationEnd(View view) {
            animation.setListener(null);
            clear(view);
            dispatchRemoveFinished(holder);
            mRemoveAnimations.remove(holder);
            dispatchFinishedWhenDone();
        }
    }).start();
}

From source file:cn.zhangls.android.weibo.ui.weibo.RecyclerItemAnimator.java

void animateRemoveImpl(final RecyclerView.ViewHolder holder) {
    final View view = holder.itemView;
    final ViewPropertyAnimatorCompat animation = ViewCompat.animate(view);
    mRemoveAnimations.add(holder);/* w  w  w. j  a  v  a 2s .  c o m*/
    animation.setDuration(getRemoveDuration()).alpha(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);
            dispatchRemoveFinished(holder);
            mRemoveAnimations.remove(holder);
            dispatchFinishedWhenDone();
        }
    }).start();
}

From source file:acr.browser.lightning.browser.fragment.anim.HorizontalItemAnimator.java

private void animateRemoveImpl(final ViewHolder holder) {
    final View view = holder.itemView;
    final ViewPropertyAnimatorCompat animation = ViewCompat.animate(view);
    mRemoveAnimations.add(holder);/*from   ww  w .ja v  a2s  .  c  o  m*/
    animation.setDuration(getRemoveDuration()).alpha(0).translationY(holder.itemView.getHeight())
            .setInterpolator(new AccelerateInterpolator()).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.setTranslationY(view, 0);
                    dispatchRemoveFinished(holder);
                    mRemoveAnimations.remove(holder);
                    dispatchFinishedWhenDone();
                }
            }).start();
}

From source file:acr.browser.lightning.browser.fragment.anim.VerticalItemAnimator.java

private void animateRemoveImpl(final ViewHolder holder) {
    final View view = holder.itemView;
    final ViewPropertyAnimatorCompat animation = ViewCompat.animate(view);
    mRemoveAnimations.add(holder);// w w w.j  a v  a 2 s.  c  om
    animation.setDuration(getRemoveDuration()).alpha(0).translationX(-holder.itemView.getWidth() / 2)
            .setInterpolator(new AccelerateInterpolator()).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.setTranslationX(view, 0);
                    dispatchRemoveFinished(holder);
                    mRemoveAnimations.remove(holder);
                    dispatchFinishedWhenDone();
                }
            }).start();
}

From source file:com.bwie.myrecyclerviewdemo1.MyitemAnimator.java

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  w  w . j  a va  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.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:cn.iterlog.xmimagepicker.anim.BaseItemAnimator.java

private void animateMoveImpl(final RecyclerView.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  ww .j  a  va 2s. com
    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.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:acr.browser.lightning.browser.fragment.anim.HorizontalItemAnimator.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);
    }/*ww w .j av a2  s .  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.
    final ViewPropertyAnimatorCompat animation = ViewCompat.animate(view);
    mMoveAnimations.add(holder);
    animation.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.cs.test_recycview3.MyAnimator.java

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 w  w. ja va  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.
    final ViewPropertyAnimatorCompat animation = ViewCompat.animate(view);
    animation.rotationXBy(360);
    mMoveAnimations.add(holder);
    animation.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.lining.mydemo.animator.MyItemAnimator.java

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  .  jav  a  2  s .  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.
    final ViewPropertyAnimatorCompat animation = ViewCompat.animate(view);
    animation.rotationXBy(180);
    mMoveAnimations.add(holder);
    animation.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);
            ViewCompat.setRotationX(view, 0);
            dispatchMoveFinished(holder);
            mMoveAnimations.remove(holder);
            dispatchFinishedWhenDone();
        }
    }).start();
}