Android Open Source - UrlImageViewHelper Url Image View Callback






From Project

Back to project page UrlImageViewHelper.

License

The source code is released under:

Apache License

If you think the Android project UrlImageViewHelper listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.koushikdutta.urlimageviewhelper;
/* ww  w .  j  ava 2s. c  o  m*/
import android.graphics.Bitmap;
import android.widget.ImageView;

/**
 * Callback that is invoked with a success/failure after attempting to
 * load a drawable from an url.
 * Note: If an ImageView has multiple setUrlDrawable calls made on it, only the last callback
 * will be invoked. This scenario arises when using ListViews which recycle their views.
 * This is done to prevent callbacks from being erroneosly invoked on ImageViews that are no
 * longer interested in the url that was loaded.
 * To guarantee a callback is invoked, one can do the following:
 * First call loadUrlDrawable (with a callback), and then setUrlDrawable. Both loads just get queued into the same request,
 * so you don't need to worry about that being inefficient or that it is making two network calls.
 * @author koush
 *
 */
public interface UrlImageViewCallback {
    /**
     * 
     * @param imageView ImageView for the load request.
     * @param loadedBitmap The bitmap that was loaded by the request.
     *                          If the drawable failed to load, this will be null.
     * @param url The url that was loaded.
     * @param loadedFromCache This will indicate whether the load operation result came from cache, or was retrieved.
     */
    void onLoaded(ImageView imageView, Bitmap loadedBitmap, String url, boolean loadedFromCache);
}




Java Source Code List

com.koushikdutta.urlimageviewhelper.AssetUrlDownloader.java
com.koushikdutta.urlimageviewhelper.Constants.java
com.koushikdutta.urlimageviewhelper.ContactContentUrlDownloader.java
com.koushikdutta.urlimageviewhelper.ContentUrlDownloader.java
com.koushikdutta.urlimageviewhelper.DrawableCache.java
com.koushikdutta.urlimageviewhelper.FileUrlDownloader.java
com.koushikdutta.urlimageviewhelper.HttpUrlDownloader.java
com.koushikdutta.urlimageviewhelper.LruBitmapCache.java
com.koushikdutta.urlimageviewhelper.LruCache.java
com.koushikdutta.urlimageviewhelper.SoftReferenceHashTable.java
com.koushikdutta.urlimageviewhelper.UrlDownloader.java
com.koushikdutta.urlimageviewhelper.UrlImageViewCallback.java
com.koushikdutta.urlimageviewhelper.UrlImageViewHelper.java
com.koushikdutta.urlimageviewhelper.sample.UrlImageViewHelperSample.java