I use this libary to create CircularReveal animation on pre-Lollipop devices. The problem is in hiding View
with animation. Animation is performed as well, but after animation end, View
become visible for a second and then disappears. How can I prevent blinking of View
?
Here is my method for hiding View
with CircularReveal animation:
public static void revealCloseTopRight(final View view) {
int cx = view.getRight();
int cy = view.getTop();
// get the final radius for the clipping circle
int dx = Math.max(cx, view.getWidth() - cx);
int dy = Math.max(cy, view.getHeight() - cy);
float finalRadius = (float) Math.hypot(dx, dy);
SupportAnimator animator = ViewAnimationUtils.createCircularReveal(view, cx, cy, 0, finalRadius);
animator.setInterpolator(new AccelerateDecelerateInterpolator());
animator.setDuration(animDuration);
animator = animator.reverse();
try {
animator.start();
} catch (Exception ex) {
ex.printStackTrace();
}
view.postDelayed(new Runnable() {
@Override
public void run() {
view.setVisibility(View.INVISIBLE);
}
}, animDuration);
}
UPDATE
I also tried to add SupportAnimator.AnimatorListener()
like this:
animator.addListener(new SupportAnimator.AnimatorListener() {
@Override
public void onAnimationStart() {
Log.d(AnimationSupport.TAG, TAG + " -> 1onAnimationStart()");
}
@Override
public void onAnimationEnd() {
Log.d(AnimationSupport.TAG, TAG + " -> 1onAnimationEnd()");
view.setVisibility(View.INVISIBLE);
}
@Override
public void onAnimationCancel() {
Log.d(AnimationSupport.TAG, TAG + " -> 1onAnimationCancel()");
}
@Override
public void onAnimationRepeat() {
Log.d(AnimationSupport.TAG, TAG + " -> 1onAnimationRepeat()");
}
});
And Animator.AnimatorListener()
like this:
animator.addListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
Log.d(AnimationSupport.TAG, TAG + " -> onAnimationStart()");
}
@Override
public void onAnimationEnd(Animator animation) {
Log.d(AnimationSupport.TAG, TAG + " -> onAnimationEnd()");
view.setVisibility(View.INVISIBLE);
}
@Override
public void onAnimationCancel(Animator animation) {
Log.d(AnimationSupport.TAG, TAG + " -> onAnimationCancel()");
}
@Override
public void onAnimationRepeat(Animator animation) {
Log.d(AnimationSupport.TAG, TAG + " -> onAnimationRepeat()");
}
});
In both cases none on this callbacks are never called. I have no idea why.