Class ImageProvider

com.yandex.runtime.image

public abstract class ImageProvider

Provides Bitmap objects from different input sources.

Extend this class to provide images from custom sources.

Constructors

ImageProvider()
ImageProvider(final boolean cacheable)

Methods

ImageProvider fromAsset(final Context context, final String assetName)
ImageProvider fromAsset(final Context context, final String assetName, final boolean cacheable)

Returns the image provider based on a given asset (from the assets/ folder).

ImageProvider fromBitmap(final Bitmap bitmap)
ImageProvider fromBitmap(final Bitmap bitmap, final boolean cacheable, final String id)

Returns the image provider based on a given bitmap.

ImageProvider fromFile(final String fileName)
ImageProvider fromFile(final String fileName, final boolean cacheable)

Returns the image provider based on an image file from the internal storage.

ImageProvider fromResource(final Context context, final int resourceId)
ImageProvider fromResource(final Context context, final int resourceId, final boolean cacheable)

Returns the image provider based on an application resource (from the res/ folder).

abstract String getId()

Returns the unique identifier for an image.

abstract Bitmap getImage()

Returns the image in bitmap format.

boolean isCacheable()

Determines whether image should be cached on GPU or not.

Constructor Detail

ImageProvider

public ImageProvider ()

ImageProvider

public ImageProvider (final boolean cacheable)

Method Detail

fromAsset

public static ImageProvider fromAsset (final Context context, final String assetName)

fromAsset

public static ImageProvider fromAsset (final Context context, final String assetName, final boolean cacheable)

Returns the image provider based on a given asset (from the assets/ folder).

fromBitmap

public static ImageProvider fromBitmap (final Bitmap bitmap)

fromBitmap

public static ImageProvider fromBitmap (final Bitmap bitmap, final boolean cacheable, final String id)

Returns the image provider based on a given bitmap.

fromFile

public static ImageProvider fromFile (final String fileName)

fromFile

public static ImageProvider fromFile (final String fileName, final boolean cacheable)

Returns the image provider based on an image file from the internal storage.

fromResource

public static ImageProvider fromResource (final Context context, final int resourceId)

fromResource

public static ImageProvider fromResource (final Context context, final int resourceId, final boolean cacheable)

Returns the image provider based on an application resource (from the res/ folder).

getId

public abstract String getId ()

Returns the unique identifier for an image.

Providers can be cached based on it.

getImage

public abstract Bitmap getImage ()

Returns the image in bitmap format.

isCacheable

public boolean isCacheable ()

Determines whether image should be cached on GPU or not.