From 8680bf865a08f876fc3986c50a193e3186ff6f02 Mon Sep 17 00:00:00 2001 From: Daniel Sandler Date: Tue, 15 May 2012 16:52:52 -0400 Subject: [PATCH 1/2] Action button improvements: - Horizontal layout - At most 2 are shown - Tombstones are now shown (if the intent is null, the button is disabled; use it for quick feedback of an action's effect) Bug: 6418617 (tombstones) Bug: 6482237 (action separators) Change-Id: Ie0c613006227bbfe1c0ec6eab1cda4f3782a05f2 --- core/java/android/app/Notification.java | 20 +++++----- core/res/res/layout/notification_action.xml | 3 +- .../res/layout/notification_action_list.xml | 28 ++++++++++++++ .../layout/notification_action_tombstone.xml | 8 +++- .../layout/notification_template_big_base.xml | 9 ++--- .../layout/notification_template_big_text.xml | 9 ++--- .../layout/notification_template_inbox.xml | 9 ++--- .../systemui/statusbar/BaseStatusBar.java | 37 +++++++++---------- 8 files changed, 71 insertions(+), 52 deletions(-) create mode 100644 core/res/res/layout/notification_action_list.xml diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java index 0c470692bf6f4..6d3aa981b5d3a 100644 --- a/core/java/android/app/Notification.java +++ b/core/java/android/app/Notification.java @@ -907,6 +907,8 @@ public class Notification implements Parcelable * */ public static class Builder { + private static final int MAX_ACTION_BUTTONS = 2; + private Context mContext; private long mWhen; @@ -938,7 +940,7 @@ public class Notification implements Parcelable private ArrayList mKindList = new ArrayList(1); private Bundle mExtras; private int mPriority; - private ArrayList mActions = new ArrayList(3); + private ArrayList mActions = new ArrayList(MAX_ACTION_BUTTONS); private boolean mUseChronometer; private Style mStyle; @@ -1460,7 +1462,7 @@ public class Notification implements Parcelable if (N > 0) { // Log.d("Notification", "has actions: " + mContentText); big.setViewVisibility(R.id.actions, View.VISIBLE); - if (N>3) N=3; + if (N>MAX_ACTION_BUTTONS) N=MAX_ACTION_BUTTONS; big.removeAllViews(R.id.actions); for (int i=0; i + + + + + diff --git a/core/res/res/layout/notification_action_tombstone.xml b/core/res/res/layout/notification_action_tombstone.xml index e61e15f142828..6c59ded86d52f 100644 --- a/core/res/res/layout/notification_action_tombstone.xml +++ b/core/res/res/layout/notification_action_tombstone.xml @@ -15,12 +15,16 @@ -->