Improved notification templates further

Inbox and bigtext style are adapted.

Change-Id: I85b33f7387a2bde46fc73d2bc82538d6d13f0a70
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java
index cdd6242..ff7bc8a 100644
--- a/core/java/android/app/Notification.java
+++ b/core/java/android/app/Notification.java
@@ -3009,7 +3009,6 @@
             contentView.setViewVisibility(R.id.text2, View.GONE);
             contentView.setViewVisibility(R.id.info, View.GONE);
             contentView.setViewVisibility(R.id.line3, View.GONE);
-            contentView.setViewVisibility(R.id.overflow_divider, View.GONE);
             contentView.setViewVisibility(R.id.progress, View.GONE);
         }
 
@@ -3117,7 +3116,6 @@
 
             // Note getStandardView may hide line 3 again.
             contentView.setViewVisibility(R.id.line3, showLine3 ? View.VISIBLE : View.GONE);
-            contentView.setViewVisibility(R.id.overflow_divider, showLine3 ? View.VISIBLE : View.GONE);
             return contentView;
         }
 
@@ -3597,19 +3595,14 @@
 
             final CharSequence overflowText = mSummaryTextSet ? mSummaryText : null;
             final CharSequence subText = mBuilder.mN.extras.getCharSequence(EXTRA_SUB_TEXT);
-            boolean showSummaryOnBottom = overflowText != null && !overflowText.equals(subText);
-            if (showSummaryOnBottom) {
-                contentView
-                        .setTextViewText(R.id.text, mBuilder.processLegacyText(overflowText));
-                contentView.setViewVisibility(R.id.overflow_divider, View.VISIBLE);
-                contentView.setViewVisibility(R.id.line3, View.VISIBLE);
-            } else {
-                // Clear text in case we use the line to show the profile badge.
-                contentView.setTextViewText(com.android.internal.R.id.text, "");
-                contentView.setViewVisibility(com.android.internal.R.id.overflow_divider, View.GONE);
-                contentView.setViewVisibility(com.android.internal.R.id.line3, View.GONE);
+            if (overflowText != null && !overflowText.equals(subText)) {
+                mBuilder.bindHeaderSubText(contentView, overflowText);
             }
 
+            // Clear text in case we use the line to show the profile badge.
+            contentView.setTextViewText(com.android.internal.R.id.text, "");
+            contentView.setViewVisibility(com.android.internal.R.id.line3, View.GONE);
+
             return contentView;
         }
 
@@ -4076,6 +4069,9 @@
             final float subTextSize = mBuilder.mContext.getResources().getDimensionPixelSize(
                     R.dimen.notification_subtext_size);
             int i=0;
+            final float density = mBuilder.mContext.getResources().getDisplayMetrics().density;
+            int topPadding = (int) (5 * density);
+            int bottomPadding = (int) (13 * density);
             while (i < mTexts.size() && i < rowIds.length) {
                 CharSequence str = mTexts.get(i);
                 if (str != null && !str.equals("")) {
@@ -4085,16 +4081,12 @@
                         contentView.setTextViewTextSize(rowIds[i], TypedValue.COMPLEX_UNIT_PX,
                                 subTextSize);
                     }
+                    contentView.setViewPadding(rowIds[i], 0, topPadding, 0,
+                            i == rowIds.length - 1 || i == mTexts.size() - 1 ? bottomPadding : 0);
                 }
                 i++;
             }
 
-            contentView.setViewVisibility(R.id.inbox_end_pad,
-                    mTexts.size() > 0 ? View.VISIBLE : View.GONE);
-
-            contentView.setViewVisibility(R.id.inbox_more,
-                    mTexts.size() > rowIds.length ? View.VISIBLE : View.GONE);
-
             mBuilder.shrinkLine3Text(contentView);
 
             mBuilder.addProfileBadge(contentView, R.id.profile_badge_large_template);
diff --git a/core/res/res/layout/notification_template_material_base.xml b/core/res/res/layout/notification_template_material_base.xml
index 9c54c67..eb660d0 100644
--- a/core/res/res/layout/notification_template_material_base.xml
+++ b/core/res/res/layout/notification_template_material_base.xml
@@ -30,7 +30,7 @@
         android:layout_marginStart="@dimen/notification_content_margin_start"
         android:layout_marginEnd="@dimen/notification_content_margin_end"
         android:layout_marginTop="@dimen/notification_content_margin_top"
-        android:minHeight="@dimen/notification_large_icon_height"
+        android:minHeight="@dimen/notification_min_content_height"
         android:orientation="vertical"
         >
         <include layout="@layout/notification_template_part_line1" />
diff --git a/core/res/res/layout/notification_template_material_big_media.xml b/core/res/res/layout/notification_template_material_big_media.xml
index e86c7aa..86877a0 100644
--- a/core/res/res/layout/notification_template_material_big_media.xml
+++ b/core/res/res/layout/notification_template_material_big_media.xml
@@ -35,7 +35,7 @@
         android:layout_marginStart="@dimen/notification_content_margin_start"
         android:layout_marginEnd="24dp"
         android:layout_toStartOf="@id/right_icon"
