Combining Coverflow And Universal Image Loader
Solution 1:
The problem is that you have 2 separate instances of imageview floating around. 1 is created in getView, and the second is created in createReflectedImage. So basically, when the image finishes downloading, a new imageview has already replaced it and the downloaded image is loaded into one that is no longer visible (or possibly even exists). The reason why it loads correctly the second time (after scrolling offscreen) is that the latency is much lower since it is being loaded from memory not off the web or wherever, so when RoundedDrawable drawable = (RoundedDrawable) image.getDrawable(); it actually has the image that you want, rather than just the placeholder!
public View getView(int position, View view, ViewGroup parent) {
RoundedImageViewphoto= (RoundedImageView) view;
...
/*
*Passing first instance of photo into ImageLoaderHelper
*/
ImageLoaderHelper.configureCacheableImage(mContext, photo, latestBook.get(position).getImageUrl(),
R.drawable.avatar_issue, null);
...
////Returns the new instance of RoundedImageView that ImageLoader is not aware of to the adapter//return createReflectedImages(photo);
}
public ImageView createReflectedImages(RoundedImageView image) {
...
RoundedImageViewimageView=newRoundedImageView(mContext);
imageView.setImageBitmap(bitmapWithReflection);
imageView.setLayoutParams(newImageGallery3D.LayoutParams(GeneralHelper.dp(180), GeneralHelper.dp(240)));//width and height of Image//Returning a new instance of imageViewreturn imageView;
}
Instead of returning imageView in createReflectedImages, return "image". Then implement a callback that you pass in to ImageLoaderHelper that calls createReflectedImages after the image has successfully been loaded to apply your effect.
Post a Comment for "Combining Coverflow And Universal Image Loader"