Search in sources :

Example 1 with ExpandableNotificationRow

use of com.android.systemui.statusbar.ExpandableNotificationRow in project platform_frameworks_base by android.

the class PhoneStatusBar method updateNotificationShade.

private void updateNotificationShade() {
    if (mStackScroller == null)
        return;
    // Do not modify the notifications during collapse.
    if (isCollapsing()) {
        addPostCollapseAction(new Runnable() {

            @Override
            public void run() {
                updateNotificationShade();
            }
        });
        return;
    }
    ArrayList<Entry> activeNotifications = mNotificationData.getActiveNotifications();
    ArrayList<ExpandableNotificationRow> toShow = new ArrayList<>(activeNotifications.size());
    final int N = activeNotifications.size();
    for (int i = 0; i < N; i++) {
        Entry ent = activeNotifications.get(i);
        int vis = ent.notification.getNotification().visibility;
        // Display public version of the notification if we need to redact.
        final boolean hideSensitive = !userAllowsPrivateNotificationsInPublic(ent.notification.getUserId());
        boolean sensitiveNote = vis == Notification.VISIBILITY_PRIVATE;
        boolean sensitivePackage = packageHasVisibilityOverride(ent.notification.getKey());
        boolean sensitive = (sensitiveNote && hideSensitive) || sensitivePackage;
        boolean showingPublic = sensitive && isLockscreenPublicMode();
        if (showingPublic) {
            updatePublicContentView(ent, ent.notification);
        }
        ent.row.setSensitive(sensitive, hideSensitive);
        if (ent.autoRedacted && ent.legacy) {
            // for legacy auto redacted notifications.
            if (showingPublic) {
                ent.row.setShowingLegacyBackground(false);
            } else {
                ent.row.setShowingLegacyBackground(true);
            }
        }
        if (mGroupManager.isChildInGroupWithSummary(ent.row.getStatusBarNotification())) {
            ExpandableNotificationRow summary = mGroupManager.getGroupSummary(ent.row.getStatusBarNotification());
            List<ExpandableNotificationRow> orderedChildren = mTmpChildOrderMap.get(summary);
            if (orderedChildren == null) {
                orderedChildren = new ArrayList<>();
                mTmpChildOrderMap.put(summary, orderedChildren);
            }
            orderedChildren.add(ent.row);
        } else {
            toShow.add(ent.row);
        }
    }
    ArrayList<ExpandableNotificationRow> toRemove = new ArrayList<>();
    for (int i = 0; i < mStackScroller.getChildCount(); i++) {
        View child = mStackScroller.getChildAt(i);
        if (!toShow.contains(child) && child instanceof ExpandableNotificationRow) {
            toRemove.add((ExpandableNotificationRow) child);
        }
    }
    for (ExpandableNotificationRow remove : toRemove) {
        if (mGroupManager.isChildInGroupWithSummary(remove.getStatusBarNotification())) {
            // we are only transfering this notification to its parent, don't generate an animation
            mStackScroller.setChildTransferInProgress(true);
        }
        if (remove.isSummaryWithChildren()) {
            remove.removeAllChildren();
        }
        mStackScroller.removeView(remove);
        mStackScroller.setChildTransferInProgress(false);
    }
    removeNotificationChildren();
    for (int i = 0; i < toShow.size(); i++) {
        View v = toShow.get(i);
        if (v.getParent() == null) {
            mStackScroller.addView(v);
        }
    }
    addNotificationChildrenAndSort();
    // So after all this work notifications still aren't sorted correctly.
    // Let's do that now by advancing through toShow and mStackScroller in
    // lock-step, making sure mStackScroller matches what we see in toShow.
    int j = 0;
    for (int i = 0; i < mStackScroller.getChildCount(); i++) {
        View child = mStackScroller.getChildAt(i);
        if (!(child instanceof ExpandableNotificationRow)) {
            // We don't care about non-notification views.
            continue;
        }
        ExpandableNotificationRow targetChild = toShow.get(j);
        if (child != targetChild) {
            // Oops, wrong notification at this position. Put the right one
            // here and advance both lists.
            mStackScroller.changeViewPosition(targetChild, i);
        }
        j++;
    }
    // clear the map again for the next usage
    mTmpChildOrderMap.clear();
    updateRowStates();
    updateSpeedbump();
    updateClearAll();
    updateEmptyShadeView();
    updateQsExpansionEnabled();
    mShadeUpdates.check();
}
Also used : Entry(com.android.systemui.statusbar.NotificationData.Entry) ArrayList(java.util.ArrayList) ImageView(android.widget.ImageView) ActivatableNotificationView(com.android.systemui.statusbar.ActivatableNotificationView) BatteryMeterView(com.android.systemui.BatteryMeterView) BackDropView(com.android.systemui.statusbar.BackDropView) DismissView(com.android.systemui.statusbar.DismissView) EmptyShadeView(com.android.systemui.statusbar.EmptyShadeView) View(android.view.View) TextView(android.widget.TextView) ScrimView(com.android.systemui.statusbar.ScrimView) SignalClusterView(com.android.systemui.statusbar.SignalClusterView) Point(android.graphics.Point) ExpandableNotificationRow(com.android.systemui.statusbar.ExpandableNotificationRow)