-        android:minHeight="54dp"
+        android:minHeight="@dimen/notification_min_content_height"
         android:orientation="vertical"
         >
         <include layout="@layout/notification_template_part_line1" />
diff --git a/core/res/res/layout/notification_template_material_big_picture.xml b/core/res/res/layout/notification_template_material_big_picture.xml
index 30749f0..246ba01 100644
--- a/core/res/res/layout/notification_template_material_big_picture.xml
+++ b/core/res/res/layout/notification_template_material_big_picture.xml
@@ -29,13 +29,6 @@
         android:layout_gravity="bottom"
         android:scaleType="centerCrop"
         />
-    <ImageView
-        android:layout_width="match_parent"
-        android:layout_height="6dp"
-        android:layout_marginTop="@dimen/notification_min_height"
-        android:scaleType="fitXY"
-        android:src="@drawable/title_bar_shadow"
-        />
     <include layout="@layout/notification_template_material_base"
         android:layout_width="match_parent"
         android:layout_height="@dimen/notification_min_height"
diff --git a/core/res/res/layout/notification_template_material_big_text.xml b/core/res/res/layout/notification_template_material_big_text.xml
index 0391063..9791302 100644
--- a/core/res/res/layout/notification_template_material_big_text.xml
+++ b/core/res/res/layout/notification_template_material_big_text.xml
@@ -30,7 +30,8 @@
         android:layout_marginStart="@dimen/notification_content_margin_start"
         android:layout_marginTop="@dimen/notification_content_margin_top"
         android:layout_marginEnd="@dimen/notification_content_margin_end"
-        android:minHeight="@dimen/notification_large_icon_height"
+        android:clipChildren="false"
+        android:minHeight="@dimen/notification_min_content_height"
         android:orientation="vertical"
         >
         <include layout="@layout/notification_template_part_line1" />
@@ -38,7 +39,7 @@
         <LinearLayout
             android:layout_width="match_parent"
             android:layout_height="0dp"
-            android:layout_marginBottom="10dp"
+            android:paddingBottom="13dp"
             android:orientation="horizontal"
             android:gravity="top"
             android:layout_weight="1"
@@ -64,27 +65,20 @@
         <ImageView
             android:layout_width="match_parent"
             android:layout_height="1dp"
+            android:layout_marginStart="-16dp"
+            android:layout_marginEnd="-16dp"
+            android:clipChildren="false"
             android:id="@+id/action_divider"
             android:visibility="gone"
             android:background="@drawable/notification_template_divider" />
         <include
             layout="@layout/notification_material_action_list"
-            android:layout_marginStart="-8dp"
+            android:layout_marginStart="-16dp"
+            android:layout_marginEnd="-16dp"
+            android:clipChildren="false"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             />
-        <ImageView
-            android:layout_width="match_parent"
-            android:layout_height="1dip"
-            android:id="@+id/overflow_divider"
-            android:visibility="visible"
-            android:background="@drawable/notification_template_divider" />
-        <include
-            layout="@layout/notification_template_part_line3"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:layout_marginTop="8dp"
-            android:layout_marginBottom="10dp" />
     </LinearLayout>
     <include layout="@layout/notification_template_right_icon" />
 </FrameLayout>
diff --git a/core/res/res/layout/notification_template_material_inbox.xml b/core/res/res/layout/notification_template_material_inbox.xml
index 4aa7e40..ac6dea8 100644
--- a/core/res/res/layout/notification_template_material_inbox.xml
+++ b/core/res/res/layout/notification_template_material_inbox.xml
@@ -30,7 +30,7 @@
         android:layout_marginStart="@dimen/notification_content_margin_start"
         android:layout_marginTop="@dimen/notification_content_margin_top"
         android:layout_marginEnd="@dimen/notification_content_margin_end"
-        android:minHeight="@dimen/notification_large_icon_height"
+        android:minHeight="@dimen/notification_min_content_height"
         android:orientation="vertical"
         >
         <include layout="@layout/notification_template_part_line1" />
@@ -117,20 +117,10 @@
             android:visibility="gone"
             android:layout_weight="1"
             />
-        <TextView android:id="@+id/inbox_more"
-            android:textAppearance="@style/TextAppearance.Material.Notification"
-            android:layout_width="match_parent"
-            android:layout_height="0dp"
-            android:singleLine="true"
-            android:ellipsize="end"
-            android:visibility="gone"
-            android:layout_weight="1"
-            android:text="@android:string/notification_inbox_ellipsis"
-            />
         <FrameLayout
             android:id="@+id/inbox_end_pad"
             android:layout_width="match_parent"
-            android:layout_height="10dp"
+            android:layout_height="13dp"
             android:visibility="gone"
             android:layout_weight="0"
         />
@@ -139,27 +129,19 @@
             android:layout_height="1dip"
             android:id="@+id/action_divider"
             android:visibility="gone"
