List of usage examples for android.animation ValueAnimator start
@Override public void start()
From source file:com.waz.zclient.pages.main.conversation.views.row.message.views.TextMessageWithTimestamp.java
private void collapseTimestamp() { messageViewContainer.getTimestampShownSet().remove(messageId); int origHeight = timestampTextView.getHeight(); ValueAnimator animator = createHeightAnimator(timestampTextView, origHeight, 0); animator.addListener(new AnimatorListenerAdapter() { @Override//from w w w. ja v a 2 s . co m public void onAnimationEnd(final Animator animator) { timestampTextView.setVisibility(View.GONE); } }); animator.start(); }
From source file:com.dycody.android.idealnote.NavigationDrawerFragment.java
void animateBurger(int targetShape) { if (mDrawerToggle != null) { if (targetShape != BURGER && targetShape != ARROW) return; ValueAnimator anim = ValueAnimator.ofFloat((targetShape + 1) % 2, targetShape); anim.addUpdateListener(valueAnimator -> { float slideOffset = (Float) valueAnimator.getAnimatedValue(); mDrawerToggle.onDrawerSlide(mDrawerLayout, slideOffset); });/*from w w w . j av a2s.c o m*/ anim.setInterpolator(new DecelerateInterpolator()); anim.setDuration(500); anim.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);/*from w ww . ja v a 2s. c o m*/ animation.addUpdateListener(new AnimatorUpdateListener() { public void onAnimationUpdate(ValueAnimator a) { renderBudget((Float) a.getAnimatedValue()); } }); animation.start(); }
From source file:com.mishiranu.dashchan.util.DrawerToggle.java
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2) public void setDrawerIndicatorMode(int mode) { if (this.mode != mode) { this.mode = mode; ActionBar actionBar = activity.getActionBar(); if (mode == MODE_DISABLED) { if (C.API_JELLY_BEAN_MR2) { actionBar.setHomeAsUpIndicator(null); }//from w ww .j a v a2s. c om actionBar.setDisplayHomeAsUpEnabled(false); } else { actionBar.setDisplayHomeAsUpEnabled(true); if (C.API_LOLLIPOP) { activity.getActionBar().setHomeAsUpIndicator(arrowDrawable); boolean open = drawerLayout.isDrawerOpen(Gravity.START) && arrowDrawable.position == 1f; if (!open) { ValueAnimator animator = ValueAnimator.ofFloat(0f, 1f); animator.setDuration(DRAWER_CLOSE_DURATION); animator.addUpdateListener(new StateArrowAnimatorListener(mode == MODE_DRAWER)); animator.start(); } } else { setActionBarUpIndicatorObsolete(mode == MODE_DRAWER ? slideDrawable : homeAsUpIndicator); } } } }
From source file:com.facebook.react.modules.statusbar.StatusBarModule.java
@ReactMethod public void setColor(final int color, final boolean animated, final Promise res) { final Activity activity = getCurrentActivity(); if (activity == null) { res.reject(ERROR_NO_ACTIVITY, ERROR_NO_ACTIVITY_MESSAGE); return;//ww w .j ava 2 s .co m } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { UiThreadUtil.runOnUiThread(new Runnable() { @TargetApi(Build.VERSION_CODES.LOLLIPOP) @Override public void run() { if (animated) { int curColor = activity.getWindow().getStatusBarColor(); ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), curColor, color); colorAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animator) { activity.getWindow().setStatusBarColor((Integer) animator.getAnimatedValue()); } }); colorAnimation.setDuration(300).setStartDelay(0); colorAnimation.start(); } else { activity.getWindow().setStatusBarColor(color); } res.resolve(null); } }); } else { res.resolve(null); } }
From source file:com.waz.zclient.pages.main.conversation.views.row.footer.FooterViewController.java
private void collapse() { if (shouldBeExpanded()) { return;/*from w w w. ja v a 2 s. c om*/ } if (message.getId().equals(container.getExpandedMessageId())) { container.setExpandedMessageId(null); } int origHeight = view.getHeight(); ValueAnimator animator = createHeightAnimator(view, origHeight, 0); animator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(final Animator animator) { view.setVisibility(View.GONE); } }); animator.start(); }
From source file:com.rong.library.widget.mapsearchbar.MapSearchBar.java
private void animateSuggestionList(int from, int to) { suggestionsVisible = (to > 0);//w w w . ja v a 2 s . co m final ViewGroup.LayoutParams lp = containerSuggestion.getLayoutParams(); if (to == 0 && lp.height == 0) return; // already collapsed if (to == 0) from = lp.height; ValueAnimator animator = ValueAnimator.ofInt(from, to); animator.setDuration(200); animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { lp.height = (int) animation.getAnimatedValue(); containerSuggestion.setLayoutParams(lp); } }); animator.start(); }
From source file:com.myhexaville.iconanimations.gooey_fab.GooeyFabCompatImpl.java
public void showAnimation() { if (!mIsLargeFab) { if (!mIsExpanded) { mIcon.setAlpha(0f);/* www . ja va 2 s . com*/ } animate().translationYBy(mIsExpanded ? mAnimationTanslationY : -mAnimationTanslationY).setDuration(250) .start(); mIcon.animate().alpha(!mIsExpanded ? 1f : 0f).setDuration(500).start(); mGooeyPart = getGooeyPartHeight(); invalidate(); } else { mIcon.animate().rotationBy(mIsExpanded ? -45 : 45).setDuration(187).start(); ValueAnimator animator = ValueAnimator.ofFloat(0f, 1f).setDuration(187); animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { float v = (float) animation.getAnimatedValue(); mGooeyPart = getGooeyPartHeight() * v; invalidate(); } }); animator.start(); } new Handler().postDelayed(new Runnable() { @Override public void run() { ValueAnimator animator = ValueAnimator.ofFloat(1f, 0f).setDuration(187); animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { float v = (float) animation.getAnimatedValue(); mGooeyPart = getGooeyPartHeight() * v; invalidate(); } }); animator.start(); } }, 187); new Handler().postDelayed(new Runnable() { @Override public void run() { mIsExpanded = !mIsExpanded; } }, 250); }
From source file:com.test.slidebutton.SlideButton.java
/** * max_leftmin_left(moveToboolean toRight) * @param toRight// w ww .jav a 2 s . co m */ @Deprecated private void moveToDest(final boolean toRight) { ValueAnimator toDestAnim = ValueAnimator.ofInt(sliderCurrentLeft, toRight ? max_left : min_left); toDestAnim.setDuration(200); toDestAnim.setInterpolator(new AccelerateDecelerateInterpolator()); // toDestAnim.setInterpolator(new OvershootInterpolator()); toDestAnim.start(); toDestAnim.addUpdateListener(new AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { sliderCurrentLeft = (Integer) animation.getAnimatedValue(); alpha = (int) (255 * (float) sliderCurrentLeft / (float) max_left); if (alpha < 0) alpha = 0; if (alpha > 255) alpha = 255; caculateColor(); invalidateView(); } }); toDestAnim.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { if (toRight) { isOpen = true; if (listener != null) { listener.open(); } sliderCurrentLeft = sliderMoveStartLeft = max_left; alpha = 255; } else { isOpen = false; if (listener != null) { listener.close(); } sliderCurrentLeft = sliderMoveStartLeft = min_left; alpha = 0; } invalidateView(); } }); }
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 w ww .j a v a 2s . c o m*/ animator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); mIsBugShown = true; } }); animator.setDuration(ANIMATION_DURATION); animator.start(); }