Search in sources :

Example 31 with Entry

use of com.android.systemui.statusbar.NotificationData.Entry in project android_frameworks_base by ResurrectionRemix.

the class PhoneStatusBar method handleGroupSummaryRemoved.

/**
     * Ensures that the group children are cancelled immediately when the group summary is cancelled
     * instead of waiting for the notification manager to send all cancels. Otherwise this could
     * lead to flickers.
     *
     * This also ensures that the animation looks nice and only consists of a single disappear
     * animation instead of multiple.
     *
     * @param key the key of the notification was removed
     * @param ranking the current ranking
     */
private void handleGroupSummaryRemoved(String key, RankingMap ranking) {
    Entry entry = mNotificationData.get(key);
    if (entry != null && entry.row != null && entry.row.isSummaryWithChildren()) {
        if (entry.notification.getOverrideGroupKey() != null && !entry.row.isDismissed()) {
            // always cancelled. We only remove them if they were dismissed by the user.
            return;
        }
        List<ExpandableNotificationRow> notificationChildren = entry.row.getNotificationChildren();
        ArrayList<ExpandableNotificationRow> toRemove = new ArrayList<>();
        for (int i = 0; i < notificationChildren.size(); i++) {
            ExpandableNotificationRow row = notificationChildren.get(i);
            if ((row.getStatusBarNotification().getNotification().flags & Notification.FLAG_FOREGROUND_SERVICE) != 0) {
                // the child is a forground service notification which we can't remove!
                continue;
            }
            toRemove.add(row);
            toRemove.get(i).setKeepInParent(true);
            // we need to set this state earlier as otherwise we might generate some weird
            // animations
            toRemove.get(i).setRemoved();
        }
        for (int i = 0; i < toRemove.size(); i++) {
            removeNotification(toRemove.get(i).getStatusBarNotification().getKey(), ranking);
            // we need to ensure that the view is actually properly removed from the viewstate
            // as this won't happen anymore when kept in the parent.
            mStackScroller.removeViewStateForView(toRemove.get(i));
        }
    }
}
Also used : Entry(com.android.systemui.statusbar.NotificationData.Entry) ArrayList(java.util.ArrayList) Point(android.graphics.Point) ExpandableNotificationRow(com.android.systemui.statusbar.ExpandableNotificationRow) MediaExpandableNotificationRow(com.android.systemui.statusbar.MediaExpandableNotificationRow)

Example 32 with Entry

use of com.android.systemui.statusbar.NotificationData.Entry in project android_frameworks_base by ResurrectionRemix.

the class BaseStatusBar method removeNotificationViews.

protected StatusBarNotification removeNotificationViews(String key, RankingMap ranking) {
    NotificationData.Entry entry = mNotificationData.remove(key, ranking);
    if (entry == null) {
        Log.w(TAG, "removeNotification for unknown key: " + key);
        return null;
    }
    updateNotifications();
    return entry.notification;
}
Also used : Entry(com.android.systemui.statusbar.NotificationData.Entry)

Example 33 with Entry

use of com.android.systemui.statusbar.NotificationData.Entry in project android_frameworks_base by crdroidandroid.

the class BaseStatusBar method onDensityOrFontScaleChanged.

protected void onDensityOrFontScaleChanged() {
    ArrayList<Entry> activeNotifications = mNotificationData.getActiveNotifications();
    for (int i = 0; i < activeNotifications.size(); i++) {
        Entry entry = activeNotifications.get(i);
        boolean exposedGuts = entry.row.getGuts() == mNotificationGutsExposed;
        entry.row.reInflateViews();
        if (exposedGuts) {
            mNotificationGutsExposed = entry.row.getGuts();
            bindGuts(entry.row);
        }
        inflateViews(entry, mStackScroller);
    }
}
Also used : Entry(com.android.systemui.statusbar.NotificationData.Entry)

Example 34 with Entry

use of com.android.systemui.statusbar.NotificationData.Entry in project android_frameworks_base by crdroidandroid.

the class BaseStatusBar method updateRowStates.

/**
     * Updates expanded, dimmed and locked states of notification rows.
     */
