I've created a extension to the Animation class in order to create a background fade out animation. I start the animation after pressing a ListView row item. If I press one after another I want to cancel the first animation and start the second. But a bug that I'm having is when I press fast one row after another the animation doesn't stop. After debugging I've noticed that the applyTransformation method keeps running for the first animation. I've decided to override the cancel function, but how do I stop the transformation?
public BackgroundAnimation(View view, int color){
this.view = view;
setDuration(4000L);
red = Color.red(color);
blue = Color.blue(color);
green = Color.green(color);
}
@Override
public void applyTransformation(float interpolatedTime,Transformation t){
//super.applyTransformation(interpolatedTime, t);
view.setBackgroundColor(Color.argb((int) ((1 - interpolatedTime) * 255), red, green, blue));
}