diff options
| author | Chet Haase <chet@google.com> | 2010-10-06 09:46:45 -0700 |
|---|---|---|
| committer | Chet Haase <chet@google.com> | 2010-11-01 10:19:44 -0700 |
| commit | 70d4ba15b1f0c1133c5aabc86de828b41e482fff (patch) | |
| tree | 461f6a3acfc3b924d6c4e5902ed80e569123d349 /graphics | |
| parent | 6b21cdeb5f0127862d82f24a4b6001f495e3c8cd (diff) | |
| download | frameworks_base-70d4ba15b1f0c1133c5aabc86de828b41e482fff.zip frameworks_base-70d4ba15b1f0c1133c5aabc86de828b41e482fff.tar.gz frameworks_base-70d4ba15b1f0c1133c5aabc86de828b41e482fff.tar.bz2 | |
Performance optimizations for animations and toolkit
Change-Id: I316a48273a9cbb428a965e4b849b3e5e9e8202f1
Diffstat (limited to 'graphics')
| -rw-r--r-- | graphics/java/android/graphics/drawable/ColorDrawable.java | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/graphics/java/android/graphics/drawable/ColorDrawable.java b/graphics/java/android/graphics/drawable/ColorDrawable.java index a25fad4..289348a 100644 --- a/graphics/java/android/graphics/drawable/ColorDrawable.java +++ b/graphics/java/android/graphics/drawable/ColorDrawable.java @@ -51,7 +51,7 @@ public class ColorDrawable extends Drawable { */ public ColorDrawable(int color) { this(null); - mState.mBaseColor = mState.mUseColor = color; + setColor(color); } private ColorDrawable(ColorState state) { @@ -72,6 +72,25 @@ public class ColorDrawable extends Drawable { } /** + * Gets the drawable's color value. + * + * @return int The color to draw. + */ + public int getColor() { + return mState.mUseColor; + } + + /** + * Sets the drawable's color value. This action will clobber the results of prior calls to + * {@link #setAlpha(int)} on this object, which side-affected the underlying color. + * + * @param color The color to draw. + */ + public void setColor(int color) { + mState.mBaseColor = mState.mUseColor = color; + } + + /** * Returns the alpha value of this drawable's color. * * @return A value between 0 and 255. @@ -131,7 +150,7 @@ public class ColorDrawable extends Drawable { } final static class ColorState extends ConstantState { - int mBaseColor; // initial color. never changes + int mBaseColor; // base color, independent of setAlpha() int mUseColor; // basecolor modulated by setAlpha() int mChangingConfigurations; |
