diff options
author | Tony Wickham <twickham@google.com> | 2017-09-05 15:09:43 -0700 |
---|---|---|
committer | Tony Wickham <twickham@google.com> | 2017-09-06 13:37:00 -0700 |
commit | 2063ebd990fdbea3f273a5c4fef3b739852c51c5 (patch) | |
tree | becf8e66267f010cb6911b97613af4a435822f0d /src | |
parent | 94b02ad8882f971e89cca12f8abfb1931b2e77dc (diff) | |
download | android_packages_apps_Trebuchet-2063ebd990fdbea3f273a5c4fef3b739852c51c5.tar.gz android_packages_apps_Trebuchet-2063ebd990fdbea3f273a5c4fef3b739852c51c5.tar.bz2 android_packages_apps_Trebuchet-2063ebd990fdbea3f273a5c4fef3b739852c51c5.zip |
Adjust notification paddings
- Reduce main notification height
- Increase header height and center "Notifications"
- Footer has short height when empty to serve as padding
Bug: 65215656
Change-Id: I691d176628b0b51e8d9af030084b8c29837778dc
Diffstat (limited to 'src')
3 files changed, 19 insertions, 6 deletions
diff --git a/src/com/android/launcher3/notification/NotificationFooterLayout.java b/src/com/android/launcher3/notification/NotificationFooterLayout.java index 2455eabea..ad07d37bd 100644 --- a/src/com/android/launcher3/notification/NotificationFooterLayout.java +++ b/src/com/android/launcher3/notification/NotificationFooterLayout.java @@ -200,7 +200,9 @@ public class NotificationFooterLayout extends FrameLayout { PopupContainerWithArrow popup = PopupContainerWithArrow.getOpen( Launcher.getLauncher(getContext())); if (popup != null) { - Animator collapseFooter = popup.reduceNotificationViewHeight(getHeight(), + final int newHeight = getResources().getDimensionPixelSize( + R.dimen.notification_empty_footer_height); + Animator collapseFooter = popup.reduceNotificationViewHeight(getHeight() - newHeight, getResources().getInteger(R.integer.config_removeNotificationViewDuration)); collapseFooter.addListener(new AnimatorListenerAdapter() { @Override @@ -208,7 +210,7 @@ public class NotificationFooterLayout extends FrameLayout { ((ViewGroup) getParent()).findViewById(R.id.divider).setVisibility(GONE); // Keep view around because gutter is aligned to it, but remove height to // both hide the view and keep calculations correct for last dismissal. - getLayoutParams().height = 0; + getLayoutParams().height = newHeight; requestLayout(); } }); diff --git a/src/com/android/launcher3/notification/NotificationItemView.java b/src/com/android/launcher3/notification/NotificationItemView.java index 78c64d7da..ab94c32d0 100644 --- a/src/com/android/launcher3/notification/NotificationItemView.java +++ b/src/com/android/launcher3/notification/NotificationItemView.java @@ -90,9 +90,19 @@ public class NotificationItemView extends PopupItemView implements LogContainerP return mMainView; } + /** + * This method is used to calculate the height to remove when dismissing the last notification. + * We subtract the height of the footer in this case since the footer should be gone or in the + * process of being removed. + * @return The height of the entire notification item, minus the footer if it still exists. + */ public int getHeightMinusFooter() { - int footerHeight = mFooter.getParent() == null ? 0 : mFooter.getHeight(); - return getHeight() - footerHeight; + if (mFooter.getParent() == null) { + return getHeight(); + } + int excessFooterHeight = mFooter.getHeight() - getResources().getDimensionPixelSize( + R.dimen.notification_empty_footer_height); + return getHeight() - excessFooterHeight; } public Animator animateHeightRemoval(int heightToRemove, boolean shouldRemoveFromTop) { diff --git a/src/com/android/launcher3/popup/PopupContainerWithArrow.java b/src/com/android/launcher3/popup/PopupContainerWithArrow.java index c3e2d8b89..8441598cf 100644 --- a/src/com/android/launcher3/popup/PopupContainerWithArrow.java +++ b/src/com/android/launcher3/popup/PopupContainerWithArrow.java @@ -275,8 +275,9 @@ public class PopupContainerWithArrow extends AbstractFloatingView implements Dra if (itemTypeToPopulate == PopupPopulator.Item.NOTIFICATION) { mNotificationItemView = (NotificationItemView) item; boolean notificationFooterHasIcons = numNotifications > 1; - int footerHeight = notificationFooterHasIcons ? - res.getDimensionPixelSize(R.dimen.notification_footer_height) : 0; + int footerHeight = res.getDimensionPixelSize( + notificationFooterHasIcons ? R.dimen.notification_footer_height + : R.dimen.notification_empty_footer_height); item.findViewById(R.id.footer).getLayoutParams().height = footerHeight; if (notificationFooterHasIcons) { mNotificationItemView.findViewById(R.id.divider).setVisibility(VISIBLE); |