Fix progress bar tinting, add tint support to ShapeDrawable

Cleans up APIs a little, since I think we may want to add tinting
modes beyond what Porter-Duff can provide. Plus we don't actually
support some of the Porter-Duff modes in hardware.

Change-Id: I2cea1b737cc93607a24842c54eb9f0d8346b29d4
This commit is contained in:
Alan Viverette
2014-02-26 15:38:51 -08:00
parent ba7d4f564c
commit 813d85b82c
6 changed files with 193 additions and 21 deletions

View File

@@ -558,6 +558,11 @@ public class BitmapDrawable extends Drawable {
invalidateSelf();
}
@Override
public ColorFilter getColorFilter() {
return mBitmapState.mPaint.getColorFilter();
}
/**
* Specifies a tint for this drawable.
* <p>
@@ -582,10 +587,21 @@ public class BitmapDrawable extends Drawable {
invalidateSelf();
}
/**
* Returns the tint color for this drawable.
*
* @return Color state list to use for tinting this drawable, or null if
* none set
*/
public ColorStateList getTint() {
return mBitmapState.mTint;
}
/**
* Specifies the blending mode used to apply tint.
*
* @param tintMode A Porter-Duff blending mode
* @hide Pending finalization of supported Modes
*/
public void setTintMode(Mode tintMode) {
mBitmapState.mTintMode = tintMode;
@@ -595,6 +611,16 @@ public class BitmapDrawable extends Drawable {
invalidateSelf();
}
/**
* Returns the blending mode used to apply tint.
*
* @return The Porter-Duff blending mode used to apply tint.
* @hide Pending finalization of supported Modes
*/
public Mode getTintMode() {
return mBitmapState.mTintMode;
}
/**
* @hide Candidate for future API inclusion
*/