Search in sources :

Example 96 with ExpandableView

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

the class StackScrollState method apply.

/**
     * Apply the properties saved in {@link #mStateMap} to the children of the {@link #mHostView}.
     * The properties are only applied if they effectively changed.
     */
public void apply() {
    int numChildren = mHostView.getChildCount();
    for (int i = 0; i < numChildren; i++) {
        ExpandableView child = (ExpandableView) mHostView.getChildAt(i);
        StackViewState state = mStateMap.get(child);
        if (!applyState(child, state)) {
            continue;
        }
        if (child instanceof DismissView) {
            DismissView dismissView = (DismissView) child;
            boolean visible = state.clipTopAmount < mClearAllTopPadding;
            dismissView.performVisibilityAnimation(visible && !dismissView.willBeGone());
        } else if (child instanceof EmptyShadeView) {
            EmptyShadeView emptyShadeView = (EmptyShadeView) child;
            boolean visible = state.clipTopAmount <= 0;
            emptyShadeView.performVisibilityAnimation(visible && !emptyShadeView.willBeGone());
        }
    }
}
Also used : EmptyShadeView(com.android.systemui.statusbar.EmptyShadeView) DismissView(com.android.systemui.statusbar.DismissView) ExpandableView(com.android.systemui.statusbar.ExpandableView)

Example 97 with ExpandableView

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

the class StackStateAnimator method findLastNotAddedIndex.

private int findLastNotAddedIndex(StackScrollState finalState) {
    int childCount = mHostLayout.getChildCount();
    for (int i = childCount - 1; i >= 0; i--) {
        final ExpandableView child = (ExpandableView) mHostLayout.getChildAt(i);
        StackViewState viewState = finalState.getViewStateForView(child);
        if (viewState == null || child.getVisibility() == View.GONE) {
            continue;
        }
        if (!mNewAddChildren.contains(child)) {
            return viewState.notGoneIndex;
        }
    }
    return -1;
}
Also used : ExpandableView(com.android.systemui.statusbar.ExpandableView)

Example 98 with ExpandableView

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

the class NotificationStackScrollLayout method isBelowLastNotification.

public boolean isBelowLastNotification(float touchX, float touchY) {
    int childCount = getChildCount();
    for (int i = childCount - 1; i >= 0; i--) {
        ExpandableView child = (ExpandableView) getChildAt(i);
        if (child.getVisibility() != View.GONE) {
            float childTop = child.getY();
            if (childTop > touchY) {
                // we are above a notification entirely let's abort
                return false;
            }
            boolean belowChild = touchY > childTop + child.getActualHeight();
            if (child == mDismissView) {
                if (!belowChild && !mDismissView.isOnEmptySpace(touchX - mDismissView.getX(), touchY - childTop)) {
                    // We clicked on the dismiss button
                    return false;
                }
            } else if (child == mEmptyShadeView) {
                // We arrived at the empty shade view, for which we accept all clicks
                return true;
            } else if (!belowChild) {
                // We are on a child
                return false;
            }
        }
    }
    return touchY > mTopPadding + mStackTranslation;
}
Also used : ExpandableView(com.android.systemui.statusbar.ExpandableView) Paint(android.graphics.Paint)

Example 99 with ExpandableView

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

the class NotificationStackScrollLayout method updateScrollStateForAddedChildren.

private void updateScrollStateForAddedChildren() {
    if (mChildrenToAddAnimated.isEmpty()) {
        return;
    }
    for (int i = 0; i < getChildCount(); i++) {
        ExpandableView child = (ExpandableView) getChildAt(i);
        if (mChildrenToAddAnimated.contains(child)) {
            int startingPosition = getPositionInLinearLayout(child);
            int padding = child.getIncreasedPaddingAmount() == 1.0f ? mIncreasedPaddingBetweenElements : mPaddingBetweenElements;
            int childHeight = getIntrinsicHeight(child) + padding;
            if (startingPosition < mOwnScrollY) {
                // This child starts off screen, so let's keep it offscreen to keep the others visible
                setOwnScrollY(mOwnScrollY + childHeight);
            }
        }
    }
    clampScrollPosition();
}
Also used : ExpandableView(com.android.systemui.statusbar.ExpandableView) Paint(android.graphics.Paint)

Example 100 with ExpandableView

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

the class NotificationStackScrollLayout method getPositionInLinearLayout.

private int getPositionInLinearLayout(View requestedView) {
    ExpandableNotificationRow childInGroup = null;
    ExpandableNotificationRow requestedRow = null;
    if (isChildInGroup(requestedView)) {
        // We're asking for a child in a group. Calculate the position of the parent first,
        // then within the parent.
        childInGroup = (ExpandableNotificationRow) requestedView;
        requestedView = requestedRow = childInGroup.getNotificationParent();
    }
    int position = 0;
    float previousIncreasedAmount = 0.0f;
    for (int i = 0; i < getChildCount(); i++) {
        ExpandableView child = (ExpandableView) getChildAt(i);
        boolean notGone = child.getVisibility() != View.GONE;
        if (notGone) {
            float increasedPaddingAmount = child.getIncreasedPaddingAmount();
            if (position != 0) {
                position += (int) NotificationUtils.interpolate(mPaddingBetweenElements, mIncreasedPaddingBetweenElements, Math.max(previousIncreasedAmount, increasedPaddingAmount));
            }
            previousIncreasedAmount = increasedPaddingAmount;
        }
        if (child == requestedView) {
            if (requestedRow != null) {
                position += requestedRow.getPositionOfChild(childInGroup);
            }
            return position;
        }
        if (notGone) {
            position += getIntrinsicHeight(child);
        }
    }
    return 0;
}
Also used : ExpandableView(com.android.systemui.statusbar.ExpandableView) Paint(android.graphics.Paint) ExpandableNotificationRow(com.android.systemui.statusbar.ExpandableNotificationRow)

Aggregations

ExpandableView (com.android.systemui.statusbar.ExpandableView)172 Paint (android.graphics.Paint)92 ExpandableNotificationRow (com.android.systemui.statusbar.ExpandableNotificationRow)55 StackScrollerDecorView (com.android.systemui.statusbar.StackScrollerDecorView)15 DismissView (com.android.systemui.statusbar.DismissView)10 EmptyShadeView (com.android.systemui.statusbar.EmptyShadeView)10 View (android.view.View)5 ViewGroup (android.view.ViewGroup)5 ViewParent (android.view.ViewParent)5 ScrollView (android.widget.ScrollView)5 ActivatableNotificationView (com.android.systemui.statusbar.ActivatableNotificationView)5 FakeShadowView (com.android.systemui.statusbar.notification.FakeShadowView)5 ScrollContainer (com.android.systemui.statusbar.stack.ScrollContainer)5