use of com.github.ignition.core.widgets.RemoteImageView in project ignition by mttkay.
the class RemoteImageGalleryAdapter method getView.
// TODO: both convertView and ViewHolder are pointless at the moment, since there's a framework
// bug which causes views to not be cached in a Gallery widget:
// http://code.google.com/p/android/issues/detail?id=3376
@Override
public View getView(int position, View convertView, ViewGroup parent) {
String imageUrl = (String) getItem(position);
ViewHolder viewHolder = null;
RemoteImageView remoteImageView = null;
if (convertView == null) {
// create the image view
remoteImageView = new RemoteImageView(context, null, progressDrawable, errorDrawable, false);
FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
lp.gravity = Gravity.CENTER;
remoteImageView.setLayoutParams(lp);
// create the container layout for the image view
FrameLayout container = new FrameLayout(context);
container.setLayoutParams(new Gallery.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
container.addView(remoteImageView, 0);
convertView = container;
viewHolder = new ViewHolder();
viewHolder.webImageView = remoteImageView;
convertView.setTag(viewHolder);
} else {
viewHolder = (ViewHolder) convertView.getTag();
remoteImageView = viewHolder.webImageView;
}
// calling reset is important to prevent old images from displaying in a recycled view.
remoteImageView.reset();
remoteImageView.setImageUrl(imageUrl);
remoteImageView.loadImage();
onGetView(position, remoteImageView, (ViewGroup) convertView, parent);
return convertView;
}
Aggregations