Example 2 with ExpandableNotificationRow

use of com.android.systemui.statusbar.ExpandableNotificationRow in project platform_frameworks_base by android.

the class PhoneStatusBar method removeNotificationChildren.

private void removeNotificationChildren() {
    // First let's remove all children which don't belong in the parents
    ArrayList<ExpandableNotificationRow> toRemove = new ArrayList<>();
    for (int i = 0; i < mStackScroller.getChildCount(); i++) {
        View view = mStackScroller.getChildAt(i);
        if (!(view instanceof ExpandableNotificationRow)) {
            // We don't care about non-notification views.
            continue;
        }
        ExpandableNotificationRow parent = (ExpandableNotificationRow) view;
        List<ExpandableNotificationRow> children = parent.getNotificationChildren();
        List<ExpandableNotificationRow> orderedChildren = mTmpChildOrderMap.get(parent);
        if (children != null) {
            toRemove.clear();
            for (ExpandableNotificationRow childRow : children) {
                if ((orderedChildren == null || !orderedChildren.contains(childRow)) && !childRow.keepInParent()) {
                    toRemove.add(childRow);
                }
            }
            for (ExpandableNotificationRow remove : toRemove) {
                parent.removeChildNotification(remove);
                if (mNotificationData.get(remove.getStatusBarNotification().getKey()) == null) {
                    // We only want to add an animation if the view is completely removed
                    // otherwise it's just a transfer
                    mStackScroller.notifyGroupChildRemoved(remove, parent.getChildrenContainer());
                }
            }
        }
    }
}
Also used : ArrayList(java.util.ArrayList) ImageView(android.widget.ImageView) ActivatableNotificationView(com.android.systemui.statusbar.ActivatableNotificationView) BatteryMeterView(com.android.systemui.BatteryMeterView) BackDropView(com.android.systemui.statusbar.BackDropView) DismissView(com.android.systemui.statusbar.DismissView) EmptyShadeView(com.android.systemui.statusbar.EmptyShadeView) View(android.view.View) TextView(android.widget.TextView) ScrimView(com.android.systemui.statusbar.ScrimView) SignalClusterView(com.android.systemui.statusbar.SignalClusterView) Point(android.graphics.Point) ExpandableNotificationRow(com.android.systemui.statusbar.ExpandableNotificationRow)

Example 3 with ExpandableNotificationRow

use of com.android.systemui.statusbar.ExpandableNotificationRow in project platform_frameworks_base by android.

the class PhoneStatusBar method updateSpeedbump.

private void updateSpeedbump() {
    int speedbumpIndex = -1;
    int currentIndex = 0;
    final int N = mStackScroller.getChildCount();
    for (int i = 0; i < N; i++) {
        View view = mStackScroller.getChildAt(i);
        if (view.getVisibility() == View.GONE || !(view instanceof ExpandableNotificationRow)) {
            continue;
        }
        ExpandableNotificationRow row = (ExpandableNotificationRow) view;
        if (mNotificationData.isAmbient(row.getStatusBarNotification().getKey())) {
            speedbumpIndex = currentIndex;
            break;
        }
        currentIndex++;
    }
    mStackScroller.updateSpeedBumpIndex(speedbumpIndex);
}
Also used : ImageView(android.widget.ImageView) ActivatableNotificationView(com.android.systemui.statusbar.ActivatableNotificationView) BatteryMeterView(com.android.systemui.BatteryMeterView) BackDropView(com.android.systemui.statusbar.BackDropView) DismissView(com.android.systemui.statusbar.DismissView) EmptyShadeView(com.android.systemui.statusbar.EmptyShadeView) View(android.view.View) TextView(android.widget.TextView) ScrimView(com.android.systemui.statusbar.ScrimView) SignalClusterView(com.android.systemui.statusbar.SignalClusterView) Point(android.graphics.Point) ExpandableNotificationRow(com.android.systemui.statusbar.ExpandableNotificationRow)

Example 4 with ExpandableNotificationRow

use of com.android.systemui.statusbar.ExpandableNotificationRow in project platform_frameworks_base by android.

the class PhoneStatusBar method goToLockedShade.

/**
     * If secure with redaction: Show bouncer, go to unlocked shade.
     *
     * <p>If secure without redaction or no security: Go to {@link StatusBarState#SHADE_LOCKED}.</p>
     *
     * @param expandView The view to expand after going to the shade.
     */
