diff --git a/packages/SystemUI/res/layout-xlarge/sysbar_panel_notification_peek.xml b/packages/SystemUI/res/layout-xlarge/sysbar_panel_notification_peek.xml new file mode 100644 index 0000000000000..a7c91f57e50a0 --- /dev/null +++ b/packages/SystemUI/res/layout-xlarge/sysbar_panel_notification_peek.xml @@ -0,0 +1,43 @@ + + + + + + + + + diff --git a/packages/SystemUI/res/layout-xlarge/sysbar_panel_notifications.xml b/packages/SystemUI/res/layout-xlarge/sysbar_panel_notifications.xml index 80c9a49640b69..8cbf3e3f3c498 100644 --- a/packages/SystemUI/res/layout-xlarge/sysbar_panel_notifications.xml +++ b/packages/SystemUI/res/layout-xlarge/sysbar_panel_notifications.xml @@ -23,20 +23,23 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="wrap_content" android:layout_width="match_parent" - android:background="#FF000000" + android:background="@*android:drawable/dialog_full_holo_dark" android:orientation="vertical" + android:animateLayoutChanges="true" > numIcons - 1) peekIndex = numIcons - 1; + else if (peekIndex < 0) peekIndex = 0; + + if (!peeking || mNotificationPeekIndex != peekIndex) { + if (DEBUG) Slog.d(TAG, "will peek at notification #" + peekIndex); + Message peekMsg = mHandler.obtainMessage(MSG_OPEN_NOTIFICATION_PEEK); + peekMsg.arg1 = peekIndex; + + mHandler.removeMessages(MSG_OPEN_NOTIFICATION_PEEK); + + // no delay if we're scrubbing left-right + mHandler.sendMessageDelayed(peekMsg, + peeking ? 0 : mNotificationPeekTapDuration); + } + + // check for fling + if (mVT != null) { + mVT.addMovement(event); + mVT.computeCurrentVelocity(1000); + // require a little more oomph once we're already in peekaboo mode + if (!panelShowing && ( + (peeking && mVT.getYVelocity() < -mNotificationFlingVelocity*3) + || (mVT.getYVelocity() < -mNotificationFlingVelocity))) { + mHandler.removeMessages(MSG_OPEN_NOTIFICATION_PEEK); + mHandler.removeMessages(MSG_OPEN_NOTIFICATION_PANEL); + mHandler.sendEmptyMessage(MSG_CLOSE_NOTIFICATION_PEEK); + mHandler.sendEmptyMessage(MSG_OPEN_NOTIFICATION_PANEL); + } + } + return true; + case MotionEvent.ACTION_UP: + case MotionEvent.ACTION_CANCEL: + mHandler.removeMessages(MSG_OPEN_NOTIFICATION_PEEK); + if (peeking) { + mHandler.sendEmptyMessageDelayed(MSG_CLOSE_NOTIFICATION_PEEK, 250); + } + mVT.recycle(); + mVT = null; + return true; + } + return false; + } + } + StatusBarIconView addNotificationViews(IBinder key, StatusBarNotification notification) { if (DEBUG) { Slog.d(TAG, "addNotificationViews(key=" + key + ", notification=" + notification); @@ -836,6 +1002,7 @@ public class TabletStatusBarService extends StatusBarService { + notification); return null; } + // Add the icon. mNotns.add(entry); refreshIcons(); @@ -847,28 +1014,76 @@ public class TabletStatusBarService extends StatusBarService { // XXX: need to implement a new limited linear layout class // to avoid removing & readding everything + final int ICON_LIMIT = 4; + final LinearLayout.LayoutParams params + = new LinearLayout.LayoutParams(mIconSize, mIconSize); + int N = mNotns.size(); - LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(mIconSize, mIconSize); if (DEBUG) { - Slog.d(TAG, "refreshing icons (" + N + " notifications, mIconLayout=" - + mIconLayout + ", mPile=" + mPile); + Slog.d(TAG, "refreshing icons: " + N + " notifications, mIconLayout=" + mIconLayout); } - mIconLayout.removeAllViews(); - for (int i=0; i<4; i++) { + ArrayList toShow = new ArrayList(); + + for (int i=0; i=N) break; - mIconLayout.addView(mNotns.get(N-i-1).icon, i, params); + toShow.add(mNotns.get(N-i-1).icon); } - mPile.removeAllViews(); - for (int i=0; i toRemove = new ArrayList(); + for (int i=0; i toShow = new ArrayList(); + + for (int i=0; i toRemove = new ArrayList(); + for (int i=0; i= 0 && num < kNumberedIconResIDs.length) + ? kNumberedIconResIDs[num] + : kUnnumberedIconResID, + null, + System.currentTimeMillis(), + "Notification", "Number=" + num, + null); n.number = num; return n; }