Use startAnimation() instead of setAnimation()

This commit is contained in:
Cameron Gutman 2020-06-11 21:47:28 -07:00
parent 4a5de26406
commit 9fb7359a3e

View File

@ -198,7 +198,7 @@ public class CachedAppAssetLoader {
LoaderTask task = new LoaderTask(imageView, prgView, false); LoaderTask task = new LoaderTask(imageView, prgView, false);
AsyncDrawable asyncDrawable = new AsyncDrawable(imageView.getResources(), noAppImageBitmap, task); AsyncDrawable asyncDrawable = new AsyncDrawable(imageView.getResources(), noAppImageBitmap, task);
imageView.setImageDrawable(asyncDrawable); imageView.setImageDrawable(asyncDrawable);
imageView.setAnimation(AnimationUtils.loadAnimation(imageView.getContext(), R.anim.boxart_fadein)); imageView.startAnimation(AnimationUtils.loadAnimation(imageView.getContext(), R.anim.boxart_fadein));
imageView.setVisibility(View.VISIBLE); imageView.setVisibility(View.VISIBLE);
task.executeOnExecutor(networkExecutor, tuple); task.executeOnExecutor(networkExecutor, tuple);
} }
@ -232,18 +232,18 @@ public class CachedAppAssetLoader {
public void onAnimationEnd(Animation animation) { public void onAnimationEnd(Animation animation) {
// Fade in the new box art // Fade in the new box art
imageView.setImageBitmap(bitmap.bitmap); imageView.setImageBitmap(bitmap.bitmap);
imageView.setAnimation(AnimationUtils.loadAnimation(imageView.getContext(), R.anim.boxart_fadein)); imageView.startAnimation(AnimationUtils.loadAnimation(imageView.getContext(), R.anim.boxart_fadein));
} }
@Override @Override
public void onAnimationRepeat(Animation animation) {} public void onAnimationRepeat(Animation animation) {}
}); });
imageView.setAnimation(fadeOutAnimation); imageView.startAnimation(fadeOutAnimation);
} }
else { else {
// View is invisible already, so just fade in the new art // View is invisible already, so just fade in the new art
imageView.setImageBitmap(bitmap.bitmap); imageView.setImageBitmap(bitmap.bitmap);
imageView.setAnimation(AnimationUtils.loadAnimation(imageView.getContext(), R.anim.boxart_fadein)); imageView.startAnimation(AnimationUtils.loadAnimation(imageView.getContext(), R.anim.boxart_fadein));
imageView.setVisibility(View.VISIBLE); imageView.setVisibility(View.VISIBLE);
} }
} }