SizeLimitedBitmapLoader


@UnstableApi
class SizeLimitedBitmapLoader : BitmapLoader


A BitmapLoader that limits the size of bitmaps loaded by decodeBitmap or loadBitmap request. Bitmaps with width or height larger than maxBitmapSize will be scaled down so that the larger dimension will be equal or less than maxBitmapSize.

Summary

Public constructors

SizeLimitedBitmapLoader(
    bitmapLoader: BitmapLoader!,
    maxBitmapSize: Int,
    makeShared: Boolean
)

Creates an instance that size limits the bitmap loaded by the BitmapLoader.

Public functions

ListenableFuture<Bitmap!>!

Decodes an image from compressed binary data.

ListenableFuture<Bitmap!>!
loadBitmap(uri: Uri!)

Loads an image from uri.

ListenableFuture<Bitmap!>?

Loads an image from MediaMetadata.

Boolean

Returns whether the given mimeType is supported.

Public constructors

SizeLimitedBitmapLoader

SizeLimitedBitmapLoader(
    bitmapLoader: BitmapLoader!,
    maxBitmapSize: Int,
    makeShared: Boolean
)

Creates an instance that size limits the bitmap loaded by the BitmapLoader.

Parameters
bitmapLoader: BitmapLoader!

The BitmapLoader.

maxBitmapSize: Int

The maximum size to limit the loaded Bitmap instances to.

makeShared: Boolean

Whether the Bitmap should be converted to an immutable, sharable instance that is most efficient for repeated transfer over binder interfaces.

Public functions

decodeBitmap

fun decodeBitmap(data: ByteArray!): ListenableFuture<Bitmap!>!

Decodes an image from compressed binary data.

loadBitmap

fun loadBitmap(uri: Uri!): ListenableFuture<Bitmap!>!

Loads an image from uri.

loadBitmapFromMetadata

fun loadBitmapFromMetadata(metadata: MediaMetadata!): ListenableFuture<Bitmap!>?

Loads an image from MediaMetadata. Returns null if metadata doesn't contain bitmap information.

By default, the method will try to decode an image from artworkData if it is present. Otherwise, the method will try to load an image from artworkUri if it is present. The method will return null if neither artworkData nor artworkUri is present.

supportsMimeType

fun supportsMimeType(mimeType: String!): Boolean

Returns whether the given mimeType is supported.