Search in sources :

Example 21 with ExpandableView

use of com.android.systemui.statusbar.ExpandableView in project platform_frameworks_base by android.

the class NotificationStackScrollLayout method getBottomMostNotificationBottom.

public float getBottomMostNotificationBottom() {
    final int count = getChildCount();
    float max = 0;
    for (int childIdx = 0; childIdx < count; childIdx++) {
        ExpandableView child = (ExpandableView) getChildAt(childIdx);
        if (child.getVisibility() == GONE) {
            continue;
        }
        float bottom = child.getTranslationY() + child.getActualHeight();
        if (bottom > max) {
            max = bottom;
        }
    }
    return max + getStackTranslation();
}
Also used : ExpandableView(com.android.systemui.statusbar.ExpandableView) Paint(android.graphics.Paint)

Example 22 with ExpandableView

use of com.android.systemui.statusbar.ExpandableView in project platform_frameworks_base by android.

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

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

the class NotificationStackScrollLayout method setHideSensitive.

public void setHideSensitive(boolean hideSensitive, boolean animate) {
    if (hideSensitive != mAmbientState.isHideSensitive()) {
        int childCount = getChildCount();
        for (int i = 0; i < childCount; i++) {
            ExpandableView v = (ExpandableView) getChildAt(i);
            v.setHideSensitiveForIntrinsicHeight(hideSensitive);
        }
        mAmbientState.setHideSensitive(hideSensitive);
        if (animate && mAnimationsEnabled) {
            mHideSensitiveNeedsAnimation = true;
            mNeedsAnimation = true;
        }
        requestChildrenUpdate();
    }
}
Also used : ExpandableView(com.android.systemui.statusbar.ExpandableView) Paint(android.graphics.Paint)

Example 24 with ExpandableView

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

the class NotificationStackScrollLayout method getBottomMostNotificationBottom.

public float getBottomMostNotificationBottom() {
    final int count = getChildCount();
    float max = 0;
    for (int childIdx = 0; childIdx < count; childIdx++) {
        ExpandableView child = (ExpandableView) getChildAt(childIdx);
        if (child.getVisibility() == GONE) {
            continue;
        }
        float bottom = child.getTranslationY() + child.getActualHeight();
        if (bottom > max) {
            max = bottom;
        }
    }
    return max + getStackTranslation();
}
Also used : ExpandableView(com.android.systemui.statusbar.ExpandableView) Paint(android.graphics.Paint)

Example 25 with ExpandableView

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

the class NotificationStackScrollLayout method updateContentHeight.

private void updateContentHeight() {
    int height = 0;
    float previousIncreasedAmount = 0.0f;
    for (int i = 0; i < getChildCount(); i++) {
        ExpandableView expandableView = (ExpandableView) getChildAt(i);
        if (expandableView.getVisibility() != View.GONE) {
            float increasedPaddingAmount = expandableView.getIncreasedPaddingAmount();
            if (height != 0) {
                height += (int) NotificationUtils.interpolate(mPaddingBetweenElements, mIncreasedPaddingBetweenElements, Math.max(previousIncreasedAmount, increasedPaddingAmount));
            }
            previousIncreasedAmount = increasedPaddingAmount;
            height += expandableView.getIntrinsicHeight();
        }
    }
    mContentHeight = height + mTopPadding;
    updateScrollability();
}
Also used : 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