summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Daniel Sandler <dsandler@google.com> 2010-08-04 15:54:58 -0400
committer Daniel Sandler <dsandler@google.com> 2010-08-05 09:34:50 -0400
commit0f0b11c8719495ce559b93366fe9cd79782d791c (patch)
tree0fa5ab0ceee9591d2dd41d84684db045a4216d1a
parent4e68d506b0d9c7f01bb927ad7be1995392d7d366 (diff)
Basic support for notification payloads in the panel.
Line-item veto is there, but allows you to cancel some notifications you probably shouldn't be canceling. (Should hide the "X" in those cases.) No preference given to "sticky" notifications, because there's no such thing yet. Notifications are now limited to 4 visible icons, per spec. The implementation is a total hack for now. Change-Id: Ibdf433ae94189117f983c510fe5e0cff0bf5c44c
-rw-r--r--core/java/com/android/internal/statusbar/IStatusBarService.aidl1
-rw-r--r--core/res/res/drawable-hdpi/status_bar_item_background_normal.9.pngbin197 -> 2867 bytes
-rw-r--r--core/res/res/drawable-mdpi/status_bar_item_background_normal.9.pngbin186 -> 2835 bytes
-rw-r--r--core/res/res/layout-xlarge/status_bar_latest_event_content.xml56
-rw-r--r--core/res/res/values-xlarge/styles.xml40
-rw-r--r--packages/SystemUI/res/drawable-hdpi/status_bar_veto_normal.pngbin0 -> 1221 bytes
-rw-r--r--packages/SystemUI/res/drawable-hdpi/status_bar_veto_pressed.pngbin0 -> 1874 bytes
-rw-r--r--packages/SystemUI/res/drawable-mdpi/status_bar_veto_normal.pngbin0 -> 699 bytes
-rw-r--r--packages/SystemUI/res/drawable-mdpi/status_bar_veto_pressed.pngbin0 -> 1192 bytes
-rw-r--r--packages/SystemUI/res/drawable/status_bar_veto.xml21
-rw-r--r--packages/SystemUI/res/layout-xlarge/status_bar_latest_event.xml36
-rw-r--r--packages/SystemUI/res/layout-xlarge/sysbar_panel_notifications.xml39
-rw-r--r--packages/SystemUI/res/layout/status_bar_latest_event.xml24
-rw-r--r--packages/SystemUI/res/values-xlarge/strings.xml23
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java4
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBarService.java101
-rwxr-xr-xservices/java/com/android/server/NotificationManagerService.java5
-rw-r--r--services/java/com/android/server/StatusBarManagerService.java7
18 files changed, 291 insertions, 66 deletions
diff --git a/core/java/com/android/internal/statusbar/IStatusBarService.aidl b/core/java/com/android/internal/statusbar/IStatusBarService.aidl
index 852630dfa443..23076696b4df 100644
--- a/core/java/com/android/internal/statusbar/IStatusBarService.aidl
+++ b/core/java/com/android/internal/statusbar/IStatusBarService.aidl
@@ -40,4 +40,5 @@ interface IStatusBarService
void onNotificationError(String pkg, String tag, int id,
int uid, int initialPid, String message);
void onClearAllNotifications();
+ void onNotificationClear(String pkg, String tag, int id);
}
diff --git a/core/res/res/drawable-hdpi/status_bar_item_background_normal.9.png b/core/res/res/drawable-hdpi/status_bar_item_background_normal.9.png
index c01c018683f2..810c950ae43f 100644
--- a/core/res/res/drawable-hdpi/status_bar_item_background_normal.9.png
+++ b/core/res/res/drawable-hdpi/status_bar_item_background_normal.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/status_bar_item_background_normal.9.png b/core/res/res/drawable-mdpi/status_bar_item_background_normal.9.png
index b8e399d9d514..f0e4d068cbfe 100644
--- a/core/res/res/drawable-mdpi/status_bar_item_background_normal.9.png
+++ b/core/res/res/drawable-mdpi/status_bar_item_background_normal.9.png
Binary files differ
diff --git a/core/res/res/layout-xlarge/status_bar_latest_event_content.xml b/core/res/res/layout-xlarge/status_bar_latest_event_content.xml
new file mode 100644
index 000000000000..c64b90ea1daa
--- /dev/null
+++ b/core/res/res/layout-xlarge/status_bar_latest_event_content.xml
@@ -0,0 +1,56 @@
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ android:paddingTop="7dp"
+ android:paddingLeft="5dp"
+ >
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ android:paddingTop="3dp"
+ >
+ <!--com.android.server.status.AnimatedImageView android:id="@+id/icon" -->
+ <ImageView android:id="@+id/icon"
+ android:layout_width="25dp"
+ android:layout_height="25dp"
+ android:scaleType="fitCenter"
+ android:src="@drawable/arrow_down_float"/>
+ <TextView android:id="@+id/title"
+ android:textAppearance="@style/TextAppearance.StatusBar.EventContent.Title"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:singleLine="true"
+ android:ellipsize="marquee"
+ android:fadingEdge="horizontal"
+ android:paddingLeft="4dp"
+ />
+ </LinearLayout>
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ >
+ <TextView android:id="@+id/text"
+ android:textAppearance="@style/TextAppearance.StatusBar.EventContent"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:singleLine="true"
+ android:ellipsize="marquee"
+ android:fadingEdge="horizontal"
+ android:paddingLeft="4dp"
+ />
+ <android.widget.DateTimeView android:id="@+id/time"
+ android:textAppearance="@style/TextAppearance.StatusBar.EventContent"
+ android:layout_marginLeft="4dp"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:singleLine="true"
+ android:paddingRight="5dp"
+ />
+ </LinearLayout>
+</LinearLayout>
diff --git a/core/res/res/values-xlarge/styles.xml b/core/res/res/values-xlarge/styles.xml
new file mode 100644
index 000000000000..40e423e23be1
--- /dev/null
+++ b/core/res/res/values-xlarge/styles.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<resources>
+ <!-- Status Bar Styles -->
+
+ <style name="TextAppearance.StatusBar">
+ <item name="android:textAppearance">?android:attr/textAppearanceSmall</item>
+ <item name="android:textColor">?android:attr/textColorPrimaryInverse</item>
+ </style>
+ <style name="TextAppearance.StatusBar.Ticker">
+ </style>
+ <style name="TextAppearance.StatusBar.Title">
+ <item name="android:textStyle">bold</item>
+ </style>
+
+ <style name="TextAppearance.StatusBar.Icon">
+ <item name="android:textStyle">bold</item>
+ </style>
+ <style name="TextAppearance.StatusBar.EventContent">
+ <item name="android:textColor">?android:attr/textColorPrimary</item>
+ </style>
+ <style name="TextAppearance.StatusBar.EventContent.Title">
+ <item name="android:textSize">18sp</item>
+ <item name="android:textStyle">bold</item>
+ </style>
+</resources>
diff --git a/packages/SystemUI/res/drawable-hdpi/status_bar_veto_normal.png b/packages/SystemUI/res/drawable-hdpi/status_bar_veto_normal.png
new file mode 100644
index 000000000000..df532b844ea9
--- /dev/null
+++ b/packages/SystemUI/res/drawable-hdpi/status_bar_veto_normal.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-hdpi/status_bar_veto_pressed.png b/packages/SystemUI/res/drawable-hdpi/status_bar_veto_pressed.png
new file mode 100644
index 000000000000..118c01bb12af
--- /dev/null
+++ b/packages/SystemUI/res/drawable-hdpi/status_bar_veto_pressed.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/status_bar_veto_normal.png b/packages/SystemUI/res/drawable-mdpi/status_bar_veto_normal.png
new file mode 100644
index 000000000000..f9a7cc2d1a81
--- /dev/null
+++ b/packages/SystemUI/res/drawable-mdpi/status_bar_veto_normal.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/status_bar_veto_pressed.png b/packages/SystemUI/res/drawable-mdpi/status_bar_veto_pressed.png
new file mode 100644
index 000000000000..4461ac8ac928
--- /dev/null
+++ b/packages/SystemUI/res/drawable-mdpi/status_bar_veto_pressed.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable/status_bar_veto.xml b/packages/SystemUI/res/drawable/status_bar_veto.xml
new file mode 100644
index 000000000000..6e1b68155b49
--- /dev/null
+++ b/packages/SystemUI/res/drawable/status_bar_veto.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:state_pressed="true" android:drawable="@drawable/status_bar_veto_pressed" />
+ <item android:drawable="@drawable/status_bar_veto_normal" />
+</selector>
+
diff --git a/packages/SystemUI/res/layout-xlarge/status_bar_latest_event.xml b/packages/SystemUI/res/layout-xlarge/status_bar_latest_event.xml
new file mode 100644
index 000000000000..fa492d078834
--- /dev/null
+++ b/packages/SystemUI/res/layout-xlarge/status_bar_latest_event.xml
@@ -0,0 +1,36 @@
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="65sp"
+ android:orientation="vertical"
+ android:background="@android:drawable/status_bar_item_background"
+ >
+
+ <ImageButton
+ android:id="@+id/veto"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_centerVertical="true"
+ android:layout_alignParentRight="true"
+ android:src="@drawable/status_bar_veto"
+ android:background="@null"
+ android:padding="2dip"
+ />
+
+ <com.android.systemui.statusbar.LatestItemView android:id="@+id/content"
+ android:layout_alignParentTop="true"
+ android:layout_toLeftOf="@id/veto"
+ android:layout_width="match_parent"
+ android:layout_height="64sp"
+ android:focusable="true"
+ android:clickable="true"
+ android:paddingRight="6sp"
+ />
+
+ <View
+ android:layout_width="match_parent"
+ android:layout_height="1sp"
+ android:layout_alignParentBottom="true"
+ android:background="@android:drawable/divider_horizontal_dark"
+ />
+
+</RelativeLayout>
diff --git a/packages/SystemUI/res/layout-xlarge/sysbar_panel_notifications.xml b/packages/SystemUI/res/layout-xlarge/sysbar_panel_notifications.xml
index 4a34f037e1d2..84a718a70448 100644
--- a/packages/SystemUI/res/layout-xlarge/sysbar_panel_notifications.xml
+++ b/packages/SystemUI/res/layout-xlarge/sysbar_panel_notifications.xml
@@ -19,14 +19,33 @@
-->
<!-- android:background="@drawable/status_bar_closed_default_background" -->
-<FrameLayout
+<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="wrap_content"
android:layout_width="match_parent"
- android:paddingLeft="8dip"
- android:paddingRight="8dip"
+ android:background="#FF000000"
+ android:orientation="vertical"
>
-
+
+ <TextView android:id="@+id/clear_all_button"
+ style="?android:attr/textAppearance"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="right|center_vertical"
+ android:layout_marginTop="2dip"
+ android:layout_marginBottom="1dip"
+ android:layout_marginRight="10dip"
+ android:padding="6dip"
+ android:textSize="14sp"
+ android:text="@string/status_bar_clear_all_button"
+ />
+
+ <View
+ android:layout_width="match_parent"
+ android:layout_height="1sp"
+ android:background="@android:drawable/divider_horizontal_dark"
+ />
+
<LinearLayout
android:id="@+id/content"
android:layout_width="match_parent"
@@ -39,15 +58,5 @@
android:focusable="true"
android:descendantFocusability="afterDescendants"
>
- <TextView
- android:id="@+id/notificationPanelDummy"
- android:layout_width="wrap_content"
- android:layout_height="75dip"
- android:layout_centerInParent="true"
- android:gravity="center"
- android:textColor="#FFCCCCCC"
- android:textSize="18sp"
- android:padding="4dip"
- />
</LinearLayout>
-</FrameLayout>
+</LinearLayout>
diff --git a/packages/SystemUI/res/layout/status_bar_latest_event.xml b/packages/SystemUI/res/layout/status_bar_latest_event.xml
deleted file mode 100644
index 88d973985d71..000000000000
--- a/packages/SystemUI/res/layout/status_bar_latest_event.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="65sp"
- android:orientation="vertical"
- >
-
- <com.android.systemui.statusbar.LatestItemView android:id="@+id/content"
- android:layout_width="match_parent"
- android:layout_height="64sp"
- android:background="@android:drawable/status_bar_item_background"
- android:focusable="true"
- android:clickable="true"
- android:paddingRight="6sp"
- >
- </com.android.systemui.statusbar.LatestItemView>
-
- <View
- android:layout_width="match_parent"
- android:layout_height="1sp"
- android:background="@android:drawable/divider_horizontal_bright"
- />
-
-</LinearLayout>
-
diff --git a/packages/SystemUI/res/values-xlarge/strings.xml b/packages/SystemUI/res/values-xlarge/strings.xml
new file mode 100644
index 000000000000..4aa4b4731939
--- /dev/null
+++ b/packages/SystemUI/res/values-xlarge/strings.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/**
+ * Copyright (c) 2010, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <!-- The text for the button in the notification window-shade that clears
+ all of the currently visible notifications. -->
+ <string name="status_bar_clear_all_button">Clear all</string>
+</resources>
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java
index 6bb5e8f2625a..45abe930a380 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java
@@ -54,6 +54,10 @@ public class NotificationData {
return mEntries.size();
}
+ public Entry get(int i) {
+ return mEntries.get(i);
+ }
+
public Entry findByKey(IBinder key) {
for (Entry e : mEntries) {
if (e.key == key) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBarService.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBarService.java
index 9d643d850f19..b1c4ee3d9c53 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBarService.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBarService.java
@@ -37,6 +37,7 @@ import android.view.WindowManager;
import android.graphics.Rect;
import android.os.RemoteException;
import android.view.WindowManagerImpl;
+import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
@@ -59,18 +60,19 @@ public class TabletStatusBarService extends StatusBarService {
H mHandler = new H();
- private View mNotificationPanel;
- private View mSystemPanel;
+ View mNotificationPanel;
+ View mSystemPanel;
- private NotificationIconArea.IconLayout mIconLayout;
+ ViewGroup mPile;
+ TextView mClearButton;
- private NotificationData mHaps = new NotificationData();
+ NotificationIconArea.IconLayout mIconLayout;
+
+ private NotificationData mNotns = new NotificationData();
protected void addPanelWindows() {
- if (mNotificationPanel == null) {
- mNotificationPanel = View.inflate(this, R.layout.sysbar_panel_notifications, null);
- mSystemPanel = View.inflate(this, R.layout.sysbar_panel_system, null);
- }
+ mNotificationPanel = View.inflate(this, R.layout.sysbar_panel_notifications, null);
+ mSystemPanel = View.inflate(this, R.layout.sysbar_panel_system, null);
mNotificationPanel.setVisibility(View.GONE);
mSystemPanel.setVisibility(View.GONE);
@@ -80,7 +82,7 @@ public class TabletStatusBarService extends StatusBarService {
com.android.internal.R.dimen.status_bar_height);
WindowManager.LayoutParams lp = new WindowManager.LayoutParams(
- 300, // ViewGroup.LayoutParams.WRAP_CONTENT,
+ 400, // ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.TYPE_STATUS_BAR_PANEL,
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
@@ -112,10 +114,14 @@ public class TabletStatusBarService extends StatusBarService {
WindowManagerImpl.getDefault().addView(mSystemPanel, lp);
// Lorem ipsum, Dolores
- TextView tv = ((TextView) mNotificationPanel.findViewById(R.id.notificationPanelDummy));
- if (tv != null) tv.setText("(You probably have new email)");
- tv = ((TextView) mSystemPanel.findViewById(R.id.systemPanelDummy));
+ TextView tv = ((TextView) mSystemPanel.findViewById(R.id.systemPanelDummy));
if (tv != null) tv.setText("System status: great");
+
+ mPile = (ViewGroup)mNotificationPanel.findViewById(R.id.content);
+ mPile.removeAllViews();
+
+ mClearButton = (TextView)mNotificationPanel.findViewById(R.id.clear_all_button);
+ mClearButton.setOnClickListener(mClearButtonListener);
}
@Override
@@ -196,7 +202,7 @@ public class TabletStatusBarService extends StatusBarService {
public void updateNotification(IBinder key, StatusBarNotification notification) {
if (DEBUG) Slog.d(TAG, "updateNotification(" + key + " -> " + notification + ") // TODO");
- final NotificationData.Entry oldEntry = mHaps.findByKey(key);
+ final NotificationData.Entry oldEntry = mNotns.findByKey(key);
if (oldEntry == null) {
Slog.w(TAG, "updateNotification for unknown key: " + key);
return;
@@ -285,6 +291,9 @@ public class TabletStatusBarService extends StatusBarService {
public void notificationIconsClicked(View v) {
if (DEBUG) Slog.d(TAG, "clicked notification icons");
+ mHandler.removeMessages(H.MSG_CLOSE_SYSTEM_PANEL);
+ mHandler.sendEmptyMessage(H.MSG_CLOSE_SYSTEM_PANEL);
+
int msg = (mNotificationPanel.getVisibility() == View.GONE)
? H.MSG_OPEN_NOTIFICATION_PANEL
: H.MSG_CLOSE_NOTIFICATION_PANEL;
@@ -294,6 +303,9 @@ public class TabletStatusBarService extends StatusBarService {
public void systemInfoClicked(View v) {
if (DEBUG) Slog.d(TAG, "clicked system info");
+ mHandler.removeMessages(H.MSG_CLOSE_NOTIFICATION_PANEL);
+ mHandler.sendEmptyMessage(H.MSG_CLOSE_NOTIFICATION_PANEL);
+
int msg = (mSystemPanel.getVisibility() == View.GONE)
? H.MSG_OPEN_SYSTEM_PANEL
: H.MSG_CLOSE_SYSTEM_PANEL;
@@ -313,6 +325,17 @@ public class TabletStatusBarService extends StatusBarService {
}
}
+ private View.OnClickListener mClearButtonListener = new View.OnClickListener() {
+ public void onClick(View v) {
+ try {
+ mBarService.onClearAllNotifications();
+ } catch (RemoteException ex) {
+ // system process is dead if we're here.
+ }
+ animateCollapse();
+ }
+ };
+
private class NotificationClicker implements View.OnClickListener {
private PendingIntent mIntent;
private String mPkg;
@@ -365,7 +388,7 @@ public class TabletStatusBarService extends StatusBarService {
}
StatusBarNotification removeNotificationViews(IBinder key) {
- NotificationData.Entry entry = mHaps.remove(key);
+ NotificationData.Entry entry = mNotns.remove(key);
if (entry == null) {
Slog.w(TAG, "removeNotification for unknown key: " + key);
return null;
@@ -374,21 +397,16 @@ public class TabletStatusBarService extends StatusBarService {
ViewGroup rowParent = (ViewGroup)entry.row.getParent();
if (rowParent != null) rowParent.removeView(entry.row);
// Remove the icon.
- ViewGroup iconParent = (ViewGroup)entry.icon.getParent();
- if (iconParent != null) iconParent.removeView(entry.icon);
+// ViewGroup iconParent = (ViewGroup)entry.icon.getParent();
+// if (iconParent != null) iconParent.removeView(entry.icon);
+ refreshIcons();
return entry.notification;
}
StatusBarIconView addNotificationViews(IBinder key, StatusBarNotification notification) {
- NotificationData list = mHaps;
- ViewGroup parent = null;
- final boolean isOngoing = notification.isOngoing();
- if (isOngoing) {
-// parent = mOngoingItems;
- } else {
-// parent = mIconLayout;
- }
+ NotificationData list = mNotns;
+ ViewGroup parent = mPile;
// Construct the icon.
final StatusBarIconView iconView = new StatusBarIconView(this,
notification.pkg + "/0x" + Integer.toHexString(notification.id));
@@ -413,12 +431,27 @@ public class TabletStatusBarService extends StatusBarService {
final int viewIndex = list.add(entry);
if (parent != null) parent.addView(entry.row, viewIndex);
// Add the icon.
- final int iconIndex = 0; // XXX: sort into ongoing and regular buckets
- mIconLayout.addView(iconView, iconIndex,
- new LinearLayout.LayoutParams(mIconSize, mIconSize));
+// final int iconIndex = 0; // XXX: sort into ongoing and regular buckets
+// mIconLayout.addView(iconView, iconIndex,
+// new LinearLayout.LayoutParams(mIconSize, mIconSize));
+
+ refreshIcons();
+
return iconView;
}
+ private void refreshIcons() {
+ // XXX: need to implement a new limited linear layout class
+ // to avoid removing & readding everything
+ mIconLayout.removeAllViews();
+ int N = mNotns.size();
+ LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(mIconSize, mIconSize);
+ for (int i=0; i<4; i++) {
+ if (i>=N) break;
+ mIconLayout.addView(mNotns.get(N-i-1).icon, i, params);
+ }
+ }
+
private boolean inflateViews(NotificationData.Entry entry, ViewGroup parent) {
StatusBarNotification sbn = entry.notification;
RemoteViews remoteViews = sbn.notification.contentView;
@@ -429,6 +462,20 @@ public class TabletStatusBarService extends StatusBarService {
// create the row view
LayoutInflater inflater = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View row = inflater.inflate(R.layout.status_bar_latest_event, parent, false);
+ View vetoButton = row.findViewById(R.id.veto);
+ final String _pkg = sbn.pkg;
+ final String _tag = sbn.tag;
+ final int _id = sbn.id;
+ vetoButton.setOnClickListener(new View.OnClickListener() {
+ public void onClick(View v) {
+ try {
+ mBarService.onNotificationClear(_pkg, _tag, _id);
+ } catch (RemoteException ex) {
+ // system process is dead if we're here.
+ }
+// animateCollapse();
+ }
+ });
// bind the click event to the content area
ViewGroup content = (ViewGroup)row.findViewById(R.id.content);
diff --git a/services/java/com/android/server/NotificationManagerService.java b/services/java/com/android/server/NotificationManagerService.java
index 25de8b0c49b8..4f11231d4978 100755
--- a/services/java/com/android/server/NotificationManagerService.java
+++ b/services/java/com/android/server/NotificationManagerService.java
@@ -61,6 +61,7 @@ import android.util.Log;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityManager;
import android.widget.Toast;
+import android.widget.Toast;
import java.io.FileDescriptor;
import java.io.PrintWriter;
@@ -280,6 +281,10 @@ class NotificationManagerService extends INotificationManager.Stub
Notification.FLAG_FOREGROUND_SERVICE);
}
+ public void onNotificationClear(String pkg, String tag, int id) {
+ cancelNotification(pkg, tag, id, 0, 0); // maybe add some flags?
+ }
+
public void onPanelRevealed() {
synchronized (mNotificationList) {
// sound
diff --git a/services/java/com/android/server/StatusBarManagerService.java b/services/java/com/android/server/StatusBarManagerService.java
index 4177432c9d37..717c3098398b 100644
--- a/services/java/com/android/server/StatusBarManagerService.java
+++ b/services/java/com/android/server/StatusBarManagerService.java
@@ -84,6 +84,7 @@ public class StatusBarManagerService extends IStatusBarService.Stub
void onSetDisabled(int status);
void onClearAll();
void onNotificationClick(String pkg, String tag, int id);
+ void onNotificationClear(String pkg, String tag, int id);
void onPanelRevealed();
void onNotificationError(String pkg, String tag, int id,
int uid, int initialPid, String message);
@@ -302,6 +303,12 @@ public class StatusBarManagerService extends IStatusBarService.Stub
mNotificationCallbacks.onNotificationError(pkg, tag, id, uid, initialPid, message);
}
+ public void onNotificationClear(String pkg, String tag, int id) {
+ enforceStatusBarService();
+
+ mNotificationCallbacks.onNotificationClear(pkg, tag, id);
+ }
+
public void onClearAllNotifications() {
enforceStatusBarService();