Search in sources :

Example 1 with NonViewAware

use of com.nostra13.universalimageloader.core.imageaware.NonViewAware in project LibreraReader by foobnix.

the class ImageLoader method loadImage.

/**
 * Adds load image task to execution pool. Image will be returned with
 * {@link ImageLoadingListener#onLoadingComplete(String, android.view.View, android.graphics.Bitmap)}
 * callback}. <br />
 * <b>NOTE:</b> {@link #init(ImageLoaderConfiguration)} method must be
 * called before this method call
 *
 * @param uri
 *            Image URI (i.e. "http://site.com/image.png",
 *            "file:///mnt/sdcard/image.png")
 * @param targetImageSize
 *            Minimal size for {@link Bitmap} which will be returned in
 *            {@linkplain ImageLoadingListener#onLoadingComplete(String, android.view.View, android.graphics.Bitmap)}
 *            callback}. Downloaded image will be decoded and scaled to
 *            {@link Bitmap} of the size which is <b>equal or larger</b>
 *            (usually a bit larger) than incoming targetImageSize.
 * @param options
 *            {@linkplain com.nostra13.universalimageloader.core.DisplayImageOptions
 *            Options} for image decoding and displaying. If <b>null</b> -
 *            default display image options
 *            {@linkplain ImageLoaderConfiguration.Builder#defaultDisplayImageOptions(DisplayImageOptions)
 *            from configuration} will be used.<br />
 * @param listener
 *            {@linkplain ImageLoadingListener Listener} for image loading
 *            process. Listener fires events on UI thread if this method is
 *            called on UI thread.
 * @param progressListener
 *            {@linkplain com.nostra13.universalimageloader.core.listener.ImageLoadingProgressListener
 *            Listener} for image loading progress. Listener fires events on
 *            UI thread if this method is called on UI thread. Caching on
 *            disk should be enabled in
 *            {@linkplain com.nostra13.universalimageloader.core.DisplayImageOptions
 *            options} to make this listener work.
 * @throws IllegalStateException
 *             if {@link #init(ImageLoaderConfiguration)} method wasn't
 *             called before
 */
public int loadImage(String uri, ImageSize targetImageSize, DisplayImageOptions options, ImageLoadingListener listener, ImageLoadingProgressListener progressListener) {
    checkConfiguration();
    if (targetImageSize == null) {
        targetImageSize = configuration.getMaxImageSize();
    }
    if (options == null) {
        options = configuration.defaultDisplayImageOptions;
    }
    NonViewAware imageAware = new NonViewAware(uri, targetImageSize, ViewScaleType.CROP);
    displayImage(uri, imageAware, options, listener, progressListener);
    return imageAware.getId();
}
Also used : NonViewAware(com.nostra13.universalimageloader.core.imageaware.NonViewAware)

Example 2 with NonViewAware

use of com.nostra13.universalimageloader.core.imageaware.NonViewAware in project Android-Universal-Image-Loader by nostra13.

the class ImageLoader method loadImage.

/**
 * Adds load image task to execution pool. Image will be returned with
 * {@link ImageLoadingListener#onLoadingComplete(String, android.view.View, android.graphics.Bitmap)} callback}.
 * <br />
 * <b>NOTE:</b> {@link #init(ImageLoaderConfiguration)} method must be called before this method call
 *
 * @param uri              Image URI (i.e. "http://site.com/image.png", "file:///mnt/sdcard/image.png")
 * @param targetImageSize  Minimal size for {@link Bitmap} which will be returned in
 *                         {@linkplain ImageLoadingListener#onLoadingComplete(String, android.view.View,
 *                         android.graphics.Bitmap)} callback}. Downloaded image will be decoded
 *                         and scaled to {@link Bitmap} of the size which is <b>equal or larger</b> (usually a bit
 *                         larger) than incoming targetImageSize.
 * @param options          {@linkplain com.nostra13.universalimageloader.core.DisplayImageOptions Options} for image
 *                         decoding and displaying. If <b>null</b> - default display image options
 *                         {@linkplain ImageLoaderConfiguration.Builder#defaultDisplayImageOptions(DisplayImageOptions)
 *                         from configuration} will be used.<br />
 * @param listener         {@linkplain ImageLoadingListener Listener} for image loading process. Listener fires
 *                         events on UI thread if this method is called on UI thread.
 * @param progressListener {@linkplain com.nostra13.universalimageloader.core.listener.ImageLoadingProgressListener
 *                         Listener} for image loading progress. Listener fires events on UI thread if this method
 *                         is called on UI thread. Caching on disk should be enabled in
 *                         {@linkplain com.nostra13.universalimageloader.core.DisplayImageOptions options} to make
 *                         this listener work.
 * @throws IllegalStateException if {@link #init(ImageLoaderConfiguration)} method wasn't called before
 */
public void loadImage(String uri, ImageSize targetImageSize, DisplayImageOptions options, ImageLoadingListener listener, ImageLoadingProgressListener progressListener) {
    checkConfiguration();
    if (targetImageSize == null) {
        targetImageSize = configuration.getMaxImageSize();
    }
    if (options == null) {
        options = configuration.defaultDisplayImageOptions;
    }
    NonViewAware imageAware = new NonViewAware(uri, targetImageSize, ViewScaleType.CROP);
    displayImage(uri, imageAware, options, listener, progressListener);
}
Also used : NonViewAware(com.nostra13.universalimageloader.core.imageaware.NonViewAware)

Aggregations

NonViewAware (com.nostra13.universalimageloader.core.imageaware.NonViewAware)2