diff options
author | Tony Wickham <twickham@google.com> | 2017-06-07 14:32:23 -0700 |
---|---|---|
committer | Tony Wickham <twickham@google.com> | 2017-06-08 21:08:47 +0000 |
commit | 7092db02410562026da17a7b38f48025cc847de2 (patch) | |
tree | f1c0c5a50594ce890109bdb25dd0346dee9cbf6d /src/com/android/launcher3/BubbleTextView.java | |
parent | 85b64c7da0f1134fdbae954acbc2925c1433566a (diff) | |
download | android_packages_apps_Trebuchet-7092db02410562026da17a7b38f48025cc847de2.tar.gz android_packages_apps_Trebuchet-7092db02410562026da17a7b38f48025cc847de2.tar.bz2 android_packages_apps_Trebuchet-7092db02410562026da17a7b38f48025cc847de2.zip |
Add support for color extracted notification dots
Changing the badge_color in colors.xml to transparent
will cause them to be color extracted.
When an extracted color is used in the IconPalette, we
desaturate the background. Otherwise we respect the
exact color specified in colors.xml.
Change-Id: Ie82d0c5335fa5f24d4cc47766e4c1719c4916f8b
Diffstat (limited to 'src/com/android/launcher3/BubbleTextView.java')
-rw-r--r-- | src/com/android/launcher3/BubbleTextView.java | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java index 94c7e07fb..3c3e224e4 100644 --- a/src/com/android/launcher3/BubbleTextView.java +++ b/src/com/android/launcher3/BubbleTextView.java @@ -96,7 +96,7 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver { private BadgeInfo mBadgeInfo; private BadgeRenderer mBadgeRenderer; - private IconPalette mIconPalette; + private IconPalette mBadgePalette; private float mBadgeScale; private boolean mForceHideBadge; private Point mTempSpaceForBadgeOffset = new Point(); @@ -453,7 +453,7 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver { final int scrollX = getScrollX(); final int scrollY = getScrollY(); canvas.translate(scrollX, scrollY); - mBadgeRenderer.draw(canvas, mBadgeInfo, mTempIconBounds, mBadgeScale, + mBadgeRenderer.draw(canvas, mBadgePalette, mBadgeInfo, mTempIconBounds, mBadgeScale, mTempSpaceForBadgeOffset); canvas.translate(-scrollX, -scrollY); } @@ -578,7 +578,10 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver { float newBadgeScale = isBadged ? 1f : 0; mBadgeRenderer = mLauncher.getDeviceProfile().mBadgeRenderer; if (wasBadged || isBadged) { - mIconPalette = ((FastBitmapDrawable) mIcon).getIconPalette(); + mBadgePalette = IconPalette.getBadgePalette(getResources()); + if (mBadgePalette == null) { + mBadgePalette = ((FastBitmapDrawable) mIcon).getIconPalette(); + } // Animate when a badge is first added or when it is removed. if (animate && (wasBadged ^ isBadged) && isShown()) { ObjectAnimator.ofFloat(this, BADGE_SCALE_PROPERTY, newBadgeScale).start(); @@ -590,6 +593,10 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver { } } + public IconPalette getBadgePalette() { + return mBadgePalette; + } + /** * Sets the icon for this view based on the layout direction. */ |