Search in sources :

Example 76 with ExpandableView

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

the class NotificationStackScrollLayout method getFirstChildIntrinsicHeight.

public int getFirstChildIntrinsicHeight() {
    final ExpandableView firstChild = getFirstChildNotGone();
    int firstChildMinHeight = firstChild != null ? firstChild.getIntrinsicHeight() : mEmptyShadeView != null ? mEmptyShadeView.getIntrinsicHeight() : mCollapsedSize;
    if (mOwnScrollY > 0) {
        firstChildMinHeight = Math.max(firstChildMinHeight - mOwnScrollY, mCollapsedSize);
    }
    return firstChildMinHeight;
}
Also used : ExpandableView(com.android.systemui.statusbar.ExpandableView) Paint(android.graphics.Paint)

Example 77 with ExpandableView

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

the class NotificationStackScrollLayout method onExpansionStopped.

public void onExpansionStopped() {
    mIsExpansionChanging = false;
    if (!mIsExpanded) {
        setOwnScrollY(0);
        mPhoneStatusBar.resetUserExpandedStates();
        // lets make sure nothing is in the overlay / transient anymore
        clearTemporaryViews(this);
        for (int i = 0; i < getChildCount(); i++) {
            ExpandableView child = (ExpandableView) getChildAt(i);
            if (child instanceof ExpandableNotificationRow) {
                ExpandableNotificationRow row = (ExpandableNotificationRow) child;
                clearTemporaryViews(row.getChildrenContainer());
            }
        }
    }
}
Also used : ExpandableView(com.android.systemui.statusbar.ExpandableView) Paint(android.graphics.Paint) ExpandableNotificationRow(com.android.systemui.statusbar.ExpandableNotificationRow)

Example 78 with ExpandableView

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

the class NotificationStackScrollLayout method getClosestChildAtRawPosition.

public ExpandableView getClosestChildAtRawPosition(float touchX, float touchY) {
    getLocationOnScreen(mTempInt2);
    float localTouchY = touchY - mTempInt2[1];
    ExpandableView closestChild = null;
    float minDist = Float.MAX_VALUE;
    // find the view closest to the location, accounting for GONE views
    final int count = getChildCount();
    for (int childIdx = 0; childIdx < count; childIdx++) {
        ExpandableView slidingChild = (ExpandableView) getChildAt(childIdx);
        if (slidingChild.getVisibility() == GONE || slidingChild instanceof StackScrollerDecorView) {
            continue;
        }
        float childTop = slidingChild.getTranslationY();
        float top = childTop + slidingChild.getClipTopAmount();
        float bottom = childTop + slidingChild.getActualHeight();
        float dist = Math.min(Math.abs(top - localTouchY), Math.abs(bottom - localTouchY));
        if (dist < minDist) {
            closestChild = slidingChild;
            minDist = dist;
        }
    }
    return closestChild;
}
Also used : StackScrollerDecorView(com.android.systemui.statusbar.StackScrollerDecorView) ExpandableView(com.android.systemui.statusbar.ExpandableView) Paint(android.graphics.Paint)

Example 79 with ExpandableView

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

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 80 with ExpandableView

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

the class StackScrollAlgorithm method updateZValuesForState.

/**
     * Calculate the Z positions for all children based on the number of items in both stacks and
     * save it in the resultState
     *  @param resultState The result state to update the zTranslation values
     * @param algorithmState The state in which the current pass of the algorithm is currently in
     * @param ambientState The ambient state of the algorithm
     */
private void updateZValuesForState(StackScrollState resultState, StackScrollAlgorithmState algorithmState, AmbientState ambientState) {
    int childCount = algorithmState.visibleChildren.size();
    float childrenOnTop = 0.0f;
    for (int i = childCount - 1; i >= 0; i--) {
        ExpandableView child = algorithmState.visibleChildren.get(i);
        StackViewState childViewState = resultState.getViewStateForView(child);
        if (i > (childCount - 1 - algorithmState.itemsInBottomStack)) {
            // We are in the bottom stack
            float numItemsAbove = i - (childCount - 1 - algorithmState.itemsInBottomStack);
            float zSubtraction;
            if (numItemsAbove <= 1.0f) {
                float factor = 0.2f;
                // Lets fade in slower to the threshold to make the shadow fade in look nicer
                if (numItemsAbove <= factor) {
                    zSubtraction = FakeShadowView.SHADOW_SIBLING_TRESHOLD * numItemsAbove * (1.0f / factor);
                } else {
                    zSubtraction = FakeShadowView.SHADOW_SIBLING_TRESHOLD + (numItemsAbove - factor) * (1.0f / (1.0f - factor)) * (mZDistanceBetweenElements - FakeShadowView.SHADOW_SIBLING_TRESHOLD);
                }
            } else {
                zSubtraction = numItemsAbove * mZDistanceBetweenElements;
            }
            childViewState.zTranslation = mZBasicHeight - zSubtraction;
        } else if (child.mustStayOnScreen() && childViewState.yTranslation < ambientState.getTopPadding() + ambientState.getStackTranslation()) {
            if (childrenOnTop != 0.0f) {
                childrenOnTop++;
            } else {
                float overlap = ambientState.getTopPadding() + ambientState.getStackTranslation() - childViewState.yTranslation;
                childrenOnTop += Math.min(1.0f, overlap / childViewState.height);
            }
            childViewState.zTranslation = mZBasicHeight + childrenOnTop * mZDistanceBetweenElements;
        } else {
            childViewState.zTranslation = mZBasicHeight;
        }
    }
}
Also used : ExpandableView(com.android.systemui.statusbar.ExpandableView)

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