Search in sources :

Example 91 with ExpandableView

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

the class StackStateAnimator method processAnimationEvents.

/**
     * Process the animationEvents for a new animation
     *
     * @param animationEvents the animation events for the animation to perform
     * @param finalState the final state to animate to
     */
private void processAnimationEvents(ArrayList<NotificationStackScrollLayout.AnimationEvent> animationEvents, StackScrollState finalState) {
    for (NotificationStackScrollLayout.AnimationEvent event : animationEvents) {
        final ExpandableView changingView = (ExpandableView) event.changingView;
        if (event.animationType == NotificationStackScrollLayout.AnimationEvent.ANIMATION_TYPE_ADD) {
            // This item is added, initialize it's properties.
            StackViewState viewState = finalState.getViewStateForView(changingView);
            if (viewState == null) {
                // The position for this child was never generated, let's continue.
                continue;
            }
            finalState.applyState(changingView, viewState);
            mNewAddChildren.add(changingView);
        } else if (event.animationType == NotificationStackScrollLayout.AnimationEvent.ANIMATION_TYPE_REMOVE) {
            if (changingView.getVisibility() == View.GONE) {
                removeFromOverlay(changingView);
                continue;
            }
            // Find the amount to translate up. This is needed in order to understand the
            // direction of the remove animation (either downwards or upwards)
            StackViewState viewState = finalState.getViewStateForView(event.viewAfterChangingView);
            int actualHeight = changingView.getActualHeight();
            // upwards by default
            float translationDirection = -1.0f;
            if (viewState != null) {
                // there was a view after this one, Approximate the distance the next child
                // travelled
                translationDirection = ((viewState.yTranslation - (changingView.getTranslationY() + actualHeight / 2.0f)) * 2 / actualHeight);
                translationDirection = Math.max(Math.min(translationDirection, 1.0f), -1.0f);
            }
            changingView.performRemoveAnimation(ANIMATION_DURATION_APPEAR_DISAPPEAR, translationDirection, new Runnable() {

                @Override
                public void run() {
                    // remove the temporary overlay
                    removeFromOverlay(changingView);
                }
            });
        } else if (event.animationType == NotificationStackScrollLayout.AnimationEvent.ANIMATION_TYPE_REMOVE_SWIPED_OUT) {
            // A race condition can trigger the view to be added to the overlay even though
            // it was fully swiped out. So let's remove it
            mHostLayout.getOverlay().remove(changingView);
            if (Math.abs(changingView.getTranslation()) == changingView.getWidth() && changingView.getTransientContainer() != null) {
                changingView.getTransientContainer().removeTransientView(changingView);
            }
        } else if (event.animationType == NotificationStackScrollLayout.AnimationEvent.ANIMATION_TYPE_GROUP_EXPANSION_CHANGED) {
            ExpandableNotificationRow row = (ExpandableNotificationRow) event.changingView;
            row.prepareExpansionChanged(finalState);
        } else if (event.animationType == NotificationStackScrollLayout.AnimationEvent.ANIMATION_TYPE_HEADS_UP_APPEAR) {
            // This item is added, initialize it's properties.
            StackViewState viewState = finalState.getViewStateForView(changingView);
            mTmpState.copyFrom(viewState);
            if (event.headsUpFromBottom) {
                mTmpState.yTranslation = mHeadsUpAppearHeightBottom;
            } else {
                mTmpState.yTranslation = -mTmpState.height;
            }
            mHeadsUpAppearChildren.add(changingView);
            finalState.applyState(changingView, mTmpState);
        } else if (event.animationType == NotificationStackScrollLayout.AnimationEvent.ANIMATION_TYPE_HEADS_UP_DISAPPEAR || event.animationType == NotificationStackScrollLayout.AnimationEvent.ANIMATION_TYPE_HEADS_UP_DISAPPEAR_CLICK) {
            mHeadsUpDisappearChildren.add(changingView);
            if (changingView.getParent() == null) {
                // This notification was actually removed, so we need to add it to the overlay
                mHostLayout.getOverlay().add(changingView);
                mTmpState.initFrom(changingView);
                mTmpState.yTranslation = -changingView.getActualHeight();
                // We temporarily enable Y animations, the real filter will be combined
                // afterwards anyway
                mAnimationFilter.animateY = true;
                startViewAnimations(changingView, mTmpState, event.animationType == NotificationStackScrollLayout.AnimationEvent.ANIMATION_TYPE_HEADS_UP_DISAPPEAR_CLICK ? ANIMATION_DELAY_HEADS_UP : 0, ANIMATION_DURATION_HEADS_UP_DISAPPEAR);
                mChildrenToClearFromOverlay.add(changingView);
            }
        }
        mNewEvents.add(event);
    }
}
Also used : ExpandableView(com.android.systemui.statusbar.ExpandableView) ExpandableNotificationRow(com.android.systemui.statusbar.ExpandableNotificationRow)

Example 92 with ExpandableView

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

the class NotificationPanelView method onHeightChanged.

@Override
public void onHeightChanged(ExpandableView view, boolean needsAnimation) {
    // (i.e. view == null).
    if (view == null && mQsExpanded) {
        return;
    }
    ExpandableView firstChildNotGone = mNotificationStackScroller.getFirstChildNotGone();
    ExpandableNotificationRow firstRow = firstChildNotGone instanceof ExpandableNotificationRow ? (ExpandableNotificationRow) firstChildNotGone : null;
    if (firstRow != null && (view == firstRow || (firstRow.getNotificationParent() == firstRow))) {
        requestScrollerTopPaddingUpdate(false);
    }
    requestPanelHeightUpdate();
}
Also used : ExpandableView(com.android.systemui.statusbar.ExpandableView) ExpandableNotificationRow(com.android.systemui.statusbar.ExpandableNotificationRow)

Example 93 with ExpandableView

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

the class NotificationStackScrollLayout method handleDismissAllClipping.

private void handleDismissAllClipping() {
    final int count = getChildCount();
    boolean previousChildWillBeDismissed = false;
    for (int i = 0; i < count; i++) {
        ExpandableView child = (ExpandableView) getChildAt(i);
        if (child.getVisibility() == GONE) {
            continue;
        }
        if (mDismissAllInProgress && previousChildWillBeDismissed) {
            child.setMinClipTopAmount(child.getClipTopAmount());
        } else {
            child.setMinClipTopAmount(0);
        }
        previousChildWillBeDismissed = canChildBeDismissed(child);
    }
}
Also used : ExpandableView(com.android.systemui.statusbar.ExpandableView) Paint(android.graphics.Paint)

Example 94 with ExpandableView

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

the class NotificationStackScrollLayout method getViewBeforeView.

/**
     * @return the child before the given view which has visibility unequal to GONE
     */
public ExpandableView getViewBeforeView(ExpandableView view) {
    ExpandableView previousView = null;
    int childCount = getChildCount();
    for (int i = 0; i < childCount; i++) {
        View child = getChildAt(i);
        if (child == view) {
            return previousView;
        }
        if (child.getVisibility() != View.GONE) {
            previousView = (ExpandableView) child;
        }
    }
    return null;
}
Also used : ExpandableView(com.android.systemui.statusbar.ExpandableView) 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) Paint(android.graphics.Paint)

Example 95 with ExpandableView

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

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)

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