From a8e5b060a6ec5a5807f2858eccec835c7b083067 Mon Sep 17 00:00:00 2001 From: Daniel Sandler Date: Wed, 1 Dec 2010 13:53:08 -0500 Subject: When peeking at a notification, the X will close the window. Bug: 3241204 Change-Id: Ibc6751062170e85604179da3f01a9c1055a15b1f --- .../systemui/statusbar/tablet/TabletStatusBar.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'packages') diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java index 31311a4..3519e8c 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java @@ -114,6 +114,7 @@ public class TabletStatusBar extends StatusBar { NotificationPeekPanel mNotificationPeekWindow; ViewGroup mNotificationPeekRow; int mNotificationPeekIndex; + IBinder mNotificationPeekKey; LayoutTransition mNotificationPeekScrubLeft, mNotificationPeekScrubRight; int mNotificationPeekTapDuration; @@ -344,9 +345,11 @@ public class TabletStatusBar extends StatusBar { if (DEBUG) Slog.d(TAG, "opening notification peek window; arg=" + m.arg1); if (m.arg1 >= 0) { final int N = mNotns.size(); - if (mNotificationPeekIndex < N) { + if (mNotificationPeekIndex >= 0 && mNotificationPeekIndex < N) { NotificationData.Entry entry = mNotns.get(N-1-mNotificationPeekIndex); entry.icon.setBackgroundColor(0); + mNotificationPeekIndex = -1; + mNotificationPeekKey = null; } final int peekIndex = m.arg1; @@ -373,6 +376,7 @@ public class TabletStatusBar extends StatusBar { mNotificationPanel.setVisibility(View.GONE); mNotificationPeekIndex = peekIndex; + mNotificationPeekKey = entry.key; } } break; @@ -381,10 +385,13 @@ public class TabletStatusBar extends StatusBar { mNotificationPeekWindow.setVisibility(View.GONE); mNotificationPeekRow.removeAllViews(); final int N = mNotns.size(); - if (mNotificationPeekIndex < N) { + if (mNotificationPeekIndex >= 0 && mNotificationPeekIndex < N) { NotificationData.Entry entry = mNotns.get(N-1-mNotificationPeekIndex); entry.icon.setBackgroundColor(0); } + + mNotificationPeekIndex = -1; + mNotificationPeekKey = null; break; case MSG_OPEN_NOTIFICATION_PANEL: if (DEBUG) Slog.d(TAG, "opening notifications panel"); @@ -814,6 +821,11 @@ public class TabletStatusBar extends StatusBar { // Remove the expanded view. ViewGroup rowParent = (ViewGroup)entry.row.getParent(); if (rowParent != null) rowParent.removeView(entry.row); + + if (key == mNotificationPeekKey) { + // must close the peek as well, since it's gone + mHandler.sendEmptyMessage(MSG_CLOSE_NOTIFICATION_PEEK); + } // Remove the icon. // ViewGroup iconParent = (ViewGroup)entry.icon.getParent(); // if (iconParent != null) iconParent.removeView(entry.icon); -- cgit v1.1