Search in sources :

Example 51 with ExpandableView

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

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

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

the class NotificationStackScrollLayout method scrollTo.

@Override
public boolean scrollTo(View v) {
    ExpandableView expandableView = (ExpandableView) v;
    int positionInLinearLayout = getPositionInLinearLayout(v);
    int targetScroll = targetScrollForView(expandableView, positionInLinearLayout);
    int outOfViewScroll = positionInLinearLayout + expandableView.getIntrinsicHeight();
    // that it is not visible anymore.
    if (mOwnScrollY < targetScroll || outOfViewScroll < mOwnScrollY) {
        mScroller.startScroll(mScrollX, mOwnScrollY, 0, targetScroll - mOwnScrollY);
        mDontReportNextOverScroll = true;
        postInvalidateOnAnimation();
        return true;
    }
    return false;
}
Also used : ExpandableView(com.android.systemui.statusbar.ExpandableView) Paint(android.graphics.Paint)

Example 53 with ExpandableView

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

the class NotificationStackScrollLayout method changeViewPosition.

/**
     * Change the position of child to a new location
     *
     * @param child the view to change the position for
     * @param newIndex the new index
     */
public void changeViewPosition(View child, int newIndex) {
    int currentIndex = indexOfChild(child);
    if (child != null && child.getParent() == this && currentIndex != newIndex) {
        mChangePositionInProgress = true;
        ((ExpandableView) child).setChangingPosition(true);
        removeView(child);
        addView(child, newIndex);
        ((ExpandableView) child).setChangingPosition(false);
        mChangePositionInProgress = false;
        if (mIsExpanded && mAnimationsEnabled && child.getVisibility() != View.GONE) {
            mChildrenChangingPositions.add(child);
            mNeedsAnimation = true;
        }
    }
}
Also used : ExpandableView(com.android.systemui.statusbar.ExpandableView) Paint(android.graphics.Paint)

Example 54 with ExpandableView

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

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

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

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)

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