FakeBitmapLoader


@UnstableApi
public final class FakeBitmapLoader implements BitmapLoader


A fake BitmapLoader that returns result for every decodeBitmap and loadBitmap call, and counts the calls.

Summary

Public constructors

Creates an instance that returns bitmap for every call.

Creates an instance that fails with throwable for every call.

Public methods

@NonNull ListenableFuture<@NonNull Bitmap>
decodeBitmap(@NonNull byte[] data)

Decodes an image from compressed binary data.

final int

The number of times decodeBitmap has been called.

final int

The number of times loadBitmap has been called.

@NonNull ListenableFuture<@NonNull Bitmap>

Loads an image from uri.

boolean

Returns whether the given mimeType is supported.

Public constructors

FakeBitmapLoader

public FakeBitmapLoader(@NonNull Bitmap bitmap)

Creates an instance that returns bitmap for every call.

FakeBitmapLoader

public FakeBitmapLoader(@NonNull ListenableFuture<@NonNull Bitmap> result)
Parameters
@NonNull ListenableFuture<@NonNull Bitmap> result

The result returned for every call.

FakeBitmapLoader

public FakeBitmapLoader(@NonNull Throwable throwable)

Creates an instance that fails with throwable for every call.

Public methods

decodeBitmap

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

Decodes an image from compressed binary data.

getDecodeBitmapCallCount

public final int getDecodeBitmapCallCount()

The number of times decodeBitmap has been called.

getLoadBitmapCallCount

public final int getLoadBitmapCallCount()

The number of times loadBitmap has been called.

loadBitmap

public @NonNull ListenableFuture<@NonNull Bitmap> loadBitmap(@NonNull Uri uri)

Loads an image from uri.

supportsMimeType

public boolean supportsMimeType(@NonNull String mimeType)

Returns whether the given mimeType is supported.