private void ensureOrCancelAnimator(V child) { if (mTranslationAnimator == null) { mTranslationAnimator = ViewCompat.animate(child); mTranslationAnimator.setDuration(300); mTranslationAnimator.setInterpolator(INTERPOLATOR); } else { mTranslationAnimator.cancel(); } }
public static void fadeOut(View view, int fadeDuration, ViewPropertyAnimatorListenerAdapter listener) { //fade to alpha=0 ViewCompat.animate(view) .alpha(0) .setDuration(fadeDuration) .withLayer() .setInterpolator(new DecelerateInterpolator()) .setListener(listener); }
public static void fadeIn(View view, float alpha, int fadeDuration, ViewPropertyAnimatorListenerAdapter listener) { //fade to alpha=0 ViewCompat.animate(view) .alpha(alpha) .setDuration(fadeDuration) .withLayer() .setInterpolator(new AccelerateInterpolator()) .setListener(listener); }
public static void translateDown(View view, ViewPropertyAnimatorListener listener) { int height = view.getHeight(); ViewGroup.LayoutParams params = view.getLayoutParams(); ViewGroup.MarginLayoutParams layoutParams = params instanceof ViewGroup.MarginLayoutParams ? ((ViewGroup.MarginLayoutParams) params) : null; if (layoutParams != null) height += layoutParams.bottomMargin; ViewCompat.animate(view).translationY(height).setDuration(DURATION).setListener(listener).setInterpolator(INTERPOLATOR).withLayer().start(); }
.alpha(1.0F) .setDuration(duration) .setInterpolator(FAST_OUT_SLOW_IN_INTERPOLATOR) .withLayer() .setListener(new ViewPropertyAnimatorListener() {
public void createAnimatorTranslationY(final View v, final float h, final FrameLayout fl) { ViewPropertyAnimatorCompat viewPropertyAnimatorCompat = ViewCompat.animate(v); viewPropertyAnimatorCompat.setDuration(250); viewPropertyAnimatorCompat.setInterpolator(new DecelerateInterpolator()); viewPropertyAnimatorCompat.translationY(h); viewPropertyAnimatorCompat.start(); viewPropertyAnimatorCompat.setUpdateListener(new ViewPropertyAnimatorUpdateListener() { @Override public void onAnimationUpdate(View view) { float height = ViewCompat.getTranslationY(v); fl.getLayoutParams().height = (int) height; fl.requestLayout(); } }); }
.scaleX(0.0F) .scaleY(0.0F).alpha(0.0F) .setInterpolator(FAST_OUT_SLOW_IN_INTERPOLATOR) .setDuration(duration) .withLayer()
if (withAnim) { ViewCompat.animate(mSuggestionListContainer). setInterpolator(SUGGEST_ITEM_ADD_ANIM_INTERPOLATOR). setDuration(mSuggestionSectionAnimDuration). translationY(newTranslationY)
public static void alphaShow(View view, ViewPropertyAnimatorListener listener) { ViewCompat.animate(view).alpha(1.0f).setDuration(DURATION).setListener(listener).setInterpolator(INTERPOLATOR).withLayer().start(); }
public static void alphaHide(View view, ViewPropertyAnimatorListener listener) { ViewCompat.animate(view).alpha(0f).setDuration(DURATION).setListener(listener).setInterpolator(INTERPOLATOR).withLayer().start(); }
public static void translateUp(View view, ViewPropertyAnimatorListener listener) { ViewCompat.animate(view).translationY(0).setDuration(DURATION).setListener(listener).setInterpolator(INTERPOLATOR).withLayer().start(); }
private void animateIn(FloatingActionButton button) { button.setVisibility(View.VISIBLE); if (Build.VERSION.SDK_INT >= 14) { ViewCompat.animate(button).translationY(0) .setInterpolator(new FastOutSlowInInterpolator()) .withLayer() .setListener(null) .start(); } }
.scaleY(1f) .alpha(1f) .setInterpolator(new FastOutSlowInInterpolator()) .setListener(null); } else {
public void finishRefreshing() { if (mChildView != null) { ViewPropertyAnimatorCompat viewPropertyAnimatorCompat = ViewCompat.animate(mChildView); viewPropertyAnimatorCompat.setDuration(200); viewPropertyAnimatorCompat.y(ViewCompat.getTranslationY(mChildView)); viewPropertyAnimatorCompat.translationY(0); viewPropertyAnimatorCompat.setInterpolator(new DecelerateInterpolator()); viewPropertyAnimatorCompat.start(); if (mMaterialHeaderView != null) { mMaterialHeaderView.onComlete(MaterialRefreshLayout.this); } else if (mSunLayout != null) { mSunLayout.onComlete(MaterialRefreshLayout.this); } if (refreshListener != null) { refreshListener.onfinish(); } } isRefreshing = false; progressValue = 0; }
public static void scaleShow(View view, ViewPropertyAnimatorListener listener) { ViewCompat.animate(view).scaleX(1.0f).scaleY(1.0f).alpha(1.0f).setDuration(DURATION).setListener(listener).setInterpolator(INTERPOLATOR).withLayer().start(); }
public static void scaleHide(View view, ViewPropertyAnimatorListener listener) { ViewCompat.animate(view).scaleX(0f).scaleY(0f).alpha(0f).setDuration(DURATION).setListener(listener).setInterpolator(INTERPOLATOR).withLayer().start(); }
private void animateOut(final FloatingActionButton button) { if (Build.VERSION.SDK_INT >= 14) { ViewCompat.animate(button).translationY(button.getHeight() + getMarginBottom(button)) .setInterpolator(new FastOutSlowInInterpolator()) .withLayer() .setListener(new ViewPropertyAnimatorListener() { public void onAnimationStart(View view) { mIsAnimatingOut = true; } public void onAnimationCancel(View view) { mIsAnimatingOut = false; } public void onAnimationEnd(View view) { mIsAnimatingOut = false; view.setVisibility(View.GONE); } }).start(); } }
public static void translateShow(View view, ViewPropertyAnimatorListener viewPropertyAnimatorListener) { view.setVisibility(View.VISIBLE); ViewCompat.animate(view) .translationY(0) .setDuration(400) .setListener(viewPropertyAnimatorListener) .setInterpolator(FAST_OUT_SLOW_IN_INTERPOLATOR) .start(); }
public static void scaleShow(View view, ViewPropertyAnimatorListener viewPropertyAnimatorListener) { view.setVisibility(View.VISIBLE); ViewCompat.animate(view) .scaleX(1.0f) .scaleY(1.0f) .alpha(1.0f) .setDuration(800) .setListener(viewPropertyAnimatorListener) .setInterpolator(FAST_OUT_SLOW_IN_INTERPOLATOR) .start(); }
public static void scaleHide(View view, ViewPropertyAnimatorListener viewPropertyAnimatorListener) { ViewCompat.animate(view) .scaleX(0.0f) .scaleY(0.0f) .alpha(0.0f) .setDuration(800) .setInterpolator(FAST_OUT_SLOW_IN_INTERPOLATOR) .setListener(viewPropertyAnimatorListener) .start(); }