public class

ImageLoader

extends Object
java.lang.Object
   ↳ com.neomades.content.image.ImageLoader

Class Overview

Helper that handles loading and caching images from remote URLs.

The simple way to use this class is to call setImageUrl(String, ImageLoader).

This class can only be used by ImageUrlLabel.

See Also

Summary

Public Constructors
ImageLoader(ImageCache cache)
Creates an image loader with a specific cache or no cache (see NoImageCache).
Public Methods
ImageContainer get(String requestUrl, ImageListener imageListener)
Returns an ImageContainer for the requested URL.
boolean isCached(String requestUrl, int maxWidth, int maxHeight)
Checks if the item is available in the cache.
void setBatchedResponseDelay(int newBatchedResponseDelayMs)
Sets the amount of time to wait after the first response arrives before delivering all responses.
Protected Methods
ImageQuery createImageQuery(String requestUrl, int maxWidth, int maxHeight)
May be overridden to specify custom Image requests.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public ImageLoader (ImageCache cache)

Creates an image loader with a specific cache or no cache (see NoImageCache).

Public Methods

public ImageContainer get (String requestUrl, ImageListener imageListener)

Returns an ImageContainer for the requested URL. The ImageContainer will contain either the specified default bitmap or the loaded bitmap. If the default was returned, the ImageLoader will be invoked when the request is fulfilled.

Parameters
requestUrl The URL of the image to be loaded.
imageListener The listener to call when the remote image is loaded

public boolean isCached (String requestUrl, int maxWidth, int maxHeight)

Checks if the item is available in the cache.

Parameters
requestUrl The url of the remote image
maxWidth The maximum width of the returned image.
maxHeight The maximum height of the returned image.
Returns
  • True if the item exists in cache, false otherwise.

public void setBatchedResponseDelay (int newBatchedResponseDelayMs)

Sets the amount of time to wait after the first response arrives before delivering all responses. Batching can be disabled entirely by passing in 0.

Parameters
newBatchedResponseDelayMs The time in milliseconds to wait.

Protected Methods

protected ImageQuery createImageQuery (String requestUrl, int maxWidth, int maxHeight)

May be overridden to specify custom Image requests.

By default, Image queries are configured with HTTP GET Method, without authentication process.

Parameters
requestUrl the URL of the image.
maxWidth the image max size width
maxHeight the image max size height
Returns
  • a new image query