com.google.android.apps.picview.request.ImageLoadingTask

Here are the examples of the java api class com.google.android.apps.picview.request.ImageLoadingTask taken from open source projects.

1. MultiColumnImageAdapter#recycleSlotView()

Project: picview-for-android
File: MultiColumnImageAdapter.java
/**
   * Recycles a slot view, if it already exists. This means, changing the title,
   * stopping a previous image loading task and instantiating a new image
   * loading task.
   * 
   * @param slot
   *          the slot to recycle
   * @param item
   *          the item that holds the data for the slot
   */
private void recycleSlotView(ThumbnailSlotView slot, final ThumbnailItem<T> item) {
    slot.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            listener.thumbnailClicked(item.getDataObject());
        }
    });
    TextView picTitle = (TextView) slot.findViewById(R.id.picture_title);
    picTitle.setText(item.getTitle());
    // We need to cancel the UI update of the image loading task for this
    // slot, if one is present and instead set the loading icon.
    ImageLoadingTask previousLoadingTask = slot.getImageLoadingTask();
    if (previousLoadingTask != null) {
        previousLoadingTask.setCancelUiUpdate(true);
    }
    ImageView albumThumbnail = (ImageView) slot.findViewById(R.id.album_thumbnail);
    // immediately, if the result is already in cache.
    try {
        ImageLoadingTask task = new ImageLoadingTask(albumThumbnail, new URL(item.getThumbnailUrl()), cachedImageFetcher);
        slot.setImageLoadingTask(task);
        task.execute();
    } catch (MalformedURLException e) {
        e.printStackTrace();
    }
}