Skip to content

Instantly share code, notes, and snippets.

@shikto1
Created July 19, 2018 09:12
Show Gist options
  • Save shikto1/efd3c96a266cbcc165fd554036e43b04 to your computer and use it in GitHub Desktop.
Save shikto1/efd3c96a266cbcc165fd554036e43b04 to your computer and use it in GitHub Desktop.
Animation fadeIn = new AlphaAnimation(0, 1);
fadeIn.setInterpolator(new DecelerateInterpolator()); //add this
fadeIn.setDuration(1500);
Animation fadeOut = new AlphaAnimation(1, 0);
fadeOut.setInterpolator(new AccelerateInterpolator()); //and this
fadeOut.setStartOffset(3000);
fadeOut.setDuration(1500);
AnimationSet animation = new AnimationSet(false); //change to false
animation.addAnimation(fadeIn);
animation.addAnimation(fadeOut);
alertView.startAnimation(animation);
animation.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
alertView.setVisibility(View.VISIBLE);
}
@Override
public void onAnimationEnd(Animation animation) {
alertView.setVisibility(View.INVISIBLE);
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment