Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ba3711cc authored by Daniel Sandler's avatar Daniel Sandler Committed by Android (Google) Code Review
Browse files

Merge "Disable peeking at individual notifications."

parents 03f156e9 298a2a81
Loading
Loading
Loading
Loading
+4 −9
Original line number Diff line number Diff line
@@ -24,6 +24,8 @@
    android:layout_height="match_parent"
    android:layout_alignParentRight="true"
    android:orientation="horizontal"
    android:background="?android:attr/listChoiceBackgroundIndicator"
    android:clickable="true"
    >

    <LinearLayout
@@ -65,14 +67,7 @@
                android:layout_height="match_parent"
                android:layout_gravity="center_vertical"
                android:layout_marginLeft="8dp"
                />
            <View 
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_alignLeft="@id/icons"
                android:layout_alignRight="@id/icons"
                android:background="@drawable/notification_icon_area_smoke"
                android:clickable="false"
                android:alpha="0.4"
                />
        </com.android.systemui.statusbar.tablet.NotificationIconArea>
    </LinearLayout>
@@ -88,7 +83,7 @@
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginBottom="3dip"
            android:layout_marginLeft="4dip"
            android:layout_marginLeft="8dip"
            android:layout_marginRight="4dip"
            >
            <TextView android:id="@+id/time_solid"
+83 −50
Original line number Diff line number Diff line
@@ -103,6 +103,11 @@ public class TabletStatusBar extends StatusBar implements
    // Fitts' Law assistance for LatinIME; see policy.EventHole
    private static final boolean FAKE_SPACE_BAR = true;

    // Notification "peeking" (flyover preview of individual notifications)
    final static boolean NOTIFICATION_PEEK_ENABLED = false;
    final static int NOTIFICATION_PEEK_HOLD_THRESH = 200; // ms
    final static int NOTIFICATION_PEEK_FADE_DELAY = 3000; // ms

    // The height of the bar, as definied by the build.  It may be taller if we're plugged
    // into hdmi.
    int mNaturalBarHeight = -1;
