List of usage examples for android.animation ValueAnimator start
@Override public void start()
From source file:fr.julienvermet.bugdroid.ui.tablet.AbsBugsMultiPaneFragment.java
public void expandBugsPane() { showLeftToolbox();//w w w. j a va2 s .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: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 w w w .ja v a 2 s . c o m*/ 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:com.brayanarias.alarmproject.activity.AlarmScreenActivity.java
private void starAnimation() { View pulseView = findViewById(R.id.pulse); View pulseDismiss = findViewById(R.id.pulseDismiss); View pulseSnooze = findViewById(R.id.pulseSnooze); ValueAnimator pulseAnimator = ObjectAnimator.ofPropertyValuesHolder(pulseView, PropertyValuesHolder.ofFloat(View.SCALE_X, 0.0f, 1.0f), PropertyValuesHolder.ofFloat(View.SCALE_Y, 0.0f, 1.0f), PropertyValuesHolder.ofFloat(View.ALPHA, 1.0f, 0.0f)); pulseAnimator.setDuration(2000);//from www . j a v a 2 s. c o m pulseAnimator.setRepeatCount(ValueAnimator.INFINITE); Interpolator interpolator = PathInterpolatorCompat.create(0.0f, 0.0f, 0.2f, 1.0f); pulseAnimator.setInterpolator(interpolator); pulseAnimator.start(); ValueAnimator dismissAnimator = ObjectAnimator.ofPropertyValuesHolder(pulseDismiss, PropertyValuesHolder.ofFloat(View.SCALE_X, 0.0f, 1.0f), PropertyValuesHolder.ofFloat(View.SCALE_Y, 0.0f, 1.0f), PropertyValuesHolder.ofFloat(View.ALPHA, 1.0f, 0.0f)); dismissAnimator.setDuration(1000); dismissAnimator.setRepeatCount(ValueAnimator.INFINITE); dismissAnimator.setInterpolator(interpolator); dismissAnimator.start(); ValueAnimator snoozeAnimator = ObjectAnimator.ofPropertyValuesHolder(pulseSnooze, PropertyValuesHolder.ofFloat(View.SCALE_X, 0.0f, 1.0f), PropertyValuesHolder.ofFloat(View.SCALE_Y, 0.0f, 1.0f), PropertyValuesHolder.ofFloat(View.ALPHA, 1.0f, 0.0f)); snoozeAnimator.setDuration(1000); snoozeAnimator.setRepeatCount(ValueAnimator.INFINITE); snoozeAnimator.setInterpolator(interpolator); snoozeAnimator.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);/* ww w. j a v a2 s.c om*/ 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;/*w ww.j ava 2 s .c om*/ } } 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(); } } }
From source file:io.plaidapp.about.ui.widget.InkPageIndicator.java
private void setSelectedPage(int now) { // Check for null array if (now == currentPage || dotCenterX == null) return;/*from w w w . ja va2 s . c o m*/ pageChanging = true; previousPage = currentPage; currentPage = now; final int steps = Math.abs(now - previousPage); if (steps > 1) { if (now > previousPage) { for (int i = 0; i < steps; i++) { setJoiningFraction(previousPage + i, 1f); } } else { for (int i = -1; i > -steps; i--) { setJoiningFraction(previousPage + i, 1f); } } } // create the anim to move the selected dot this animator will kick off // retreat animations when it has moved 75% of the way. // The retreat animation in turn will kick of reveal anims when the // retreat has passed any dots to be revealed ValueAnimator moveAnimation = createMoveSelectedAnimator(dotCenterX[now], previousPage, now, steps); moveAnimation.start(); }
From source file:org.digitalcampus.oppia.activity.CourseIndexActivity.java
private void initializeCourseIndex(boolean animate) { final ListView listView = (ListView) findViewById(R.id.section_list); if (listView == null) return;/*from w w w .j a v a 2s.c o m*/ ViewCompat.setNestedScrollingEnabled(listView, true); sla = new SectionListAdapter(CourseIndexActivity.this, course, sections, new SectionListAdapter.CourseClickListener() { @Override public void onActivityClicked(String activityDigest) { startCourseActivityByDigest(activityDigest); } }); if (animate) { AlphaAnimation fadeOutAnimation = new AlphaAnimation(1f, 0f); fadeOutAnimation.setDuration(700); fadeOutAnimation.setFillAfter(true); listView.setAlpha(0f); ValueAnimator animator = ValueAnimator.ofFloat(1f, 0f); animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { public void onAnimationUpdate(ValueAnimator valueAnimator) { listView.setTranslationX((Float) valueAnimator.getAnimatedValue() * 80); listView.setAlpha(1f - (Float) valueAnimator.getAnimatedValue()); } }); animator.setDuration(700); animator.start(); loadingCourseView.startAnimation(fadeOutAnimation); } else { loadingCourseView.setVisibility(View.GONE); listView.setVisibility(View.VISIBLE); } listView.setAdapter(sla); }
From source file:com.filemanager.free.ui.views.Indicator.java
private void setSelectedPage(int now) { if (now == currentPage || now >= pageCount) return;// ww w. ja va 2s . co m pageChanging = true; previousPage = currentPage; currentPage = now; final int steps = Math.abs(now - previousPage); if (steps > 1) { if (now > previousPage) { for (int i = 0; i < steps; i++) { setJoiningFraction(previousPage + i, 1f); } } else { for (int i = -1; i > -steps; i--) { setJoiningFraction(previousPage + i, 1f); } } } // create the anim to move the selected dot this animator will kick off // retreat animations when it has moved 75% of the way. // The retreat animation in turn will kick of reveal anims when the // retreat has passed any dots to be revealed ValueAnimator moveAnimation = createMoveSelectedAnimator(dotCenterX[now], previousPage, now, steps); moveAnimation.start(); }
From source file:com.shalzz.attendance.activity.MainActivity.java
public void setDrawerAsUp(boolean enabled) { if (mDrawerLayout == null) return;// w w w .j a v a 2 s. co m float start = enabled ? 0f : 1f; float end = enabled ? 1f : 0f; mDrawerLayout.setDrawerLockMode( enabled ? DrawerLayout.LOCK_MODE_LOCKED_CLOSED : DrawerLayout.LOCK_MODE_UNLOCKED); ValueAnimator anim = ValueAnimator.ofFloat(start, end); anim.addUpdateListener(valueAnimator -> { float slideOffset = (Float) valueAnimator.getAnimatedValue(); mDrawerToggle.onDrawerSlide(mDrawerLayout, slideOffset); }); anim.setInterpolator(new DecelerateInterpolator()); anim.setDuration(300); anim.start(); }
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);//w ww.jav a 2 s . c om colorAnim.setDuration(250); colorAnim.setEvaluator(new ArgbEvaluator()); colorAnim.setRepeatCount(0); colorAnim.setRepeatMode(ValueAnimator.REVERSE); colorAnim.start(); }