mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
Make DataSourceBitmapLoader non-final
PiperOrigin-RevId: 608275835
This commit is contained in:
parent
3bbb0e7453
commit
5a3f18f837
@ -47,7 +47,7 @@ import java.util.concurrent.Executors;
|
|||||||
* that is shared between instances of this class.
|
* that is shared between instances of this class.
|
||||||
*/
|
*/
|
||||||
@UnstableApi
|
@UnstableApi
|
||||||
public final class DataSourceBitmapLoader implements BitmapLoader {
|
public class DataSourceBitmapLoader implements BitmapLoader {
|
||||||
|
|
||||||
public static final Supplier<ListeningExecutorService> DEFAULT_EXECUTOR_SERVICE =
|
public static final Supplier<ListeningExecutorService> DEFAULT_EXECUTOR_SERVICE =
|
||||||
Suppliers.memoize(
|
Suppliers.memoize(
|
||||||
@ -100,19 +100,19 @@ public final class DataSourceBitmapLoader implements BitmapLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ListenableFuture<Bitmap> decodeBitmap(byte[] data) {
|
public final ListenableFuture<Bitmap> decodeBitmap(byte[] data) {
|
||||||
return listeningExecutorService.submit(() -> decode(data, options));
|
return listeningExecutorService.submit(() -> decode(data, options));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ListenableFuture<Bitmap> loadBitmap(Uri uri) {
|
public final ListenableFuture<Bitmap> loadBitmap(Uri uri) {
|
||||||
return listeningExecutorService.submit(
|
return listeningExecutorService.submit(
|
||||||
() -> load(dataSourceFactory.createDataSource(), uri, options));
|
() -> load(dataSourceFactory.createDataSource(), uri, options));
|
||||||
}
|
}
|
||||||
|
|
||||||
// BitmapFactory's options parameter is null-ok.
|
// BitmapFactory's options parameter is null-ok.
|
||||||
@SuppressWarnings("nullness:argument.type.incompatible")
|
@SuppressWarnings("nullness:argument.type.incompatible")
|
||||||
private static Bitmap decode(byte[] data, @Nullable BitmapFactory.Options options)
|
protected static Bitmap decode(byte[] data, @Nullable BitmapFactory.Options options)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
@Nullable
|
@Nullable
|
||||||
Bitmap bitmap = BitmapFactory.decodeByteArray(data, /* offset= */ 0, data.length, options);
|
Bitmap bitmap = BitmapFactory.decodeByteArray(data, /* offset= */ 0, data.length, options);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user