Search in sources :

Example 96 with ExpandableNotificationRow

use of com.android.systemui.statusbar.ExpandableNotificationRow in project android_frameworks_base by AOSPA.

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;
        showBouncerIfKeyguard();
        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 97 with ExpandableNotificationRow

use of com.android.systemui.statusbar.ExpandableNotificationRow in project android_frameworks_base by AOSPA.

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);
        if (ent.row.isDismissed() || ent.row.isRemoved()) {
            // temporarily become children if they were isolated before.
            continue;
        }
        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) {
            mVisualStabilityManager.notifyViewAddition(v);
            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) {
            // here and advance both lists.
            if (mVisualStabilityManager.canReorderNotification(targetChild)) {
                mStackScroller.changeViewPosition(targetChild, i);
            } else {
                mVisualStabilityManager.addReorderingAllowedCallback(this);
            }
        }
        j++;
    }
    mVisualStabilityManager.onReorderingFinished();
    // 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) ActivatableNotificationView(com.android.systemui.statusbar.ActivatableNotificationView) BatteryMeterView(com.android.systemui.BatteryMeterView) DismissView(com.android.systemui.statusbar.DismissView) SignalClusterView(com.android.systemui.statusbar.SignalClusterView) ImageView(android.widget.ImageView) BatteryLevelTextView(com.android.systemui.BatteryLevelTextView) BackDropView(com.android.systemui.statusbar.BackDropView) KeyButtonView(com.android.systemui.statusbar.policy.KeyButtonView) EmptyShadeView(com.android.systemui.statusbar.EmptyShadeView) View(android.view.View) TextView(android.widget.TextView) ScrimView(com.android.systemui.statusbar.ScrimView) Point(android.graphics.Point) ExpandableNotificationRow(com.android.systemui.statusbar.ExpandableNotificationRow)

Example 98 with ExpandableNotificationRow

use of com.android.systemui.statusbar.ExpandableNotificationRow in project android_frameworks_base by AOSPA.

the class PhoneStatusBar method updateSpeedbump.

private void updateSpeedbump() {
    int speedBumpIndex = 0;
    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;
        currentIndex++;
        if (!mNotificationData.isAmbient(row.getStatusBarNotification().getKey())) {
            speedBumpIndex = currentIndex;
        }
    }
    mStackScroller.updateSpeedBumpIndex(speedBumpIndex);
}
Also used : ActivatableNotificationView(com.android.systemui.statusbar.ActivatableNotificationView) BatteryMeterView(com.android.systemui.BatteryMeterView) DismissView(com.android.systemui.statusbar.DismissView) SignalClusterView(com.android.systemui.statusbar.SignalClusterView) ImageView(android.widget.ImageView) BatteryLevelTextView(com.android.systemui.BatteryLevelTextView) BackDropView(com.android.systemui.statusbar.BackDropView) KeyButtonView(com.android.systemui.statusbar.policy.KeyButtonView) EmptyShadeView(com.android.systemui.statusbar.EmptyShadeView) View(android.view.View) TextView(android.widget.TextView) ScrimView(com.android.systemui.statusbar.ScrimView) Point(android.graphics.Point) ExpandableNotificationRow(com.android.systemui.statusbar.ExpandableNotificationRow)

Example 99 with ExpandableNotificationRow

use of com.android.systemui.statusbar.ExpandableNotificationRow in project android_frameworks_base by AOSPA.

the class HeadsUpTouchHelper method onInterceptTouchEvent.

