summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Selim Cinek <cinek@google.com> 2017-05-03 15:17:10 -0700
committer Selim Cinek <cinek@google.com> 2017-05-05 01:27:01 +0000
commitca585d29ba32637dc1b335ff527a7e777048d250 (patch)
treebe2b6a1c299509e71f1a8e8492b08a86005dcbaf
parent919076aa2ac4a5377c8f063ee487fd5e8461a7d0 (diff)
Improved the gradient drawing of the media notification
Previously we were drawing with a color on top of the image instead of fading it out. This could lead to visible artefacts in the background. We're now fading out the alpha in a similar manner instead. Test: runtest systemui Change-Id: Ie6af7751a734b8fa44279eba970e7ca5ba67a4c0 Fixes: 37950482
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/ImageGradientColorizer.java17
1 files changed, 10 insertions, 7 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/ImageGradientColorizer.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/ImageGradientColorizer.java
index 82910b8bf967..f65d3e63e61b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/ImageGradientColorizer.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/ImageGradientColorizer.java
@@ -70,8 +70,6 @@ public class ImageGradientColorizer {
0, 0, 0, 1, 0,
});
- drawable.setColorFilter(new ColorMatrixColorFilter(m));
- drawable.draw(canvas);
Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
LinearGradient linearGradient = new LinearGradient(0, 0, size, 0,
new int[] {0, Color.argb(0.5f, 1, 1, 1), Color.BLACK},
@@ -83,14 +81,19 @@ public class ImageGradientColorizer {
drawable.draw(fadeInCanvas);
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_IN));
fadeInCanvas.drawPaint(paint);
- canvas.drawBitmap(fadeIn, 0, 0, null);
- linearGradient = new LinearGradient(0, 0, size, 0,
- new int[] {backgroundColor, Color.argb(0.5f, tr, tg, tb), 0},
+ Paint coloredPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
+ coloredPaint.setColorFilter(new ColorMatrixColorFilter(m));
+ coloredPaint.setAlpha((int) (0.5f * 255));
+ canvas.drawBitmap(fadeIn, 0, 0, coloredPaint);
+
+ linearGradient = new LinearGradient(0, 0, size, 0,
+ new int[] {0, Color.argb(0.5f, 1, 1, 1), Color.BLACK},
new float[] {0.0f, 0.6f, 1.0f}, Shader.TileMode.CLAMP);
paint.setShader(linearGradient);
- paint.setXfermode(null);
- canvas.drawPaint(paint);
+ fadeInCanvas.drawPaint(paint);
+ canvas.drawBitmap(fadeIn, 0, 0, null);
+
return newBitmap;
}
}