public void goToLockedShade(View expandView) {
    ExpandableNotificationRow row = null;
    if (expandView instanceof ExpandableNotificationRow) {
        row = (ExpandableNotificationRow) expandView;
        row.setUserExpanded(true, /* userExpanded */
        true);
        // Indicate that the group expansion is changing at this time -- this way the group
        // and children backgrounds / divider animations will look correct.
        row.setGroupExpansionChanging(true);
    }
    boolean fullShadeNeedsBouncer = !userAllowsPrivateNotificationsInPublic(mCurrentUserId) || !mShowLockscreenNotifications || mFalsingManager.shouldEnforceBouncer();
    if (isLockscreenPublicMode() && fullShadeNeedsBouncer) {
        mLeaveOpenOnKeyguardHide = true;
        showBouncer();
        mDraggedDownRow = row;
        mPendingRemoteInputView = null;
    } else {
        mNotificationPanel.animateToFullShade(0);
        setBarState(StatusBarState.SHADE_LOCKED);
        updateKeyguardState(false, /* goingToFullShade */
        false);
    }
}
Also used : ExpandableNotificationRow(com.android.systemui.statusbar.ExpandableNotificationRow)

Example 5 with ExpandableNotificationRow

use of com.android.systemui.statusbar.ExpandableNotificationRow in project platform_frameworks_base by android.

the class PhoneStatusBar method addNotificationChildrenAndSort.

private void addNotificationChildrenAndSort() {
    // Let's now add all notification children which are missing
    boolean orderChanged = false;
    for (int i = 0; i < mStackScroller.getChildCount(); i++) {
        View view = mStackScroller.getChildAt(i);
        if (!(view instanceof ExpandableNotificationRow)) {
            // We don't care about non-notification views.
            continue;
        }
        ExpandableNotificationRow parent = (ExpandableNotificationRow) view;
        List<ExpandableNotificationRow> children = parent.getNotificationChildren();
        List<ExpandableNotificationRow> orderedChildren = mTmpChildOrderMap.get(parent);
        for (int childIndex = 0; orderedChildren != null && childIndex < orderedChildren.size(); childIndex++) {
            ExpandableNotificationRow childView = orderedChildren.get(childIndex);
            if (children == null || !children.contains(childView)) {
                parent.addChildNotification(childView, childIndex);
                mStackScroller.notifyGroupChildAdded(childView);
            }
        }
        // Finally after removing and adding has been beformed we can apply the order.
        orderChanged |= parent.applyChildOrder(orderedChildren);
    }
    if (orderChanged) {
        mStackScroller.generateChildOrderChangedEvent();
    }
}
Also used : ImageView(android.widget.ImageView) ActivatableNotificationView(com.android.systemui.statusbar.ActivatableNotificationView) BatteryMeterView(com.android.systemui.BatteryMeterView) BackDropView(com.android.systemui.statusbar.BackDropView) DismissView(com.android.systemui.statusbar.DismissView) EmptyShadeView(com.android.systemui.statusbar.EmptyShadeView) View(android.view.View) TextView(android.widget.TextView) ScrimView(com.android.systemui.statusbar.ScrimView) SignalClusterView(com.android.systemui.statusbar.SignalClusterView) Point(android.graphics.Point) ExpandableNotificationRow(com.android.systemui.statusbar.ExpandableNotificationRow)

Aggregations

ExpandableNotificationRow (com.android.systemui.statusbar.ExpandableNotificationRow)290 View (android.view.View)75 ExpandableView (com.android.systemui.statusbar.ExpandableView)75 TextView (android.widget.TextView)55 ActivatableNotificationView (com.android.systemui.statusbar.ActivatableNotificationView)45 DismissView (com.android.systemui.statusbar.DismissView)45 EmptyShadeView (com.android.systemui.statusbar.EmptyShadeView)45 Paint (android.graphics.Paint)40 ImageView (android.widget.ImageView)35 Point (android.graphics.Point)30 BatteryMeterView (com.android.systemui.BatteryMeterView)30 BackDropView (com.android.systemui.statusbar.BackDropView)30 ScrimView (com.android.systemui.statusbar.ScrimView)30 SignalClusterView (com.android.systemui.statusbar.SignalClusterView)30 NotificationHeaderView (android.view.NotificationHeaderView)25 BatteryLevelTextView (com.android.systemui.BatteryLevelTextView)24 KeyButtonView (com.android.systemui.statusbar.policy.KeyButtonView)24 StackScrollerDecorView (com.android.systemui.statusbar.StackScrollerDecorView)20 FakeShadowView (com.android.systemui.statusbar.notification.FakeShadowView)20 HybridNotificationView (com.android.systemui.statusbar.notification.HybridNotificationView)20