@Override
public boolean onInterceptTouchEvent(MotionEvent event) {
    if (!mTouchingHeadsUpView && event.getActionMasked() != MotionEvent.ACTION_DOWN) {
        return false;
    }
    int pointerIndex = event.findPointerIndex(mTrackingPointer);
    if (pointerIndex < 0) {
        pointerIndex = 0;
        mTrackingPointer = event.getPointerId(pointerIndex);
    }
    final float x = event.getX(pointerIndex);
    final float y = event.getY(pointerIndex);
    switch(event.getActionMasked()) {
        case MotionEvent.ACTION_DOWN:
            mInitialTouchY = y;
            mInitialTouchX = x;
            setTrackingHeadsUp(false);
            ExpandableView child = mStackScroller.getChildAtRawPosition(x, y);
            mTouchingHeadsUpView = false;
            if (child instanceof ExpandableNotificationRow) {
                mPickedChild = (ExpandableNotificationRow) child;
                mTouchingHeadsUpView = !mStackScroller.isExpanded() && mPickedChild.isHeadsUp() && mPickedChild.isPinned();
            }
            break;
        case MotionEvent.ACTION_POINTER_UP:
            final int upPointer = event.getPointerId(event.getActionIndex());
            if (mTrackingPointer == upPointer) {
                // gesture is ongoing, find a new pointer to track
                final int newIndex = event.getPointerId(0) != upPointer ? 0 : 1;
                mTrackingPointer = event.getPointerId(newIndex);
                mInitialTouchX = event.getX(newIndex);
                mInitialTouchY = event.getY(newIndex);
            }
            break;
        case MotionEvent.ACTION_MOVE:
            final float h = y - mInitialTouchY;
            if (mTouchingHeadsUpView && Math.abs(h) > mTouchSlop && Math.abs(h) > Math.abs(x - mInitialTouchX)) {
                setTrackingHeadsUp(true);
                mCollapseSnoozes = h < 0;
                mInitialTouchX = x;
                mInitialTouchY = y;
                int expandedHeight = mPickedChild.getActualHeight();
                mPanel.setPanelScrimMinFraction((float) expandedHeight / mPanel.getMaxPanelHeight());
                mPanel.startExpandMotion(x, y, true, /* startTracking */
                expandedHeight);
                // This call needs to be after the expansion start otherwise we will get a
                // flicker of one frame as it's not expanded yet.
                mHeadsUpManager.unpinAll();
                mPanel.clearNotificationEffects();
                return true;
            }
            break;
        case MotionEvent.ACTION_CANCEL:
        case MotionEvent.ACTION_UP:
            if (mPickedChild != null && mTouchingHeadsUpView) {
                // We may swallow this click if the heads up just came in.
                if (mHeadsUpManager.shouldSwallowClick(mPickedChild.getStatusBarNotification().getKey())) {
                    endMotion();
                    return true;
                }
            }
            endMotion();
            break;
    }
    return false;
}
Also used : ExpandableView(com.android.systemui.statusbar.ExpandableView) ExpandableNotificationRow(com.android.systemui.statusbar.ExpandableNotificationRow)

Example 100 with ExpandableNotificationRow

use of com.android.systemui.statusbar.ExpandableNotificationRow in project android_frameworks_base by AOSPA.

the class TransformState method setClippingDeactivated.

public static void setClippingDeactivated(final View transformedView, boolean deactivated) {
    if (!(transformedView.getParent() instanceof ViewGroup)) {
        return;
    }
    ViewGroup view = (ViewGroup) transformedView.getParent();
    while (true) {
        ArraySet<View> clipSet = (ArraySet<View>) view.getTag(CLIP_CLIPPING_SET);
        if (clipSet == null) {
            clipSet = new ArraySet<>();
            view.setTag(CLIP_CLIPPING_SET, clipSet);
        }
        Boolean clipChildren = (Boolean) view.getTag(CLIP_CHILDREN_TAG);
        if (clipChildren == null) {
            clipChildren = view.getClipChildren();
            view.setTag(CLIP_CHILDREN_TAG, clipChildren);
        }
        Boolean clipToPadding = (Boolean) view.getTag(CLIP_TO_PADDING);
        if (clipToPadding == null) {
            clipToPadding = view.getClipToPadding();
            view.setTag(CLIP_TO_PADDING, clipToPadding);
        }
        ExpandableNotificationRow row = view instanceof ExpandableNotificationRow ? (ExpandableNotificationRow) view : null;
        if (!deactivated) {
            clipSet.remove(transformedView);
            if (clipSet.isEmpty()) {
                view.setClipChildren(clipChildren);
                view.setClipToPadding(clipToPadding);
                view.setTag(CLIP_CLIPPING_SET, null);
                if (row != null) {
                    row.setClipToActualHeight(true);
                }
            }
        } else {
            clipSet.add(transformedView);
            view.setClipChildren(false);
            view.setClipToPadding(false);
            if (row != null && row.isChildInGroup()) {
                // We still want to clip to the parent's height
                row.setClipToActualHeight(false);
            }
        }
        if (row != null && !row.isChildInGroup()) {
            return;
        }
        final ViewParent parent = view.getParent();
        if (parent instanceof ViewGroup) {
            view = (ViewGroup) parent;
        } else {
            return;
        }
    }
}
Also used : ArraySet(android.util.ArraySet) ViewGroup(android.view.ViewGroup) ViewParent(android.view.ViewParent) ImageView(android.widget.ImageView) TransformableView(com.android.systemui.statusbar.TransformableView) TextView(android.widget.TextView) View(android.view.View) NotificationHeaderView(android.view.NotificationHeaderView) 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