Fix visibility of notification footer divider

Now it is only visible when the notification footer is present,
instead of always being visible.

Change-Id: Ie85ff31918901115cdfe55b36e75aa80b43e7b13
diff --git a/res/layout/notification.xml b/res/layout/notification.xml
index a03dd08..a183c92 100644
--- a/res/layout/notification.xml
+++ b/res/layout/notification.xml
@@ -66,7 +66,8 @@
             android:layout_width="match_parent"
             android:layout_height="@dimen/popup_item_divider_height"
             android:background="?android:attr/listDivider"
-            android:layout_below="@id/main_view"/>
+            android:layout_below="@id/main_view"
+            android:visibility="gone" />
 
         <include layout="@layout/notification_footer"
             android:id="@+id/footer"
diff --git a/src/com/android/launcher3/notification/NotificationFooterLayout.java b/src/com/android/launcher3/notification/NotificationFooterLayout.java
index 051c033..b83c9b9 100644
--- a/src/com/android/launcher3/notification/NotificationFooterLayout.java
+++ b/src/com/android/launcher3/notification/NotificationFooterLayout.java
@@ -205,6 +205,7 @@
                 collapseFooter.addListener(new AnimatorListenerAdapter() {
                     @Override
                     public void onAnimationEnd(Animator animation) {
+                        ((ViewGroup) getParent()).findViewById(R.id.divider).setVisibility(GONE);
                         ((ViewGroup) getParent()).removeView(NotificationFooterLayout.this);
                     }
                 });
diff --git a/src/com/android/launcher3/popup/PopupContainerWithArrow.java b/src/com/android/launcher3/popup/PopupContainerWithArrow.java
index 152886e..fa4caab 100644
--- a/src/com/android/launcher3/popup/PopupContainerWithArrow.java
+++ b/src/com/android/launcher3/popup/PopupContainerWithArrow.java
@@ -278,6 +278,9 @@
                 int footerHeight = notificationFooterHasIcons ?
                         res.getDimensionPixelSize(R.dimen.notification_footer_height) : 0;
                 item.findViewById(R.id.footer).getLayoutParams().height = footerHeight;
+                if (notificationFooterHasIcons) {
+                    mNotificationItemView.findViewById(R.id.divider).setVisibility(VISIBLE);
+                }
 
                 int roundedCorners = ROUNDED_TOP_CORNERS | ROUNDED_BOTTOM_CORNERS;
                 if (shouldUnroundTopCorners) {