Search in sources :

Example 71 with ExpandableNotificationRow

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

the class NotificationStackScrollLayout method getChildAtPosition.

@Override
public View getChildAtPosition(MotionEvent ev) {
    View child = getChildAtPosition(ev.getX(), ev.getY());
    if (child instanceof ExpandableNotificationRow) {
        ExpandableNotificationRow row = (ExpandableNotificationRow) child;
        ExpandableNotificationRow parent = row.getNotificationParent();
        if (parent != null && parent.areChildrenExpanded() && (parent.areGutsExposed() || mGearExposedView == parent || (parent.getNotificationChildren().size() == 1 && parent.isClearable()))) {
            // In this case the group is expanded and showing the gear for the
            // group, further interaction should apply to the group, not any
            // child notifications so we use the parent of the child. We also do the same
            // if we only have a single child.
            child = parent;
        }
    }
    return child;
}
Also used : EmptyShadeView(com.android.systemui.statusbar.EmptyShadeView) ActivatableNotificationView(com.android.systemui.statusbar.ActivatableNotificationView) FakeShadowView(com.android.systemui.statusbar.notification.FakeShadowView) View(android.view.View) StackScrollerDecorView(com.android.systemui.statusbar.StackScrollerDecorView) ExpandableView(com.android.systemui.statusbar.ExpandableView) DismissView(com.android.systemui.statusbar.DismissView) ScrollView(android.widget.ScrollView) ExpandableNotificationRow(com.android.systemui.statusbar.ExpandableNotificationRow)

Example 72 with ExpandableNotificationRow

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

the class StackScrollAlgorithm method getNotificationChildrenStates.

private void getNotificationChildrenStates(StackScrollState resultState, StackScrollAlgorithmState algorithmState) {
    int childCount = algorithmState.visibleChildren.size();
    for (int i = 0; i < childCount; i++) {
        ExpandableView v = algorithmState.visibleChildren.get(i);
        if (v instanceof ExpandableNotificationRow) {
            ExpandableNotificationRow row = (ExpandableNotificationRow) v;
            row.getChildrenStates(resultState);
        }
    }
}
Also used : ExpandableView(com.android.systemui.statusbar.ExpandableView) ExpandableNotificationRow(com.android.systemui.statusbar.ExpandableNotificationRow)

Example 73 with ExpandableNotificationRow

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

the class StackScrollAlgorithm method updateHeadsUpStates.

private void updateHeadsUpStates(StackScrollState resultState, StackScrollAlgorithmState algorithmState, AmbientState ambientState) {
    int childCount = algorithmState.visibleChildren.size();
    ExpandableNotificationRow topHeadsUpEntry = null;
    for (int i = 0; i < childCount; i++) {
        View child = algorithmState.visibleChildren.get(i);
        if (!(child instanceof ExpandableNotificationRow)) {
            break;
        }
        ExpandableNotificationRow row = (ExpandableNotificationRow) child;
        if (!row.isHeadsUp()) {
            break;
        }
        StackViewState childState = resultState.getViewStateForView(row);
        if (topHeadsUpEntry == null) {
            topHeadsUpEntry = row;
            childState.location = StackViewState.LOCATION_FIRST_HUN;
        }
        boolean isTopEntry = topHeadsUpEntry == row;
        float unmodifiedEndLocation = childState.yTranslation + childState.height;
        if (mIsExpanded) {
            // Ensure that the heads up is always visible even when scrolled off
            clampHunToTop(ambientState, row, childState);
            clampHunToMaxTranslation(ambientState, row, childState);
        }
        if (row.isPinned()) {
            childState.yTranslation = Math.max(childState.yTranslation, 0);
            childState.height = Math.max(row.getIntrinsicHeight(), childState.height);
            StackViewState topState = resultState.getViewStateForView(topHeadsUpEntry);
            if (!isTopEntry && (!mIsExpanded || unmodifiedEndLocation < topState.yTranslation + topState.height)) {
                // Ensure that a headsUp doesn't vertically extend further than the heads-up at
                // the top most z-position
                childState.height = row.getIntrinsicHeight();
                childState.yTranslation = topState.yTranslation + topState.height - childState.height;
            }
        }
    }
}
Also used : FakeShadowView(com.android.systemui.statusbar.notification.FakeShadowView) ExpandableView(com.android.systemui.statusbar.ExpandableView) View(android.view.View) ExpandableNotificationRow(com.android.systemui.statusbar.ExpandableNotificationRow)

Example 74 with ExpandableNotificationRow

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

the class StackScrollState method resetViewStates.

public void resetViewStates() {
    int numChildren = mHostView.getChildCount();
    for (int i = 0; i < numChildren; i++) {
        ExpandableView child = (ExpandableView) mHostView.getChildAt(i);
        resetViewState(child);
        // handling reset for child notifications
        if (child instanceof ExpandableNotificationRow) {
            ExpandableNotificationRow row = (ExpandableNotificationRow) child;
            List<ExpandableNotificationRow> children = row.getNotificationChildren();
            if (row.isSummaryWithChildren() && children != null) {
                for (ExpandableNotificationRow childRow : children) {
                    resetViewState(childRow);
                }
            }
        }
    }
}
Also used : ExpandableView(com.android.systemui.statusbar.ExpandableView) ExpandableNotificationRow(com.android.systemui.statusbar.ExpandableNotificationRow)

Example 75 with ExpandableNotificationRow

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

the class StackScrollState method applyState.

/**
     * Applies a  {@link StackViewState} to an  {@link ExpandableView}.
     *
     * @return whether the state was applied correctly
     */
public boolean applyState(ExpandableView view, StackViewState state) {
    if (state == null) {
        Log.wtf(CHILD_NOT_FOUND_TAG, "No child state was found when applying this state " + "to the hostView");
        return false;
    }
    if (state.gone) {
        return false;
    }
    applyViewState(view, state);
    int height = view.getActualHeight();
    int newHeight = state.height;
    // apply height
    if (height != newHeight) {
        view.setActualHeight(newHeight, false);
    }
    float shadowAlpha = view.getShadowAlpha();
    float newShadowAlpha = state.shadowAlpha;
    // apply shadowAlpha
    if (shadowAlpha != newShadowAlpha) {
        view.setShadowAlpha(newShadowAlpha);
    }
    // apply dimming
    view.setDimmed(state.dimmed, false);
    // apply hiding sensitive
    view.setHideSensitive(state.hideSensitive, false, /* animated */
    0, /* delay */
    0);
    // apply speed bump state
    view.setBelowSpeedBump(state.belowSpeedBump);
    // apply dark
    view.setDark(state.dark, false, /* animate */
    0);
    // apply clipping
    float oldClipTopAmount = view.getClipTopAmount();
    if (oldClipTopAmount != state.clipTopAmount) {
        view.setClipTopAmount(state.clipTopAmount);
    }
    if (view instanceof ExpandableNotificationRow) {
        ExpandableNotificationRow row = (ExpandableNotificationRow) view;
        if (state.isBottomClipped) {
            row.setClipToActualHeight(true);
        }
        row.applyChildrenState(this);
    }
    return true;
}
Also used : 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