protected void updateRowStates() {
    mKeyguardIconOverflowContainer.getIconsView().removeAllViews();
    final int N = mStackScroller.getChildCount();
    int visibleNotifications = 0;
    boolean onKeyguard = mState == StatusBarState.KEYGUARD;
    int maxNotifications = 0;
    if (onKeyguard) {
        maxNotifications = getMaxKeyguardNotifications(true);
    }
    Stack<ExpandableNotificationRow> stack = new Stack<>();
    for (int i = N - 1; i >= 0; i--) {
        View child = mStackScroller.getChildAt(i);
        if (!(child instanceof ExpandableNotificationRow)) {
            continue;
        }
        stack.push((ExpandableNotificationRow) child);
    }
    while (!stack.isEmpty()) {
        ExpandableNotificationRow row = stack.pop();
        NotificationData.Entry entry = row.getEntry();
        boolean childNotification = mGroupManager.isChildInGroupWithSummary(entry.notification);
        if (onKeyguard) {
            row.setOnKeyguard(true);
        } else {
            row.setOnKeyguard(false);
            row.setSystemExpanded(visibleNotifications == 0 && !childNotification);
        }
        boolean suppressedSummary = mGroupManager.isSummaryOfSuppressedGroup(entry.notification) && !entry.row.isRemoved();
        boolean childWithVisibleSummary = childNotification && mGroupManager.getGroupSummary(entry.notification).getVisibility() == View.VISIBLE;
        boolean showOnKeyguard = shouldShowOnKeyguard(entry.notification);
        if (suppressedSummary || (isLockscreenPublicMode() && !mShowLockscreenNotifications) || (onKeyguard && !childWithVisibleSummary && (visibleNotifications >= maxNotifications || !showOnKeyguard))) {
            entry.row.setVisibility(View.GONE);
            if (onKeyguard && showOnKeyguard && !childNotification && !suppressedSummary) {
                mKeyguardIconOverflowContainer.getIconsView().addNotification(entry);
            }
        } else {
            boolean wasGone = entry.row.getVisibility() == View.GONE;
            if (wasGone) {
                entry.row.setVisibility(View.VISIBLE);
            }
            if (!childNotification && !entry.row.isRemoved()) {
                if (wasGone) {
                    // notify the scroller of a child addition
                    mStackScroller.generateAddAnimation(entry.row, !showOnKeyguard);
                }
                visibleNotifications++;
            }
        }
        if (row.isSummaryWithChildren()) {
            List<ExpandableNotificationRow> notificationChildren = row.getNotificationChildren();
            int size = notificationChildren.size();
            for (int i = size - 1; i >= 0; i--) {
                stack.push(notificationChildren.get(i));
            }
        }
    }
    mStackScroller.updateOverflowContainerVisibility(onKeyguard && mKeyguardIconOverflowContainer.getIconsView().getChildCount() > 0);
    mStackScroller.changeViewPosition(mDismissView, mStackScroller.getChildCount() - 1);
    mStackScroller.changeViewPosition(mEmptyShadeView, mStackScroller.getChildCount() - 2);
    mStackScroller.changeViewPosition(mKeyguardIconOverflowContainer, mStackScroller.getChildCount() - 3);
    if (onKeyguard) {
        hideWeatherPanelIfNecessary(visibleNotifications, getMaxKeyguardNotifications(true));
    }
}
Also used : Entry(com.android.systemui.statusbar.NotificationData.Entry) ImageView(android.widget.ImageView) View(android.view.View) RemoteInputView(com.android.systemui.statusbar.policy.RemoteInputView) TextView(android.widget.TextView) NavigationBarView(com.android.systemui.statusbar.phone.NavigationBarView) Stack(java.util.Stack)

Example 35 with Entry

use of com.android.systemui.statusbar.NotificationData.Entry in project android_frameworks_base by crdroidandroid.

the class BaseStatusBar method removeNotificationViews.

protected StatusBarNotification removeNotificationViews(String key, RankingMap ranking) {
    NotificationData.Entry entry = mNotificationData.remove(key, ranking);
    if (entry == null) {
        Log.w(TAG, "removeNotification for unknown key: " + key);
        return null;
    }
    updateNotifications();
    return entry.notification;
}
Also used : Entry(com.android.systemui.statusbar.NotificationData.Entry)

Aggregations

Entry (com.android.systemui.statusbar.NotificationData.Entry)81 Point (android.graphics.Point)39 ArrayList (java.util.ArrayList)14 View (android.view.View)13 ImageView (android.widget.ImageView)13 TextView (android.widget.TextView)13 Notification (android.app.Notification)11 StatusBarNotification (android.service.notification.StatusBarNotification)11 ExpandableNotificationRow (com.android.systemui.statusbar.ExpandableNotificationRow)10 SignalClusterView (com.android.systemui.statusbar.SignalClusterView)9 StatusBarManager.windowStateToString (android.app.StatusBarManager.windowStateToString)8 NotificationData (com.android.systemui.statusbar.NotificationData)8 MediaExpandableNotificationRow (com.android.systemui.statusbar.MediaExpandableNotificationRow)6 KeyButtonView (com.android.systemui.statusbar.policy.KeyButtonView)6 MediaController (android.media.session.MediaController)5 MediaSession (android.media.session.MediaSession)5 StatusBarIcon (com.android.internal.statusbar.StatusBarIcon)5 BatteryMeterView (com.android.systemui.BatteryMeterView)5 KeyguardViewMediator (com.android.systemui.keyguard.KeyguardViewMediator)5 ActivatableNotificationView (com.android.systemui.statusbar.ActivatableNotificationView)5