+            android:layout_marginStart="-16dp"
+            android:layout_marginEnd="-16dp"
+            android:clipChildren="false"
             android:background="@drawable/notification_template_divider" />
         <include
             layout="@layout/notification_material_action_list"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:layout_marginLeft="-8dp"
-            android:layout_marginRight="-8dp"
+            android:layout_marginStart="-16dp"
+            android:layout_marginEnd="-16dp"
+            android:clipChildren="false"
             android:layout_weight="0"
             />
-        <ImageView
-            android:layout_width="match_parent"
-            android:layout_height="1dip"
-            android:id="@+id/overflow_divider"
-            android:visibility="visible"
-            android:background="@drawable/notification_template_divider" />
-        <include
-            layout="@layout/notification_template_part_line3"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:layout_marginTop="8dp"
-            android:layout_marginBottom="10dp" />
     </LinearLayout>
     <include layout="@layout/notification_template_right_icon" />
 </FrameLayout>
diff --git a/core/res/res/layout/notification_template_material_media.xml b/core/res/res/layout/notification_template_material_media.xml
index e45b779..1cd77c1 100644
--- a/core/res/res/layout/notification_template_material_media.xml
+++ b/core/res/res/layout/notification_template_material_media.xml
@@ -29,7 +29,7 @@
     <LinearLayout
         android:id="@+id/notification_main_column"
         android:layout_width="match_parent"
-        android:layout_height="54dp"
+        android:layout_height="@dimen/notification_min_content_height"
         android:background="#00000000"
         android:orientation="horizontal"
         android:layout_marginStart="@dimen/notification_content_margin_start"
@@ -42,7 +42,7 @@
             android:layout_height="wrap_content"
             android:layout_gravity="fill_vertical"
             android:layout_weight="1"
-            android:minHeight="54dp"
+            android:minHeight="@dimen/notification_min_content_height"
             android:orientation="vertical"
             >
             <include layout="@layout/notification_template_part_line1"/>
diff --git a/core/res/res/values/dimens.xml b/core/res/res/values/dimens.xml
index 61d285a..5eca22f 100644
--- a/core/res/res/values/dimens.xml
+++ b/core/res/res/values/dimens.xml
@@ -153,6 +153,9 @@
     <!-- The width of the big icons in notifications. -->
     <dimen name="notification_large_icon_height">64dp</dimen>
 
+    <!--  Min height of the notification content. -->
+    <dimen name="notification_min_content_height">54dp</dimen>
+
     <!-- The minimum with of the app name in the header if it shrinks -->
     <dimen name="notification_header_shrink_min_width">72dp</dimen>
 
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 763f61e..ebeb9ea 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -197,11 +197,8 @@
   <java-symbol type="id" name="inbox_text4" />
   <java-symbol type="id" name="inbox_text5" />
   <java-symbol type="id" name="inbox_text6" />
-  <java-symbol type="id" name="inbox_more" />
-  <java-symbol type="id" name="inbox_end_pad" />
   <java-symbol type="id" name="status_bar_latest_event_content" />
   <java-symbol type="id" name="action_divider" />
-  <java-symbol type="id" name="overflow_divider" />
   <java-symbol type="id" name="notification_main_column" />
   <java-symbol type="id" name="sms_short_code_confirm_message" />
   <java-symbol type="id" name="sms_short_code_detail_layout" />
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationTemplateViewWrapper.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationTemplateViewWrapper.java
index dff3500..20e089b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationTemplateViewWrapper.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationTemplateViewWrapper.java
@@ -67,7 +67,6 @@
     private TextView mSubText;
     private TextView mInfoText;
     private View mProfileBadge;
-    private View mThirdLineDivider;
     private View mThirdLine;
     private ImageView mExpandButton;
     private View mNotificationHeader;
@@ -94,7 +93,6 @@
         mSubText = (TextView) mView.findViewById(com.android.internal.R.id.text);
         mInfoText = (TextView) mView.findViewById(com.android.internal.R.id.info);
         mProfileBadge = mView.findViewById(com.android.internal.R.id.profile_badge_line3);
-        mThirdLineDivider = mView.findViewById(com.android.internal.R.id.overflow_divider);
         mThirdLine = mView.findViewById(com.android.internal.R.id.line3);
         mExpandButton = (ImageView) mView.findViewById(com.android.internal.R.id.expand_button);
         mColor = resolveColor(mExpandButton);
@@ -271,13 +269,6 @@
         }
         boolean showThirdLine = (visible && (infoAvailable || subTextAvailable))
                 || mProfileBadge.getVisibility() == View.VISIBLE;
-        if (mThirdLineDivider != null) {
-            if (showThirdLine) {
-                mThirdLineDivider.setVisibility(View.VISIBLE);
-            } else {
-                mThirdLineDivider.setVisibility(View.GONE);
-            }
-        }
         if (mThirdLine != null) {
             if (showThirdLine) {
                 mThirdLine.setVisibility(View.VISIBLE);