From b9f7aac3488873677377b36c57338d758098f78e Mon Sep 17 00:00:00 2001 From: Dan Sandler Date: Wed, 4 Mar 2015 13:08:49 -0500 Subject: Icon: a clean, parcelable place for images. Binder APIs which wish to consume Bitmaps *and* drawable resources can now do so by using Icon, a kind of union type that accommodates each of these. Icon also accepts byte arrays holding compressed Bitmaps (PNG, JPEG, etc), which saves clients the additional memory cost of decoding and sending full uncompressed bitmaps through Binder interfaces. Receiving clients can call loadDrawable{,Async} and then getDrawable to start immediately using the image in an ImageView or other Drawable-hosting container. Bug: 19609468 Change-Id: Ic1343711c2ac0b15876b46f0b6008b0108a49470 --- api/current.txt | 19 +++++++++++++++++++ api/system-current.txt | 19 +++++++++++++++++++ 2 files changed, 38 insertions(+) (limited to 'api') diff --git a/api/current.txt b/api/current.txt index be01112..f8d3ef3 100644 --- a/api/current.txt +++ b/api/current.txt @@ -12486,6 +12486,25 @@ package android.graphics.drawable { enum_constant public static final android.graphics.drawable.GradientDrawable.Orientation TR_BL; } + public final class Icon implements android.os.Parcelable { + method public static android.graphics.drawable.Icon createWithBitmap(android.graphics.Bitmap); + method public static android.graphics.drawable.Icon createWithContentUri(java.lang.String); + method public static android.graphics.drawable.Icon createWithContentUri(android.net.Uri); + method public static android.graphics.drawable.Icon createWithData(byte[], int, int); + method public static android.graphics.drawable.Icon createWithFilePath(java.lang.String); + method public static android.graphics.drawable.Icon createWithResource(android.content.res.Resources, int); + method public int describeContents(); + method public android.graphics.drawable.Drawable loadDrawable(android.content.Context); + method public void loadDrawableAsync(android.content.Context, android.os.Message); + method public void loadDrawableAsync(android.content.Context, android.os.Handler, android.graphics.drawable.Icon.OnDrawableLoadedListener); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + } + + public static abstract interface Icon.OnDrawableLoadedListener { + method public abstract void onDrawableLoaded(android.graphics.drawable.Drawable); + } + public class InsetDrawable extends android.graphics.drawable.DrawableWrapper { ctor public InsetDrawable(android.graphics.drawable.Drawable, int); ctor public InsetDrawable(android.graphics.drawable.Drawable, int, int, int, int); diff --git a/api/system-current.txt b/api/system-current.txt index c4f96af..87f53dc 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -12780,6 +12780,25 @@ package android.graphics.drawable { enum_constant public static final android.graphics.drawable.GradientDrawable.Orientation TR_BL; } + public final class Icon implements android.os.Parcelable { + method public static android.graphics.drawable.Icon createWithBitmap(android.graphics.Bitmap); + method public static android.graphics.drawable.Icon createWithContentUri(java.lang.String); + method public static android.graphics.drawable.Icon createWithContentUri(android.net.Uri); + method public static android.graphics.drawable.Icon createWithData(byte[], int, int); + method public static android.graphics.drawable.Icon createWithFilePath(java.lang.String); + method public static android.graphics.drawable.Icon createWithResource(android.content.res.Resources, int); + method public int describeContents(); + method public android.graphics.drawable.Drawable loadDrawable(android.content.Context); + method public void loadDrawableAsync(android.content.Context, android.os.Message); + method public void loadDrawableAsync(android.content.Context, android.os.Handler, android.graphics.drawable.Icon.OnDrawableLoadedListener); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + } + + public static abstract interface Icon.OnDrawableLoadedListener { + method public abstract void onDrawableLoaded(android.graphics.drawable.Drawable); + } + public class InsetDrawable extends android.graphics.drawable.DrawableWrapper { ctor public InsetDrawable(android.graphics.drawable.Drawable, int); ctor public InsetDrawable(android.graphics.drawable.Drawable, int, int, int, int); -- cgit v1.1