diff options
| author | 2019-04-01 16:26:32 +0000 | |
|---|---|---|
| committer | 2019-04-01 16:26:32 +0000 | |
| commit | a78f8421214bc7bac5ea0f3ed2cd671b6fdcb730 (patch) | |
| tree | 1e4e04b035aac052ddff4645993bfc99ac5ecb7d /graphics/java | |
| parent | 0cf63c31d4d31b660b7671280c31fbfb943da73e (diff) | |
| parent | 7ddb3965d949e53def927fc926f77850bf85d29e (diff) | |
Merge "Relaxed nullability requirements for setTintMode APIs for both PorterDuff.Mode and BlendMode"
Diffstat (limited to 'graphics/java')
| -rw-r--r-- | graphics/java/android/graphics/drawable/Drawable.java | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/graphics/java/android/graphics/drawable/Drawable.java b/graphics/java/android/graphics/drawable/Drawable.java index e4142a933f0f..adc04fb03e2a 100644 --- a/graphics/java/android/graphics/drawable/Drawable.java +++ b/graphics/java/android/graphics/drawable/Drawable.java @@ -688,20 +688,20 @@ public abstract class Drawable { * {@link #setColorFilter(int, PorterDuff.Mode)} overrides tint. * </p> * - * @param tintMode A Porter-Duff blending mode + * @param tintMode A Porter-Duff blending mode to apply to the drawable, a value of null sets + * the default Porter-Diff blending mode value + * of {@link PorterDuff.Mode#SRC_IN} * @see #setTint(int) * @see #setTintList(ColorStateList) * * @deprecated use {@link #setTintMode(BlendMode)} instead */ @Deprecated - public void setTintMode(@NonNull PorterDuff.Mode tintMode) { + public void setTintMode(@Nullable PorterDuff.Mode tintMode) { if (!mSetTintModeInvoked) { mSetTintModeInvoked = true; - BlendMode mode = BlendMode.fromValue(tintMode.nativeInt); - if (mode != null) { - setTintMode(mode); - } + BlendMode mode = tintMode != null ? BlendMode.fromValue(tintMode.nativeInt) : null; + setTintMode(mode != null ? mode : Drawable.DEFAULT_BLEND_MODE); mSetTintModeInvoked = false; } } @@ -716,17 +716,16 @@ public abstract class Drawable { * {@link #setColorFilter(ColorFilter)} * </p> * - * @param blendMode + * @param blendMode BlendMode to apply to the drawable, a value of null sets the default + * blend mode value of {@link BlendMode#SRC_IN} * @see #setTint(int) * @see #setTintList(ColorStateList) */ - public void setTintMode(@NonNull BlendMode blendMode) { + public void setTintMode(@Nullable BlendMode blendMode) { if (!mSetBlendModeInvoked) { mSetBlendModeInvoked = true; PorterDuff.Mode mode = BlendMode.blendModeToPorterDuffMode(blendMode); - if (mode != null) { - setTintMode(mode); - } + setTintMode(mode != null ? mode : Drawable.DEFAULT_TINT_MODE); mSetBlendModeInvoked = false; } } |