From 96fd7c1c1acc03b40b1813ef65793560c175ef80 Mon Sep 17 00:00:00 2001 From: Daniel Sandler Date: Fri, 30 Mar 2012 16:37:36 -0400 Subject: [PATCH] Show action buttons in expanded notifications. Any notification with at least one action will now have an expanded form by default. BigPicture/BigText can have actions, too, of course. Change-Id: I6f54cac65d9a9f335d8038c2105cd2c674f991ff --- core/java/android/app/Notification.java | 42 +++++- core/res/res/layout/notification_action.xml | 23 +++ .../res/layout/notification_template_base.xml | 137 ++++++++++++++++++ .../notification_template_big_picture.xml | 20 ++- .../status_bar_latest_event_content.xml | 32 ++-- ...us_bar_latest_event_content_large_icon.xml | 100 ------------- core/res/res/values/public.xml | 3 +- .../systemui/statusbar/BaseStatusBar.java | 22 +++ .../statusbar/phone/PhoneStatusBar.java | 18 --- .../statusbar/tablet/TabletStatusBar.java | 18 --- 10 files changed, 262 insertions(+), 153 deletions(-) create mode 100644 core/res/res/layout/notification_action.xml create mode 100644 core/res/res/layout/notification_template_base.xml delete mode 100644 core/res/res/layout/status_bar_latest_event_content_large_icon.xml diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java index 1356801db229c..096af93086b3a 100644 --- a/core/java/android/app/Notification.java +++ b/core/java/android/app/Notification.java @@ -28,6 +28,7 @@ import android.os.Parcel; import android.os.Parcelable; import android.text.TextUtils; import android.util.IntProperty; +import android.util.Log; import android.view.View; import android.widget.ProgressBar; import android.widget.RemoteViews; @@ -808,7 +809,7 @@ public class Notification implements Parcelable public void setLatestEventInfo(Context context, CharSequence contentTitle, CharSequence contentText, PendingIntent contentIntent) { RemoteViews contentView = new RemoteViews(context.getPackageName(), - R.layout.status_bar_latest_event_content); + R.layout.notification_template_base); if (this.icon != 0) { contentView.setImageViewResource(R.id.icon, this.icon); } @@ -1439,11 +1440,28 @@ public class Notification implements Parcelable return contentView; } + private RemoteViews applyStandardTemplateWithActions(int layoutId) { + RemoteViews big = applyStandardTemplate(layoutId); + + int N = mActions.size(); + if (N > 0) { + Log.d("Notification", "has actions: " + mContentText); + big.setViewVisibility(R.id.actions, View.VISIBLE); + if (N>3) N=3; + for (int i=0; i + + +