List of usage examples for android.animation ValueAnimator setDuration
@Override public ValueAnimator setDuration(long duration)
From source file:com.liujs.library.view.refresh.BGAStickinessRefreshView.java
public void smoothToIdle() { ValueAnimator animator = ValueAnimator.ofInt(mCurrentBottomHeight, 0); animator.setDuration(mStickinessRefreshViewHolder.getTopAnimDuration()); animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override/*from w ww . j a va 2s.c o m*/ public void onAnimationUpdate(ValueAnimator animation) { mCurrentBottomHeight = (int) animation.getAnimatedValue(); postInvalidate(); } }); animator.addListener(new Animator.AnimatorListener() { @Override public void onAnimationStart(Animator animation) { } @Override public void onAnimationEnd(Animator animation) { mIsRotating = false; } @Override public void onAnimationCancel(Animator animation) { } @Override public void onAnimationRepeat(Animator animation) { } }); animator.start(); }
From source file:com.liujs.library.view.refresh.BGAStickinessRefreshView.java
public void startRefreshing() { ValueAnimator animator = ValueAnimator.ofInt(mCurrentBottomHeight, 0); animator.setDuration(mStickinessRefreshViewHolder.getTopAnimDuration()); animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override// w w w .j a v a2 s . com public void onAnimationUpdate(ValueAnimator animation) { mCurrentBottomHeight = (int) animation.getAnimatedValue(); postInvalidate(); } }); animator.addListener(new Animator.AnimatorListener() { @Override public void onAnimationStart(Animator animation) { mIsRefreshing = true; if (mCurrentBottomHeight != 0) { mStickinessRefreshViewHolder.startChangeWholeHeaderViewPaddingTop(mCurrentBottomHeight); } else { mStickinessRefreshViewHolder.startChangeWholeHeaderViewPaddingTop( -(mTopSize + getPaddingTop() + getPaddingBottom())); } } @Override public void onAnimationEnd(Animator animation) { mIsRotating = true; startRotating(); } @Override public void onAnimationCancel(Animator animation) { } @Override public void onAnimationRepeat(Animator animation) { } }); animator.start(); }
From source file:com.fruit.widget.SlideSwitch.java
public void moveToDest(final boolean toRight) { ValueAnimator toDestAnim = ValueAnimator.ofInt(frontRect_left, toRight ? max_left : min_left); toDestAnim.setDuration(duration); toDestAnim.setInterpolator(new AccelerateDecelerateInterpolator()); toDestAnim.start();// w ww . ja va 2s. co m toDestAnim.addUpdateListener(new AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { frontRect_left = (Integer) animation.getAnimatedValue(); alpha = (int) (255 * (float) frontRect_left / (float) max_left); invalidateView(); } }); toDestAnim.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { if (toRight) { isOpen = true; if (listener != null) listener.open(); frontRect_left_begin = max_left; } else { isOpen = false; if (listener != null) listener.close(); frontRect_left_begin = min_left; } } }); }
From source file:com.insalyon.les24heures.view.DrawerArrowDrawable.java
public void animateToSandwich() { final DrawerArrowDrawable self = this; ValueAnimator animation = ValueAnimator.ofFloat(1f, 0f); animation.setDuration(500); animation.start();/*from www.j a v a 2 s. c o m*/ animation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { self.setParameter((Float) animation.getAnimatedValue()); } }); this.setParameter(0); }
From source file:com.insalyon.les24heures.view.DrawerArrowDrawable.java
public void animateToArrow() { final DrawerArrowDrawable self = this; ValueAnimator animation = ValueAnimator.ofFloat(0f, 1f); animation.setDuration(500); animation.start();/* w ww. j a va 2 s . c o m*/ animation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { self.setParameter((Float) animation.getAnimatedValue()); } }); this.setFlip(true); }
From source file:com.example.administrator.iclub21.view.SlideSwitch.java
@TargetApi(Build.VERSION_CODES.HONEYCOMB) public void moveToDest(final boolean toRight) { ValueAnimator toDestAnim = ValueAnimator.ofInt(frontRect_left, toRight ? max_left : min_left); toDestAnim.setDuration(500); toDestAnim.setInterpolator(new AccelerateDecelerateInterpolator()); toDestAnim.start();//from ww w.j a va 2 s.c o m toDestAnim.addUpdateListener(new AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { frontRect_left = (Integer) animation.getAnimatedValue(); alpha = (int) (255 * (float) frontRect_left / (float) max_left); invalidateView(); } }); toDestAnim.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { if (toRight) { isOpen = true; if (listener != null) listener.open(); frontRect_left_begin = max_left; } else { isOpen = false; if (listener != null) listener.close(); frontRect_left_begin = min_left; } } }); }
From source file:com.jungle.toolbaractivity.layout.HorizontalSwipeBackLayout.java
private void continueAnimation(float horzOffset, int width) { ValueAnimator animator = ValueAnimator.ofFloat(horzOffset, width); animator.setInterpolator(new AccelerateInterpolator()); animator.setDuration((long) (150 * Math.abs(width - horzOffset) / width)); animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override/*from w ww . jav a 2s .c o m*/ public void onAnimationUpdate(ValueAnimator animation) { float value = (float) animation.getAnimatedValue(); updateSlideOffset(value); } }); animator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); if (mSlideListener != null) { mSlideListener.onSlideFinished(); } } }); animator.start(); }
From source file:se.frikod.payday.DailyBudgetFragment.java
@TargetApi(11) private void renderBudgetAnimated() { ValueAnimator animation = ValueAnimator.ofFloat((float) currentBudget, (float) budget.dailyBudget); animation.setDuration(500); animation.addUpdateListener(new AnimatorUpdateListener() { public void onAnimationUpdate(ValueAnimator a) { renderBudget((Float) a.getAnimatedValue()); }/*from ww w .j a v a 2 s . co m*/ }); animation.start(); }
From source file:com.dean.phonesafe.ui.SlideSwitch.java
public void moveToDest(final boolean toRight) { ValueAnimator toDestAnim = ValueAnimator.ofInt(frontRect_left, toRight ? max_left : min_left); toDestAnim.setDuration(500); toDestAnim.setInterpolator(new AccelerateDecelerateInterpolator()); toDestAnim.start();//from ww w. j a v a2s .co m toDestAnim.addUpdateListener(new AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { frontRect_left = (Integer) animation.getAnimatedValue(); alpha = (int) (255 * (float) frontRect_left / (float) max_left); invalidateView(); } }); toDestAnim.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { if (toRight) { isOpen = true; if (listener != null) listener.open(); frontRect_left_begin = max_left; } else { isOpen = false; if (listener != null) listener.close(); frontRect_left_begin = min_left; } } }); }
From source file:com.audionote.widget.SlideSwitch.java
public void moveToDest(final boolean toRight) { ValueAnimator toDestAnim = ValueAnimator.ofInt(frontRect_left, toRight ? max_left : min_left); toDestAnim.setDuration(200); toDestAnim.setInterpolator(new AccelerateDecelerateInterpolator()); toDestAnim.start();/*from w w w .ja va2s . c o m*/ toDestAnim.addUpdateListener(new AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { frontRect_left = (Integer) animation.getAnimatedValue(); alpha = (int) (255 * (float) frontRect_left / (float) max_left); invalidateView(); } }); toDestAnim.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { if (toRight) { isOpen = true; if (listener != null) listener.open(); frontRect_left_begin = max_left; } else { isOpen = false; if (listener != null) listener.close(); frontRect_left_begin = min_left; } } }); }