-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change asset uri data fetcher to return AssetFileDescriptor rather th…
…an ParcelFileDescriptor. PiperOrigin-RevId: 419944523
- Loading branch information
1 parent
a6d84a8
commit 52a8cf8
Showing
5 changed files
with
20 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 8 additions & 8 deletions
16
library/src/main/java/com/bumptech/glide/load/data/FileDescriptorAssetPathFetcher.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,30 @@ | ||
package com.bumptech.glide.load.data; | ||
|
||
import android.content.res.AssetFileDescriptor; | ||
import android.content.res.AssetManager; | ||
import android.os.ParcelFileDescriptor; | ||
import androidx.annotation.NonNull; | ||
import java.io.IOException; | ||
|
||
/** Fetches an {@link android.os.ParcelFileDescriptor} for an asset path. */ | ||
public class FileDescriptorAssetPathFetcher extends AssetPathFetcher<ParcelFileDescriptor> { | ||
/** Fetches an {@link android.content.res.AssetFileDescriptor} for an asset path. */ | ||
public class FileDescriptorAssetPathFetcher extends AssetPathFetcher<AssetFileDescriptor> { | ||
public FileDescriptorAssetPathFetcher(AssetManager assetManager, String assetPath) { | ||
super(assetManager, assetPath); | ||
} | ||
|
||
@Override | ||
protected ParcelFileDescriptor loadResource(AssetManager assetManager, String path) | ||
protected AssetFileDescriptor loadResource(AssetManager assetManager, String path) | ||
throws IOException { | ||
return assetManager.openFd(path).getParcelFileDescriptor(); | ||
return assetManager.openFd(path); | ||
} | ||
|
||
@Override | ||
protected void close(ParcelFileDescriptor data) throws IOException { | ||
protected void close(AssetFileDescriptor data) throws IOException { | ||
data.close(); | ||
} | ||
|
||
@NonNull | ||
@Override | ||
public Class<ParcelFileDescriptor> getDataClass() { | ||
return ParcelFileDescriptor.class; | ||
public Class<AssetFileDescriptor> getDataClass() { | ||
return AssetFileDescriptor.class; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters