diff --git a/api/current.txt b/api/current.txt index 9f7d8d21cf759..8340eda94c3d0 100644 --- a/api/current.txt +++ b/api/current.txt @@ -3770,12 +3770,18 @@ package android.app { ctor public Notification.BigPictureStyle(); ctor public Notification.BigPictureStyle(android.app.Notification.Builder); method public android.app.Notification.BigPictureStyle bigPicture(android.graphics.Bitmap); + method public android.app.Notification build(); + method public android.app.Notification.BigPictureStyle setBigContentTitle(java.lang.CharSequence); + method public android.app.Notification.BigPictureStyle setSummaryText(java.lang.CharSequence); } public static class Notification.BigTextStyle extends android.app.Notification.Style { ctor public Notification.BigTextStyle(); ctor public Notification.BigTextStyle(android.app.Notification.Builder); method public android.app.Notification.BigTextStyle bigText(java.lang.CharSequence); + method public android.app.Notification build(); + method public android.app.Notification.BigTextStyle setBigContentTitle(java.lang.CharSequence); + method public android.app.Notification.BigTextStyle setSummaryText(java.lang.CharSequence); } public static class Notification.Builder { @@ -3817,11 +3823,18 @@ package android.app { ctor public Notification.InboxStyle(); ctor public Notification.InboxStyle(android.app.Notification.Builder); method public android.app.Notification.InboxStyle addLine(java.lang.CharSequence); + method public android.app.Notification build(); + method public android.app.Notification.InboxStyle setBigContentTitle(java.lang.CharSequence); + method public android.app.Notification.InboxStyle setSummaryText(java.lang.CharSequence); } - public static class Notification.Style { + public static abstract class Notification.Style { ctor public Notification.Style(); - method public android.app.Notification build(); + method public abstract android.app.Notification build(); + method protected void checkBuilder(); + method protected android.widget.RemoteViews getStandardView(int); + method protected void internalSetBigContentTitle(java.lang.CharSequence); + method protected void internalSetSummaryText(java.lang.CharSequence); method public void setBuilder(android.app.Notification.Builder); field protected android.app.Notification.Builder mBuilder; } diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java index 8f4efab5a099e..b60eed9379420 100644 --- a/core/java/android/app/Notification.java +++ b/core/java/android/app/Notification.java @@ -1397,7 +1397,8 @@ public class Notification implements Parcelable if (mSubText != null) { contentView.setTextViewText(R.id.text, mSubText); - contentView.setViewVisibility(R.id.text2, View.VISIBLE); + contentView.setViewVisibility(R.id.text2, + mContentText != null ? View.VISIBLE : View.GONE); } else { contentView.setViewVisibility(R.id.text2, View.GONE); if (mProgressMax != 0 || mProgressIndeterminate) { @@ -1428,12 +1429,12 @@ public class Notification implements Parcelable int N = mActions.size(); if (N > 0) { - Log.d("Notification", "has actions: " + mContentText); + // Log.d("Notification", "has actions: " + mContentText); big.setViewVisibility(R.id.actions, View.VISIBLE); if (N>3) N=3; for (int i=0; i * Notification noti = new Notification.InboxStyle( * new Notification.Builder() - * .setContentTitle("New mail from " + sender.toString()) + * .setContentTitle("5 New mails from " + sender.toString()) * .setContentText(subject) * .setSmallIcon(R.drawable.new_mail) * .setLargeIcon(aBitmap)) * .addLine(str1) * .addLine(str2) + * .setContentTitle("") + * .setSummaryText("+3 more") * .build(); * * @@ -1699,16 +1779,35 @@ public class Notification implements Parcelable setBuilder(builder); } + /** + * Overrides ContentTitle in the big form of the template. + * This defaults to the value passed to setContentTitle(). + */ + public InboxStyle setBigContentTitle(CharSequence title) { + internalSetBigContentTitle(title); + return this; + } + + /** + * Set the first line of text after the detail section in the big form of the template. + */ + public InboxStyle setSummaryText(CharSequence cs) { + internalSetSummaryText(cs); + return this; + } + public InboxStyle addLine(CharSequence cs) { mTexts.add(cs); return this; } private RemoteViews makeBigContentView() { - RemoteViews contentView = mBuilder.applyStandardTemplateWithActions(R.layout.notification_template_inbox); + RemoteViews contentView = getStandardView(R.layout.notification_template_inbox); + contentView.setViewVisibility(R.id.text2, View.GONE); + + int[] rowIds = {R.id.inbox_text0, R.id.inbox_text1, R.id.inbox_text2, R.id.inbox_text3, + R.id.inbox_text4}; - int[] rowIds = {R.id.inbox_text0, R.id.inbox_text1, R.id.inbox_text2, R.id.inbox_text3, R.id.inbox_text4}; - int i=0; while (i < mTexts.size() && i < rowIds.length) { CharSequence str = mTexts.get(i); @@ -1724,9 +1823,7 @@ public class Notification implements Parcelable @Override public Notification build() { - if (mBuilder == null) { - throw new IllegalArgumentException("Style requires a valid Builder object"); - } + checkBuilder(); Notification wip = mBuilder.buildUnstyled(); wip.bigContentView = makeBigContentView(); return wip; diff --git a/core/res/res/layout/notification_template_base.xml b/core/res/res/layout/notification_template_base.xml index ae2953797b190..63d20e473d6cd 100644 --- a/core/res/res/layout/notification_template_base.xml +++ b/core/res/res/layout/notification_template_base.xml @@ -85,6 +85,16 @@ android:ellipsize="marquee" android:visibility="gone" /> + - - - diff --git a/core/res/res/layout/notification_template_big_base.xml b/core/res/res/layout/notification_template_big_base.xml index 5de584df624db..097d15da9f1bd 100644 --- a/core/res/res/layout/notification_template_big_base.xml +++ b/core/res/res/layout/notification_template_big_base.xml @@ -137,12 +137,13 @@ style="?android:attr/progressBarStyleHorizontal" /> - + > + diff --git a/core/res/res/layout/notification_template_big_text.xml b/core/res/res/layout/notification_template_big_text.xml index ee6adc6bb6754..a225ab1dc2669 100644 --- a/core/res/res/layout/notification_template_big_text.xml +++ b/core/res/res/layout/notification_template_big_text.xml @@ -100,7 +100,7 @@ /> + + + + + - - - diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml index 2387e7aaaf244..38d27d0a205cc 100644 --- a/core/res/res/values/public.xml +++ b/core/res/res/values/public.xml @@ -99,6 +99,7 @@ + @@ -121,6 +122,7 @@ +