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

Commit 20da8f8a authored by Joe Onorato's avatar Joe Onorato
Browse files

Implement setAreThereNotifications.

Change-Id: I8b69330c35d613ce808a472748dd2651adb5efa3
parent 0e26dffd
Loading
Loading
Loading
Loading
+23 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.policy.statusbar.phone;

import android.app.Notification;
import android.os.IBinder;
import android.view.View;

@@ -89,4 +90,26 @@ public class NotificationData {
        }
        return N;
    }

    /**
     * Return whether there are any visible items (i.e. items without an error).
     */
    public boolean hasVisibleItems() {
        return mEntries.size() != 0; // TODO
    }

    /**
     * Return whether there are any clearable items (that aren't errors).
     */
    public boolean hasClearableItems() {
        final int N = mEntries.size();
        for (int i=0; i<N; i++) {
            Entry entry = mEntries.get(i);
            // TODO: if (!entry.error)
            if ((entry.notification.notification.flags & Notification.FLAG_NO_CLEAR) == 0) {
                return true;
            }
        }
        return false;
    }
}
+6 −7
Original line number Diff line number Diff line
@@ -324,7 +324,8 @@ public class PhoneStatusBarService extends StatusBarService {
        // show the ticker
        // TODO

        // recalculate the position of the sliding windows
        // Recalculate the position of the sliding windows and the titles.
        setAreThereNotifications();
        updateExpandedViewPos(EXPANDED_LEAVE_ALONE);
    }

@@ -483,7 +484,6 @@ public class PhoneStatusBarService extends StatusBarService {
        final int iconIndex = chooseIconIndex(isOngoing, viewIndex);
        mNotificationIcons.addView(iconView, iconIndex,
                new LinearLayout.LayoutParams(mIconWidth, mHeight));

    }

    void removeNotificationViews(IBinder key) {
@@ -502,11 +502,11 @@ public class PhoneStatusBarService extends StatusBarService {
    }

    private void setAreThereNotifications() {
    /*
        boolean ongoing = mOngoingItems.getChildCount() != 0;
        boolean latest = mLatestItems.getChildCount() != 0;
        boolean ongoing = mOngoing.hasVisibleItems();
        boolean latest = mLatest.hasVisibleItems();

        if (mNotificationData.hasClearableItems()) {
        // (no ongoing notifications are clearable)
        if (mLatest.hasClearableItems()) {
            mClearButton.setVisibility(View.VISIBLE);
        } else {
            mClearButton.setVisibility(View.INVISIBLE);
@@ -520,7 +520,6 @@ public class PhoneStatusBarService extends StatusBarService {
        } else {
            mNoNotificationsTitle.setVisibility(View.VISIBLE);
        }
    */
    }