List of usage examples for android.animation ValueAnimator setDuration
@Override public ValueAnimator setDuration(long duration)
From source file:fr.julienvermet.bugdroid.ui.tablet.AbsBugsMultiPaneFragment.java
public void collapseBugsPane() { int targetWidth = mCollapsedBugsWidth; ValueAnimator animator = ValueAnimator.ofObject(new WidthEvaluator(mBugsPane), mBugsPane.getWidth(), targetWidth);/*from www .j av a 2 s. c om*/ animator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); mIsBugShown = true; } }); animator.setDuration(ANIMATION_DURATION); animator.start(); }
From source file:fr.julienvermet.bugdroid.ui.tablet.AbsBugsMultiPaneFragment.java
public void expandBugsPane() { showLeftToolbox();/*from w w w . j ava 2s . co m*/ int targetWidth = mExpandedBugsWidth; ValueAnimator animator = ValueAnimator.ofObject(new WidthEvaluator(mBugsPane), mBugsPane.getWidth(), targetWidth); animator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); mIsBugShown = false; } }); animator.setDuration(ANIMATION_DURATION); animator.start(); }
From source file:com.roughike.bottombar.BottomBarTab.java
void updateWidth(float endWidth, boolean animated) { if (!animated) { getLayoutParams().width = (int) endWidth; if (!isActive && badge != null) { badge.adjustPositionAndSize(this); badge.show();/* w ww. j a va 2 s.c o m*/ } return; } float start = getWidth(); ValueAnimator animator = ValueAnimator.ofFloat(start, endWidth); animator.setDuration(150); animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animator) { ViewGroup.LayoutParams params = getLayoutParams(); if (params == null) return; params.width = Math.round((float) animator.getAnimatedValue()); setLayoutParams(params); } }); // Workaround to avoid using faulty onAnimationEnd() listener postDelayed(new Runnable() { @Override public void run() { if (!isActive && badge != null) { clearAnimation(); badge.adjustPositionAndSize(BottomBarTab.this); badge.show(); } } }, animator.getDuration()); animator.start(); }
From source file:com.rks.musicx.misc.utils.Helper.java
private static ValueAnimator setAnimator(int colorFrom, int colorTo) { ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), colorFrom, colorTo); long duration = 300; colorAnimation.setDuration(duration); return colorAnimation; }
From source file:cs.umass.edu.prepare.view.activities.CalendarActivity.java
private void transition() { int transitionColor = ContextCompat.getColor(this, R.color.color_transition_details_swipe); ValueAnimator colorAnim = ObjectAnimator.ofInt(detailsView, "backgroundColor", transitionColor, Color.TRANSPARENT);/*from ww w . j a v a 2s . c o m*/ colorAnim.setDuration(250); colorAnim.setEvaluator(new ArgbEvaluator()); colorAnim.setRepeatCount(0); colorAnim.setRepeatMode(ValueAnimator.REVERSE); colorAnim.start(); }
From source file:arun.com.chromer.browsing.article.util.ArticleScrollListener.java
private void animateBackgroundColor(int from, int to, Interpolator interpolator) { final ValueAnimator anim = new ValueAnimator(); anim.setIntValues(from, to);/*from www . j a v a 2 s . c om*/ anim.setEvaluator(new ArgbEvaluator()); anim.setInterpolator(interpolator); anim.addUpdateListener(valueAnimator -> { toolbar.setBackgroundColor((Integer) valueAnimator.getAnimatedValue()); statusBar.setBackgroundColor((Integer) valueAnimator.getAnimatedValue()); }); anim.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); isUpdatingBackground = false; } }); anim.setDuration(ANIMATION_DURATION); anim.start(); isUpdatingBackground = true; }
From source file:chinanurse.cn.nurse.list.WaveSwipeRefreshLayout.java
private void onDropPhase() { mWaveView.animationDropCircle();/*from w ww. j a v a 2 s . co m*/ ValueAnimator animator = ValueAnimator.ofFloat(0, 0); animator.setDuration(500); animator.setInterpolator(new AccelerateDecelerateInterpolator()); animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator valueAnimator) { mCircleView.setTranslationY(mWaveView.getCurrentCircleCenterY() + mCircleView.getHeight() / 2.f); } }); animator.start(); setRefreshing(true, true); mIsBeingDropped = true; setEventPhase(EVENT_PHASE.DROPPING); setEnabled(false); }
From source file:com.justplay1.shoppist.features.search.widget.FloatingSearchView.java
public void fadeInSignal(final int colorTo, final ValueAnimator.AnimatorUpdateListener updateListener) { final int colorFrom = DEFAULT_BACKGROUND_COLOR; final ValueAnimator colorAnimation = getValueAnimator(colorTo, colorFrom); colorAnimation.setDuration(DEFAULT_DURATION_ENTER); // milliseconds colorAnimation.addUpdateListener(updateListener); colorAnimation.addListener(new Animator.AnimatorListener() { @Override/* w w w .j a v a 2 s . c o m*/ public void onAnimationStart(Animator animation) { } @Override public void onAnimationEnd(Animator animation) { final ValueAnimator colorAnimation = getValueAnimator(colorFrom, colorTo); colorAnimation.setDuration(DEFAULT_DURATION_EXIT); // milliseconds colorAnimation.addUpdateListener(updateListener); colorAnimation.start(); } @Override public void onAnimationCancel(Animator animation) { } @Override public void onAnimationRepeat(Animator animation) { } }); colorAnimation.start(); }
From source file:fr.julienvermet.bugdroid.ui.tablet.AbsBugsMultiPaneFragment.java
public void expandLeftPane(int speed) { int targetWidth = mMaxLeftWidth; ValueAnimator animator = ValueAnimator.ofObject(new WidthEvaluator(mLeftPane), mLeftPane.getWidth(), targetWidth);/* w w w .j av a 2 s . c o m*/ animator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); mIsLeftCollapsed = false; } }); animator.setInterpolator(new DecelerateInterpolator()); animator.setDuration(speed); animator.start(); }
From source file:liam.franco.selene.fragments.SuperNotesFragment.java
@Subscribe public void newNotesCount(NotesCount notesCount) { boolean hasNotes = notesCount.getSize() > 0; int paddingBottom = -1; if (parentLayout != null) { if (hasNotes) { if (parentLayout.getPaddingBottom() > 0) { paddingBottom = 0;/*from w w w. j a va2s . co m*/ } } else { if (parentLayout.getPaddingBottom() <= 0) { paddingBottom = (int) UIUtils.convertDpToPixel(208, App.CONTEXT); } } if (paddingBottom > -1) { ValueAnimator animator = ValueAnimator.ofInt(parentLayout.getPaddingBottom(), paddingBottom); animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator valueAnimator) { if (parentLayout != null) { parentLayout.setPadding(parentLayout.getPaddingLeft(), parentLayout.getPaddingTop(), parentLayout.getPaddingRight(), (Integer) valueAnimator.getAnimatedValue()); } } }); animator.setDuration(500); animator.start(); } } }