diff options
| author | 2018-03-16 15:04:04 -0400 | |
|---|---|---|
| committer | 2018-03-19 13:01:52 -0400 | |
| commit | 1eccac89c13a79671e04cfce359a9506b284d5fe (patch) | |
| tree | ebc4dad7a88fb1d6fa3bf3f0840887a22c039bc4 | |
| parent | bf190fd9641cd3ad76bc7bb289b4a3de83d0335a (diff) | |
Add ImageDecoder.Source for resources
Bug: 74545298
Test: Ibc283c2e8aee999e951de51f3a43b581a765aaf5
Although resources can already be accessed with ContentResolver + URI,
this allows a simple method to do the same.
Change-Id: I1bf698f36d5540f6de7cb9957e4223123d0f4331
| -rw-r--r-- | api/current.txt | 1 | ||||
| -rw-r--r-- | graphics/java/android/graphics/ImageDecoder.java | 7 |
2 files changed, 3 insertions, 5 deletions
diff --git a/api/current.txt b/api/current.txt index 8321c1856607..b69b2bed8a28 100644 --- a/api/current.txt +++ b/api/current.txt @@ -13606,6 +13606,7 @@ package android.graphics { public final class ImageDecoder implements java.lang.AutoCloseable { method public void close(); + method public static android.graphics.ImageDecoder.Source createSource(android.content.res.Resources, int); method public static android.graphics.ImageDecoder.Source createSource(android.content.ContentResolver, android.net.Uri); method public static android.graphics.ImageDecoder.Source createSource(java.nio.ByteBuffer); method public static android.graphics.ImageDecoder.Source createSource(java.io.File); diff --git a/graphics/java/android/graphics/ImageDecoder.java b/graphics/java/android/graphics/ImageDecoder.java index 88701fac66c7..8196d6695d0c 100644 --- a/graphics/java/android/graphics/ImageDecoder.java +++ b/graphics/java/android/graphics/ImageDecoder.java @@ -24,7 +24,6 @@ import static java.lang.annotation.RetentionPolicy.SOURCE; import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; -import android.annotation.RawRes; import android.content.ContentResolver; import android.content.res.AssetFileDescriptor; import android.content.res.AssetManager.AssetInputStream; @@ -543,17 +542,15 @@ public final class ImageDecoder implements AutoCloseable { } /** - * Create a new {@link Source} from an asset. - * @hide + * Create a new {@link Source} from a resource. * * @param res the {@link Resources} object containing the image data. * @param resId resource ID of the image data. - * // FIXME: Can be an @DrawableRes? * @return a new Source object, which can be passed to * {@link #decodeDrawable} or {@link #decodeBitmap}. */ @NonNull - public static Source createSource(@NonNull Resources res, @RawRes int resId) + public static Source createSource(@NonNull Resources res, int resId) { return new ResourceSource(res, resId); } |