DataSourceBitmapLoader


@UnstableApi
public final class DataSourceBitmapLoader implements BitmapLoader

A BitmapLoader implementation that uses a DataSource to support fetching images from URIs and BitmapFactory to load them into Bitmap.

Loading tasks are delegated to a ListeningExecutorService defined during construction. If no executor service is passed, all tasks are delegated to a single-thread executor service that is shared between instances of this class.

Summary

Public constructors

This method is deprecated.

Use Builder instead.

DataSourceBitmapLoader(Context context, int maximumOutputDimension)

This method is deprecated.

Use Builder instead.

DataSourceBitmapLoader(
 ListeningExecutorService listeningExecutorService,
 DataSource.Factory dataSourceFactory
)

This method is deprecated.

Use Builder instead.

DataSourceBitmapLoader(
 ListeningExecutorService listeningExecutorService,
 DataSource.Factory dataSourceFactory,
 @Nullable BitmapFactory.Options options
)

This method is deprecated.

Use Builder instead.

DataSourceBitmapLoader(
 ListeningExecutorService listeningExecutorService,
 DataSource.Factory dataSourceFactory,
 @Nullable BitmapFactory.Options options,
 int maximumOutputDimension
)

This method is deprecated.

Use Builder instead.

Public methods

ListenableFuture<Bitmap>
decodeBitmap(byte[] data)

Decodes an image from compressed binary data.

ListenableFuture<Bitmap>

Loads an image from uri.

boolean

Returns whether the given mimeType is supported.

Constants

DEFAULT_EXECUTOR_SERVICE

public static final Supplier<ListeningExecutorService> DEFAULT_EXECUTOR_SERVICE

Public constructors

DataSourceBitmapLoader

public DataSourceBitmapLoader(Context context)

DataSourceBitmapLoader

public DataSourceBitmapLoader(Context context, int maximumOutputDimension)

DataSourceBitmapLoader

public DataSourceBitmapLoader(
 ListeningExecutorService listeningExecutorService,
 DataSource.Factory dataSourceFactory
)

DataSourceBitmapLoader

public DataSourceBitmapLoader(
 ListeningExecutorService listeningExecutorService,
 DataSource.Factory dataSourceFactory,
 @Nullable BitmapFactory.Options options
)

DataSourceBitmapLoader

public DataSourceBitmapLoader(
 ListeningExecutorService listeningExecutorService,
 DataSource.Factory dataSourceFactory,
 @Nullable BitmapFactory.Options options,
 int maximumOutputDimension
)

Public methods

decodeBitmap

public ListenableFuture<Bitmap> decodeBitmap(byte[] data)

Decodes an image from compressed binary data.

loadBitmap

public ListenableFuture<Bitmap> loadBitmap(Uri uri)

Loads an image from uri.

supportsMimeType

public boolean supportsMimeType(String mimeType)

Returns whether the given mimeType is supported.