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

Commit ff10e990 authored by Ricardo Cerqueira's avatar Ricardo Cerqueira Committed by Gerrit Code Review
Browse files

Merge "Close notification view when swiping away the last notification." into gingerbread

parents 97eeb4e0 7d96c65d
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@ public class NotificationData {
        public View row; // the outer expanded view
        public View content; // takes the click events and sends the PendingIntent
        public View expanded; // the inflated RemoteViews
        public boolean cancelled;
    }
    private final ArrayList<Entry> mEntries = new ArrayList<Entry>();

@@ -66,6 +67,7 @@ public class NotificationData {
        entry.content = content;
        entry.expanded = expanded;
        entry.icon = icon;
        entry.cancelled = false;
        final int index = chooseIndex(notification.notification.when);
        mEntries.add(index, entry);
        return index;
+12 −3
Original line number Diff line number Diff line
@@ -716,7 +716,7 @@ public class StatusBarService extends Service implements CommandQueue.Callbacks
        }
    }

    View[] makeNotificationView(final StatusBarNotification notification, ViewGroup parent) {
    View[] makeNotificationView(final IBinder key, final StatusBarNotification notification, ViewGroup parent) {
        Notification n = notification.notification;
        RemoteViews remoteViews = n.contentView;
        if (remoteViews == null) {
@@ -731,6 +731,11 @@ public class StatusBarService extends Service implements CommandQueue.Callbacks
                public void run() {
                    try {
                        mBarService.onNotificationClear(notification.pkg, notification.tag, notification.id);

                        int index = mLatest.findEntry(key);
                        if (index >= 0) {
                            mLatest.getEntryAt(index).cancelled = true;
                        }
                     } catch (RemoteException e) {
                        // Skip it, don't crash.
                    }
@@ -780,7 +785,7 @@ public class StatusBarService extends Service implements CommandQueue.Callbacks
            parent = mLatestItems;
        }
        // Construct the expanded view.
        final View[] views = makeNotificationView(notification, parent);
        final View[] views = makeNotificationView(key, notification, parent);
        if (views == null) {
            handleNotificationError(key, notification, "Couldn't expand RemoteViews for: "
                    + notification);
@@ -821,6 +826,10 @@ public class StatusBarService extends Service implements CommandQueue.Callbacks
        // Remove the icon.
        ((ViewGroup)entry.icon.getParent()).removeView(entry.icon);

        if (entry.cancelled && !mLatest.hasClearableItems()) {
            animateCollapse();
        }

        return entry.notification;
    }