Merge "Add transfer mode support to ColorDrawable" into oc-dev am: eedceb5721
am: a17c58ff59
Change-Id: Ied2dd786e7a31f53c685b920e119bd127f9d9f82
diff --git a/api/test-current.txt b/api/test-current.txt
index e780d83..725dd40 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -13999,6 +13999,7 @@
method public void draw(android.graphics.Canvas);
method public int getColor();
method public int getOpacity();
+ method public android.graphics.Xfermode getXfermode();
method public void setAlpha(int);
method public void setColor(int);
method public void setColorFilter(android.graphics.ColorFilter);
diff --git a/graphics/java/android/graphics/drawable/ColorDrawable.java b/graphics/java/android/graphics/drawable/ColorDrawable.java
index 559e3d3..9ae747d 100644
--- a/graphics/java/android/graphics/drawable/ColorDrawable.java
+++ b/graphics/java/android/graphics/drawable/ColorDrawable.java
@@ -18,6 +18,8 @@
import android.annotation.ColorInt;
import android.annotation.NonNull;
+import android.annotation.Nullable;
+import android.annotation.TestApi;
import android.content.pm.ActivityInfo.Config;
import android.graphics.*;
import android.graphics.PorterDuff.Mode;
@@ -213,6 +215,25 @@
return mColorState.mTint != null && mColorState.mTint.hasFocusStateSpecified();
}
+ /**
+ * @hide
+ * @param mode new transfer mode
+ */
+ @Override
+ public void setXfermode(@Nullable Xfermode mode) {
+ mPaint.setXfermode(mode);
+ invalidateSelf();
+ }
+
+ /**
+ * @hide
+ * @return current transfer mode
+ */
+ @TestApi
+ public Xfermode getXfermode() {
+ return mPaint.getXfermode();
+ }
+
@Override
public int getOpacity() {
if (mTintFilter != null || mPaint.getColorFilter() != null) {