List of usage examples for android.animation ValueAnimator ofInt
public static ValueAnimator ofInt(int... values)
From source file:Main.java
public static ValueAnimator getRiseElevationValue(final View targetView, int duration, final int mimElevation, final int maxElevation) { ValueAnimator addElevationValueAnim = ValueAnimator.ofInt(1); addElevationValueAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @TargetApi(Build.VERSION_CODES.HONEYCOMB_MR1) @Override/*from w w w . j av a2 s .c om*/ public void onAnimationUpdate(ValueAnimator animation) { float fraction = animation.getAnimatedFraction(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { targetView.setElevation((1 - fraction) * maxElevation + mimElevation); } } }); addElevationValueAnim.setDuration(duration); return addElevationValueAnim; }
From source file:com.musenkishi.wally.activities.ImageDetailsActivity.java
private void setupPaddings(final Size size, boolean animate) { int animationDuration = animate ? 300 : 0; photoView.setScaleType(ImageView.ScaleType.CENTER_CROP); photoViewAttacher.setScaleType(ImageView.ScaleType.CENTER_CROP); final int sidePadding = getResources() .getDimensionPixelSize(R.dimen.activity_details_scrollview_side_padding); int fabPadding = getResources().getDimensionPixelSize(R.dimen.fab_padding_positive); int minimumAllowedHeight = fabPadding; if (size.getHeight() < minimumAllowedHeight) { size.setHeight(size.getHeight()); ValueAnimator valueAnimator = ValueAnimator.ofInt(photoLayoutHolder.getPaddingTop()); valueAnimator.setInterpolator(new EaseInOutBezierInterpolator()); valueAnimator.setDuration(animationDuration); valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override//ww w . j av a2s. c o m public void onAnimationUpdate(ValueAnimator valueAnimator) { photoLayoutHolder.setPadding(0, (Integer) valueAnimator.getAnimatedValue(), 0, 0); } }); valueAnimator.start(); } else { photoLayoutHolder.setPadding(0, 0, 0, 0); } scrollView.setPadding(0, 0, 0, -fabPadding); specsLayout.setPadding(0, 0, 0, fabPadding); ValueAnimator valueAnimator = ValueAnimator.ofInt(detailsViewGroup.getPaddingTop(), size.getHeight()); valueAnimator.setInterpolator(new EaseInOutBezierInterpolator()); valueAnimator.setDuration(animationDuration); valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator valueAnimator) { detailsViewGroup.setPadding(sidePadding, (Integer) valueAnimator.getAnimatedValue(), sidePadding, detailsViewGroup.getPaddingBottom()); } }); valueAnimator.start(); }
From source file:com.bitants.wally.activities.ImageDetailsActivity.java
private void setupPaddings(final Size size, boolean animate) { int animationDuration = animate ? 300 : 0; final int sidePadding = getResources() .getDimensionPixelSize(R.dimen.activity_details_scrollview_side_padding); int fabPadding = getResources().getDimensionPixelSize(R.dimen.fab_padding_positive); int minimumAllowedHeight = fabPadding; if (size.getHeight() < minimumAllowedHeight) { size.setHeight(size.getHeight()); ValueAnimator valueAnimator = ValueAnimator.ofInt(photoLayoutHolder.getPaddingTop()); valueAnimator.setInterpolator(new EaseInOutBezierInterpolator()); valueAnimator.setDuration(animationDuration); valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override/*from ww w . j av a 2 s . c om*/ public void onAnimationUpdate(ValueAnimator valueAnimator) { photoLayoutHolder.setPadding(0, (Integer) valueAnimator.getAnimatedValue(), 0, 0); } }); valueAnimator.start(); } else { photoLayoutHolder.setPadding(0, 0, 0, 0); } scrollView.setPadding(0, 0, 0, -fabPadding); specsLayout.setPadding(0, 0, 0, fabPadding); ValueAnimator valueAnimator = ValueAnimator.ofInt(detailsViewGroup.getPaddingTop(), size.getHeight()); valueAnimator.setInterpolator(new EaseInOutBezierInterpolator()); valueAnimator.setDuration(animationDuration); valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator valueAnimator) { detailsViewGroup.setPadding(sidePadding, (Integer) valueAnimator.getAnimatedValue(), sidePadding, detailsViewGroup.getPaddingBottom()); } }); valueAnimator.start(); }