From 9438ed414fdabadb4cd09da184867b1c44b91095 Mon Sep 17 00:00:00 2001 From: Tony Wickham Date: Fri, 20 Jan 2017 09:38:25 -0800 Subject: [PATCH] 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 --- AndroidManifest-common.xml | 2 +- res/drawable/bg_white_pill_bottom.xml | 22 + res/drawable/bg_white_pill_top.xml | 22 + res/layout/notification.xml | 61 ++ res/layout/notification_footer.xml | 42 ++ res/layout/notification_main.xml | 54 ++ res/values/config.xml | 3 +- res/values/dimens.xml | 15 +- res/values/strings.xml | 7 + res/values/styles.xml | 20 + src/com/android/launcher3/BubbleTextView.java | 6 + .../android/launcher3/FastBitmapDrawable.java | 13 +- src/com/android/launcher3/Launcher.java | 2 +- .../android/launcher3/LauncherAnimUtils.java | 16 + .../android/launcher3/badge/BadgeInfo.java | 1 + .../launcher3/graphics/IconPalette.java | 4 +- .../notification/FlingAnimationUtils.java | 354 +++++++++ .../launcher3/notification/Interpolators.java | 35 + .../NotificationFooterLayout.java | 244 +++++++ .../NotificationInfo.java | 26 +- .../notification/NotificationItemView.java | 173 +++++ .../NotificationListener.java | 3 +- .../notification/NotificationMainView.java | 156 ++++ .../launcher3/notification/SwipeHelper.java | 687 ++++++++++++++++++ .../popup/PopupContainerWithArrow.java | 120 ++- .../launcher3/popup/PopupDataProvider.java | 13 +- .../launcher3/popup/PopupItemView.java | 8 +- .../launcher3/popup/PopupPopulator.java | 47 +- .../util/PillRevealOutlineProvider.java | 9 +- 29 files changed, 2123 insertions(+), 42 deletions(-) create mode 100644 res/drawable/bg_white_pill_bottom.xml create mode 100644 res/drawable/bg_white_pill_top.xml create mode 100644 res/layout/notification.xml create mode 100644 res/layout/notification_footer.xml create mode 100644 res/layout/notification_main.xml create mode 100644 src/com/android/launcher3/notification/FlingAnimationUtils.java create mode 100644 src/com/android/launcher3/notification/Interpolators.java create mode 100644 src/com/android/launcher3/notification/NotificationFooterLayout.java rename src/com/android/launcher3/{badge => notification}/NotificationInfo.java (74%) create mode 100644 src/com/android/launcher3/notification/NotificationItemView.java rename src/com/android/launcher3/{badge => notification}/NotificationListener.java (99%) create mode 100644 src/com/android/launcher3/notification/NotificationMainView.java create mode 100644 src/com/android/launcher3/notification/SwipeHelper.java diff --git a/AndroidManifest-common.xml b/AndroidManifest-common.xml index 5588289b72..924af24cb9 100644 --- a/AndroidManifest-common.xml +++ b/AndroidManifest-common.xml @@ -76,7 +76,7 @@ android:process=":wallpaper_chooser"> - diff --git a/res/drawable/bg_white_pill_bottom.xml b/res/drawable/bg_white_pill_bottom.xml new file mode 100644 index 0000000000..a1ea48cec3 --- /dev/null +++ b/res/drawable/bg_white_pill_bottom.xml @@ -0,0 +1,22 @@ + + + + + + + \ No newline at end of file diff --git a/res/drawable/bg_white_pill_top.xml b/res/drawable/bg_white_pill_top.xml new file mode 100644 index 0000000000..9988b2913e --- /dev/null +++ b/res/drawable/bg_white_pill_top.xml @@ -0,0 +1,22 @@ + + + + + + + \ No newline at end of file diff --git a/res/layout/notification.xml b/res/layout/notification.xml new file mode 100644 index 0000000000..d828c4a362 --- /dev/null +++ b/res/layout/notification.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + diff --git a/res/layout/notification_footer.xml b/res/layout/notification_footer.xml new file mode 100644 index 0000000000..ceea24a66b --- /dev/null +++ b/res/layout/notification_footer.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + diff --git a/res/layout/notification_main.xml b/res/layout/notification_main.xml new file mode 100644 index 0000000000..efb74b0f7e --- /dev/null +++ b/res/layout/notification_main.xml @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + diff --git a/res/values/config.xml b/res/values/config.xml index d270def78e..cb813d59b7 100644 --- a/res/values/config.xml +++ b/res/values/config.xml @@ -97,12 +97,13 @@ - + 220 80 40 150 20 + 300 diff --git a/res/values/dimens.xml b/res/values/dimens.xml index 3a2eea61b6..2cf17ead7b 100644 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -172,9 +172,22 @@ 24dp 12dp + 28dp + 24dp + + + + 2dp + 8dp + 8dp + 36dp + + @dimen/bg_pill_radius + 2dp + 0.5dp + 70dp 24dp - diff --git a/res/values/strings.xml b/res/values/strings.xml index f1de623787..a6f44f6376 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -67,6 +67,13 @@ Search for more apps + + + +%1$d + + Notifications + diff --git a/res/values/styles.xml b/res/values/styles.xml index 4e70f43d07..8b4a1dba40 100644 --- a/res/values/styles.xml +++ b/res/values/styles.xml @@ -112,6 +112,26 @@ @dimen/deep_shortcut_icon_size + + + +