@@ -250,6 +255,7 @@ public class TabletStatusBar extends StatusBar implements
        WindowManagerImpl.getDefault().addView(mNotificationPanel, lp);

        // Notification preview window
        if (NOTIFICATION_PEEK_ENABLED) {
            mNotificationPeekWindow = (NotificationPeekPanel) View.inflate(context,
                    R.layout.status_bar_notification_peek, null);
            mNotificationPeekWindow.setBar(this);
@@ -287,6 +293,7 @@ public class TabletStatusBar extends StatusBar implements
            lp.windowAnimations = com.android.internal.R.style.Animation_Toast;

            WindowManagerImpl.getDefault().addView(mNotificationPeekWindow, lp);
        }

        // Recents Panel
        mRecentsPanel = (RecentsPanelView) View.inflate(context,
@@ -444,17 +451,24 @@ public class TabletStatusBar extends StatusBar implements

        // the whole right-hand side of the bar
        mNotificationArea = sb.findViewById(R.id.notificationArea);
        if (!NOTIFICATION_PEEK_ENABLED) {
            mNotificationArea.setOnTouchListener(new NotificationTriggerTouchListener());
        }

        // the button to open the notification area
        mNotificationTrigger = sb.findViewById(R.id.notificationTrigger);
        if (NOTIFICATION_PEEK_ENABLED) {
            mNotificationTrigger.setOnTouchListener(new NotificationTriggerTouchListener());
        }

        // the more notifications icon
        mNotificationIconArea = (NotificationIconArea)sb.findViewById(R.id.notificationIcons);

        // where the icons go
        mIconLayout = (NotificationIconArea.IconLayout) sb.findViewById(R.id.icons);
        if (NOTIFICATION_PEEK_ENABLED) {
            mIconLayout.setOnTouchListener(new NotificationIconTouchListener());
        }

        ViewConfiguration vc = ViewConfiguration.get(context);
        mNotificationPeekTapDuration = vc.getTapTimeout();
@@ -684,7 +698,9 @@ public class TabletStatusBar extends StatusBar implements
                case MSG_OPEN_NOTIFICATION_PANEL:
                    if (DEBUG) Slog.d(TAG, "opening notifications panel");
                    if (!mNotificationPanel.isShowing()) {
                        if (NOTIFICATION_PEEK_ENABLED) {
                            mNotificationPeekWindow.setVisibility(View.GONE);
                        }
                        mNotificationPanel.show(true, true);
                        mNotificationArea.setVisibility(View.INVISIBLE);
                        mTicker.halt();
@@ -863,7 +879,7 @@ public class TabletStatusBar extends StatusBar implements
                    oldEntry.largeIcon.setVisibility(View.INVISIBLE);
                }

                if (key == mNotificationPeekKey) {
                if (NOTIFICATION_PEEK_ENABLED && key == mNotificationPeekKey) {
                    // must update the peek window
                    Message peekMsg = mHandler.obtainMessage(MSG_OPEN_NOTIFICATION_PEEK);
                    peekMsg.arg1 = mNotificationPeekIndex;
@@ -1010,9 +1026,11 @@ public class TabletStatusBar extends StatusBar implements
    }

    public void animateExpand() {
        if (NOTIFICATION_PEEK_ENABLED) {
            mHandler.removeMessages(MSG_CLOSE_NOTIFICATION_PEEK);
            mHandler.removeMessages(MSG_OPEN_NOTIFICATION_PEEK);
            mHandler.sendEmptyMessage(MSG_CLOSE_NOTIFICATION_PEEK);
        }
        mHandler.removeMessages(MSG_OPEN_NOTIFICATION_PANEL);
        mHandler.sendEmptyMessage(MSG_OPEN_NOTIFICATION_PANEL);
    }
@@ -1026,9 +1044,11 @@ public class TabletStatusBar extends StatusBar implements
        mHandler.sendEmptyMessage(MSG_CLOSE_INPUT_METHODS_PANEL);
        mHandler.removeMessages(MSG_CLOSE_COMPAT_MODE_PANEL);
        mHandler.sendEmptyMessage(MSG_CLOSE_COMPAT_MODE_PANEL);
        if (NOTIFICATION_PEEK_ENABLED) {
            mHandler.removeMessages(MSG_CLOSE_NOTIFICATION_PEEK);
            mHandler.sendEmptyMessage(MSG_CLOSE_NOTIFICATION_PEEK);
        }
    }

    private void notifyUiVisibilityChanged() {
        try {
@@ -1328,7 +1348,7 @@ public class TabletStatusBar extends StatusBar implements
        ViewGroup rowParent = (ViewGroup)entry.row.getParent();
        if (rowParent != null) rowParent.removeView(entry.row);

        if (key == mNotificationPeekKey) {
        if (NOTIFICATION_PEEK_ENABLED && key == mNotificationPeekKey) {
            // must close the peek as well, since it's gone
            mHandler.sendEmptyMessage(MSG_CLOSE_NOTIFICATION_PEEK);
        }
@@ -1349,6 +1369,19 @@ public class TabletStatusBar extends StatusBar implements
            mTouchSlop = ViewConfiguration.get(getContext()).getScaledTouchSlop();
        }

        private Runnable mHiliteOnR = new Runnable() { public void run() {
            mNotificationArea.setBackgroundResource(
                com.android.internal.R.drawable.list_selector_pressed_holo_dark);
        }};
        public void hilite(final boolean on) {
            if (on) {
                mNotificationArea.postDelayed(mHiliteOnR, 100);
            } else {
                mNotificationArea.removeCallbacks(mHiliteOnR);
                mNotificationArea.setBackgroundDrawable(null);
            }
        }

        public boolean onTouch(View v, MotionEvent event) {
//            Slog.d(TAG, String.format("touch: (%.1f, %.1f) initial: (%.1f, %.1f)",
//                        event.getX(),
@@ -1361,6 +1394,7 @@ public class TabletStatusBar extends StatusBar implements
                    mVT = VelocityTracker.obtain();
                    mInitialTouchX = event.getX();
                    mInitialTouchY = event.getY();
                    hilite(true);
                    // fall through
                case MotionEvent.ACTION_OUTSIDE:
                case MotionEvent.ACTION_MOVE:
@@ -1371,6 +1405,7 @@ public class TabletStatusBar extends StatusBar implements
                        // require a little more oomph once we're already in peekaboo mode
                        if (mVT.getYVelocity() < -mNotificationFlingVelocity) {
                            animateExpand();
                            hilite(false);
                            mVT.recycle();
                            mVT = null;
                        }
@@ -1378,6 +1413,7 @@ public class TabletStatusBar extends StatusBar implements
                    return true;
                case MotionEvent.ACTION_UP:
                case MotionEvent.ACTION_CANCEL:
                    hilite(false);
                    if (mVT != null) {
                        if (action == MotionEvent.ACTION_UP
                         // was this a sloppy tap?
@@ -1399,9 +1435,6 @@ public class TabletStatusBar extends StatusBar implements
        }
    }

    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