Add swipe-to-dismiss notifications in popup menu.

- Next secondary icon animates up to replace dismissed main notification
- Add padding around main notification so it always aligns with the
  straight edges of the view (not the rounded corners); looks more
  dismissable
- Notification view collapses as notifications are dismissed
- To mimic system notification behavior, we copy SwipeHelper,
  FlingAnimationUtils, and Interpolators. We also apply elevation
  to notifications and reveal a darker color beneath when dismissing.

Bug: 32410600
Change-Id: I9fbf10e73bb4996f17ef061c856efb013967d972
This commit is contained in:
Tony Wickham
2017-01-20 09:38:25 -08:00
parent f3d02e4716
commit 9438ed414f
29 changed files with 2123 additions and 42 deletions

View File

@@ -129,10 +129,7 @@ public class FastBitmapDrawable extends Drawable {
mBadgeInfo = badgeInfo;
mBadgeRenderer = badgeRenderer;
if (wasBadged || isBadged) {
if (mBadgeInfo != null && mIconPalette == null) {
mIconPalette = IconPalette.fromDominantColor(Utilities
.findDominantColorByHue(mBitmap, 20));
}
mIconPalette = getIconPalette();
invalidateSelf();
}
}
@@ -161,6 +158,14 @@ public class FastBitmapDrawable extends Drawable {
}
}
public IconPalette getIconPalette() {
if (mIconPalette == null) {
mIconPalette = IconPalette.fromDominantColor(Utilities
.findDominantColorByHue(mBitmap, 20));
}
return mIconPalette;
}
private boolean hasBadge() {
return mBadgeInfo != null && mBadgeInfo.getNotificationCount() != 0;
}