diff options
| author | Nader Jawad <njawad@google.com> | 2019-03-06 17:29:22 -0800 |
|---|---|---|
| committer | Nader Jawad <njawad@google.com> | 2019-03-26 16:44:10 -0700 |
| commit | dadf251a0d6fbd8a4bdca3b748154a10db35433b (patch) | |
| tree | ad5df3a2b1039a9500a1985b97550f495ab9d7be /core/java/android/view/MenuInflater.java | |
| parent | 04b8032de5bcdbb368fa98b04664542b0048ff16 (diff) | |
Added framework APIs to leverage new BlendMode API
Updated various framework APIs to leverage the new BlendMode API
that parallels the corresponding porterduff mode equivalent.
Added new Drawable#onApplyBlendMode API that provides a backward
compatible solution for Drawable implementations that leverage
the new BlendMode API as well as fall back on the traditional
setTintMode(PorterDuff.Mode) API for instances where it is not
implemented
Bug:126726419
Test: Re-ran CTS graphics test cases
Change-Id: I119a7f57dce0a095c0a73cf83dc50b82beff5e32
Diffstat (limited to 'core/java/android/view/MenuInflater.java')
| -rw-r--r-- | core/java/android/view/MenuInflater.java | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/core/java/android/view/MenuInflater.java b/core/java/android/view/MenuInflater.java index a3cd0ba4b823..8b3b10f48a4a 100644 --- a/core/java/android/view/MenuInflater.java +++ b/core/java/android/view/MenuInflater.java @@ -23,7 +23,7 @@ import android.content.ContextWrapper; import android.content.res.ColorStateList; import android.content.res.TypedArray; import android.content.res.XmlResourceParser; -import android.graphics.PorterDuff; +import android.graphics.BlendMode; import android.graphics.drawable.Drawable; import android.util.AttributeSet; import android.util.Log; @@ -308,7 +308,7 @@ public class MenuInflater { private CharSequence itemTitleCondensed; private int itemIconResId; private ColorStateList itemIconTintList = null; - private PorterDuff.Mode itemIconTintMode = null; + private BlendMode mItemIconBlendMode = null; private char itemAlphabeticShortcut; private int itemAlphabeticModifiers; private char itemNumericShortcut; @@ -401,12 +401,12 @@ public class MenuInflater { itemTitleCondensed = a.getText(com.android.internal.R.styleable.MenuItem_titleCondensed); itemIconResId = a.getResourceId(com.android.internal.R.styleable.MenuItem_icon, 0); if (a.hasValue(com.android.internal.R.styleable.MenuItem_iconTintMode)) { - itemIconTintMode = Drawable.parseTintMode(a.getInt( + mItemIconBlendMode = Drawable.parseBlendMode(a.getInt( com.android.internal.R.styleable.MenuItem_iconTintMode, -1), - itemIconTintMode); + mItemIconBlendMode); } else { // Reset to null so that it's not carried over to the next item - itemIconTintMode = null; + mItemIconBlendMode = null; } if (a.hasValue(com.android.internal.R.styleable.MenuItem_iconTint)) { itemIconTintList = a.getColorStateList( @@ -487,8 +487,8 @@ public class MenuInflater { item.setShowAsAction(itemShowAsAction); } - if (itemIconTintMode != null) { - item.setIconTintMode(itemIconTintMode); + if (mItemIconBlendMode != null) { + item.setIconTintMode(mItemIconBlendMode); } if (itemIconTintList != null) { |
