diff options
author | Alan Viverette <alanv@google.com> | 2014-03-24 18:00:26 -0700 |
---|---|---|
committer | Alan Viverette <alanv@google.com> | 2014-03-24 18:00:26 -0700 |
commit | 52b999f0721b53e9c6e18a4bd664e89aeb65b2d5 (patch) | |
tree | 3ef7369c91bd51fae75769c23ebfb71e04d3989c /api | |
parent | 852472d9aa39eb4591eac43487ac3e0944e1daf6 (diff) | |
download | frameworks_base-52b999f0721b53e9c6e18a4bd664e89aeb65b2d5.zip frameworks_base-52b999f0721b53e9c6e18a4bd664e89aeb65b2d5.tar.gz frameworks_base-52b999f0721b53e9c6e18a4bd664e89aeb65b2d5.tar.bz2 |
Implement APIs for obtaining, caching themed Drawables
When Drawables are inflated during preload (or otherwise without a theme)
they cache their themeable attributes in their constant state as an array
keyed on attribute index. Drawables inflated with a theme will simply
resolve theme attributes as part of normal inflation, and they will not
cache any themeable attributes.
Drawables obtained from Resources are pulled from theme-specific cache
when possible. If an unthemed Drawable exists in the preload cache, a
new constant state will be obtained for the Drawable and the theme will
be applied by resolving the cached themeable attributes and overwriting
their respective constant state properties. If no cached version exists,
a new Drawable is inflated against the desired theme.
Constant states from themed drawables may be cached if the applied theme
is "pure" and was loaded from a style resource without any subsequent
modifications.
This CL does not handle applying themes to several Drawable types, but it
fully supports BitmapDrawable, GradientDrawable, NinePatchDrawable,
ColorDrawable, and TouchFeedbackDrawable.
BUG: 12611005
Change-Id: I4e794fbb62f7a371715f4ebdf946ee5f9a5ad1c9
Diffstat (limited to 'api')
-rw-r--r-- | api/current.txt | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/api/current.txt b/api/current.txt index ec1900e..9fd6dad 100644 --- a/api/current.txt +++ b/api/current.txt @@ -8125,6 +8125,7 @@ package android.content.res { method public void applyStyle(int, boolean); method public void dump(int, java.lang.String, java.lang.String); method public android.graphics.drawable.Drawable getDrawable(int) throws android.content.res.Resources.NotFoundException; + method public android.content.res.Resources getResources(); method public android.content.res.TypedArray obtainStyledAttributes(int[]); method public android.content.res.TypedArray obtainStyledAttributes(int, int[]) throws android.content.res.Resources.NotFoundException; method public android.content.res.TypedArray obtainStyledAttributes(android.util.AttributeSet, int[], int, int); @@ -8155,6 +8156,7 @@ package android.content.res { method public java.lang.String getString(int); method public java.lang.CharSequence getText(int); method public java.lang.CharSequence[] getTextArray(int); + method public int getType(int); method public boolean getValue(int, android.util.TypedValue); method public boolean hasValue(int); method public int length(); @@ -10492,15 +10494,22 @@ package android.graphics.drawable { public abstract class Drawable { ctor public Drawable(); + method public void applyTheme(android.content.res.Resources.Theme); + method public boolean canApplyTheme(); method public void clearColorFilter(); method public final void copyBounds(android.graphics.Rect); method public final android.graphics.Rect copyBounds(); method public static android.graphics.drawable.Drawable createFromPath(java.lang.String); method public static android.graphics.drawable.Drawable createFromResourceStream(android.content.res.Resources, android.util.TypedValue, java.io.InputStream, java.lang.String); method public static android.graphics.drawable.Drawable createFromResourceStream(android.content.res.Resources, android.util.TypedValue, java.io.InputStream, java.lang.String, android.graphics.BitmapFactory.Options); + method public static android.graphics.drawable.Drawable createFromResourceStreamThemed(android.content.res.Resources, android.util.TypedValue, java.io.InputStream, java.lang.String, android.content.res.Resources.Theme); + method public static android.graphics.drawable.Drawable createFromResourceStreamThemed(android.content.res.Resources, android.util.TypedValue, java.io.InputStream, java.lang.String, android.graphics.BitmapFactory.Options, android.content.res.Resources.Theme); method public static android.graphics.drawable.Drawable createFromStream(java.io.InputStream, java.lang.String); + method public static android.graphics.drawable.Drawable createFromStreamThemed(java.io.InputStream, java.lang.String, android.content.res.Resources.Theme); method public static android.graphics.drawable.Drawable createFromXml(android.content.res.Resources, org.xmlpull.v1.XmlPullParser) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException; method public static android.graphics.drawable.Drawable createFromXmlInner(android.content.res.Resources, org.xmlpull.v1.XmlPullParser, android.util.AttributeSet) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException; + method public static android.graphics.drawable.Drawable createFromXmlInnerThemed(android.content.res.Resources, org.xmlpull.v1.XmlPullParser, android.util.AttributeSet, android.content.res.Resources.Theme) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException; + method public static android.graphics.drawable.Drawable createFromXmlThemed(android.content.res.Resources, org.xmlpull.v1.XmlPullParser, android.content.res.Resources.Theme) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException; method public abstract void draw(android.graphics.Canvas); method public int getAlpha(); method public final android.graphics.Rect getBounds(); @@ -10520,6 +10529,7 @@ package android.graphics.drawable { method public int[] getState(); method public android.graphics.Region getTransparentRegion(); method public void inflate(android.content.res.Resources, org.xmlpull.v1.XmlPullParser, android.util.AttributeSet) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException; + method public void inflate(android.content.res.Resources, org.xmlpull.v1.XmlPullParser, android.util.AttributeSet, android.content.res.Resources.Theme) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException; method public void invalidateSelf(); method public boolean isAutoMirrored(); method public boolean isStateful(); @@ -10555,9 +10565,11 @@ package android.graphics.drawable { public static abstract class Drawable.ConstantState { ctor public Drawable.ConstantState(); + method public boolean canApplyTheme(); method public abstract int getChangingConfigurations(); method public abstract android.graphics.drawable.Drawable newDrawable(); method public android.graphics.drawable.Drawable newDrawable(android.content.res.Resources); + method public android.graphics.drawable.Drawable newDrawable(android.content.res.Resources, android.content.res.Resources.Theme); } public class DrawableContainer extends android.graphics.drawable.Drawable implements android.graphics.drawable.Drawable.Callback { |