diff --git a/packages/SystemUI/res/layout-xlarge/status_bar_notification_panel_title.xml b/packages/SystemUI/res/layout-xlarge/status_bar_notification_panel_title.xml index 1afb2e3f1254b..543f4eda576a1 100644 --- a/packages/SystemUI/res/layout-xlarge/status_bar_notification_panel_title.xml +++ b/packages/SystemUI/res/layout-xlarge/status_bar_notification_panel_title.xml @@ -22,7 +22,6 @@ android:layout_height="0dp" android:orientation="vertical" android:background="@drawable/notify_panel_clock_bg" - android:clickable="true" > = l && x < r && y >= t && y < b; } + public void setBar(TabletStatusBar bar) { + mBar = bar; + } + + // We don't really want to intercept the touch event, but we *do* want to reset the fade timer + // in case the user is interacting with some custom controls or something. + @Override + public boolean onInterceptTouchEvent(MotionEvent ev) { + mBar.resetNotificationPeekFadeTimer(); + return false; + } } 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 45571055f8152..58c4d5a92bdc4 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java @@ -217,6 +217,8 @@ public class TabletStatusBar extends StatusBar implements // Notification preview window mNotificationPeekWindow = (NotificationPeekPanel) View.inflate(context, R.layout.status_bar_notification_peek, null); + mNotificationPeekWindow.setBar(this); + mNotificationPeekRow = (ViewGroup) mNotificationPeekWindow.findViewById(R.id.content); mNotificationPeekWindow.setVisibility(View.GONE); mNotificationPeekWindow.setOnTouchListener( @@ -1211,10 +1213,20 @@ public class TabletStatusBar extends StatusBar implements } } - private class NotificationIconTouchListener implements View.OnTouchListener { - final static int NOTIFICATION_PEEK_HOLD_THRESH = 200; // ms - final static int NOTIFICATION_PEEK_FADE_DELAY = 5000; // ms + final static int NOTIFICATION_PEEK_HOLD_THRESH = 200; // ms + final static int NOTIFICATION_PEEK_FADE_DELAY = 3000; // ms + public void resetNotificationPeekFadeTimer() { + if (DEBUG) { + Slog.d(TAG, "setting peek fade timer for " + NOTIFICATION_PEEK_FADE_DELAY + + "ms from now"); + } + mHandler.removeMessages(MSG_CLOSE_NOTIFICATION_PEEK); + mHandler.sendEmptyMessageDelayed(MSG_CLOSE_NOTIFICATION_PEEK, + NOTIFICATION_PEEK_FADE_DELAY); + } + + private class NotificationIconTouchListener implements View.OnTouchListener { VelocityTracker mVT; int mPeekIndex; float mInitialTouchX, mInitialTouchY; @@ -1303,8 +1315,7 @@ public class TabletStatusBar extends StatusBar implements } if (peeking) { - mHandler.sendEmptyMessageDelayed(MSG_CLOSE_NOTIFICATION_PEEK, - NOTIFICATION_PEEK_FADE_DELAY); + resetNotificationPeekFadeTimer(); } mVT.recycle();