use of androidx.interpolator.view.animation.FastOutSlowInInterpolator in project Slide by ccrama.
the class CommentAdapterHelper method hideChildrenObject.
public static void hideChildrenObject(final View v) {
ValueAnimator animator = ValueAnimator.ofFloat(1f, 0);
animator.setDuration(250);
animator.setInterpolator(new FastOutSlowInInterpolator());
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
float value = (Float) animation.getAnimatedValue();
v.setAlpha(value);
v.setScaleX(value);
v.setScaleY(value);
}
});
animator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator arg0) {
v.setVisibility(View.GONE);
}
@Override
public void onAnimationCancel(Animator arg0) {
v.setVisibility(View.GONE);
}
});
animator.start();
}
use of androidx.interpolator.view.animation.FastOutSlowInInterpolator in project Slide by ccrama.
the class AnimatorUtil method slideAnimator.
public static ValueAnimator slideAnimator(final int start, final int end, final View view) {
final ValueAnimator animator = ValueAnimator.ofInt(start, end);
animator.setInterpolator(new FastOutSlowInInterpolator());
animator.addUpdateListener(valueAnimator -> {
// Update height
final int value = (Integer) valueAnimator.getAnimatedValue();
final ViewGroup.LayoutParams layoutParams = view.getLayoutParams();
layoutParams.height = value;
view.setLayoutParams(layoutParams);
});
return animator;
}
use of androidx.interpolator.view.animation.FastOutSlowInInterpolator in project Slide by ccrama.
the class AnimatorUtil method flipAnimator.
public static ValueAnimator flipAnimator(final boolean isFlipped, final View view) {
final ValueAnimator animator = ValueAnimator.ofFloat(isFlipped ? -1f : 1f, isFlipped ? 1f : -1f);
animator.setInterpolator(new FastOutSlowInInterpolator());
// Update height
animator.addUpdateListener(valueAnimator -> view.setScaleY((Float) valueAnimator.getAnimatedValue()));
return animator;
}
use of androidx.interpolator.view.animation.FastOutSlowInInterpolator in project Slide by ccrama.
the class AnimatorUtil method setFlashAnimation.
public static void setFlashAnimation(final View vBig, final View from, final int color) {
// get the center for the clipping circle
final View v = vBig.findViewById(R.id.vote);
v.post(() -> {
v.setBackgroundColor(color);
v.setVisibility(View.VISIBLE);
v.setAlpha(1f);
final int cx = (from.getLeft() + from.getRight()) / 2;
final int cy = vBig.getHeight() - from.getHeight() / 2;
// from.getRight() - ( from.getWidth()/ 2);
// get the final radius for the clipping circle
final int dx = Math.max(cx, vBig.getWidth() - cx);
final int dy = Math.max(cy, vBig.getHeight() - cy);
final float finalRadius = (float) Math.hypot(dx, dy);
try {
final Animator animator = ViewAnimationUtils.createCircularReveal(v, cx, cy, 0, finalRadius);
animator.setInterpolator(new FastOutSlowInInterpolator());
animator.setDuration(250);
animator.start();
v.postDelayed(() -> {
final ObjectAnimator animator2 = ObjectAnimator.ofFloat(v, View.ALPHA, 1f, 0f);
animator2.setInterpolator(new AccelerateDecelerateInterpolator());
animator2.setDuration(450);
animator2.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
v.setVisibility(View.GONE);
}
});
animator2.start();
}, 450);
} catch (Exception e) {
v.setVisibility(View.GONE);
}
});
}
Aggregations