From 842dd77bb9c002af5364237f46b63c826f1c4082 Mon Sep 17 00:00:00 2001 From: Dan Sandler Date: Thu, 15 May 2014 09:36:47 -0400 Subject: Introducing Notification.MediaStyle. Allows you to create a nice music player with all the trimmings, including: * up to 5 actions in the bigContentView, styled as transport control buttons * up to 2 of those actions in the 1U (!) * a nice custom progress bar * a tinted background (taken from your Notification.color) * a special place to put your MediaSessionToken Bug: 15147533 Change-Id: Ic20a2b369eb6c5fe4853987a44ffd9bace720c7f --- .../com/android/systemui/statusbar/BaseStatusBar.java | 16 ++++++++++++++++ .../com/android/systemui/statusbar/NotificationData.java | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) (limited to 'packages/SystemUI/src/com/android') diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java index e699dd9..457d32e 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java @@ -446,9 +446,25 @@ public abstract class BaseStatusBar extends SystemUI implements com.android.internal.R.drawable.notification_bg, com.android.internal.R.drawable.notification_bg_dim); } + } else { + // Using platform templates + final int color = sbn.getNotification().color; + if (isMediaNotification(entry)) { + entry.row.setBackgroundResourceIds( + com.android.internal.R.drawable.notification_quantum_bg, + color, + com.android.internal.R.drawable.notification_quantum_bg_dim, + color); + } } } + private boolean isMediaNotification(NotificationData.Entry entry) { + // TODO: confirm that there's a valid media key + return entry.expandedBig != null && + entry.expandedBig.findViewById(com.android.internal.R.id.media_action_area) != null; + } + private void startApplicationDetailsActivity(String packageName) { Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS, Uri.fromParts("package", packageName, null)); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java index 6b6f55a..b1a5750 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java @@ -36,7 +36,7 @@ public class NotificationData { public View expanded; // the inflated RemoteViews public View expandedPublic; // for insecure lockscreens public ImageView largeIcon; - private View expandedBig; + public View expandedBig; private boolean interruption; public Entry() {} public Entry(IBinder key, StatusBarNotification n, StatusBarIconView ic) { -- cgit v1.1