I was wondering if there is a mechanism to show a spinning "indeterminate" ProgressBar in place of the image while it's loading with Universal Image Loader.
Right now I'm using the showStubImage() option in DisplayImageOptions to show an image that says "No Image" while the image is being downloaded, but it would be really slick looking if there was a spinning indeterminate ProgressBar on top of the ImageView while the image was downloading.
final View imageLayout = inflater.inflate(R.layout.item_pager_image, null);
final ImageView imageView = ...
final ProgressBar spinner = ...
imageLoader.displayImage(images[position], imageView, options, new SimpleImageLoadingListener() {
@Override
public void onLoadingStarted(String imageUri, View view) {
spinner.setVisibility(View.VISIBLE);
}
@Override
public void onLoadingFailed(String imageUri, View view, FailReason failReason) {
spinner.setVisibility(View.GONE);
}
@Override
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
spinner.setVisibility(View.GONE);
}
});