Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f42b43a1 authored by Aran Ink's avatar Aran Ink Committed by android-build-merger
Browse files

Merge "Allow all ActivatableNotificationRows to clip properly when interacting...

Merge "Allow all ActivatableNotificationRows to clip properly when interacting with the shelf." into qt-dev
am: b7a1ea9a

Change-Id: I7986e1033a2d0d208e0b647dd290927b7a7c7f41
parents 5f7851df b7a1ea9a
Loading
Loading
Loading
Loading
+50 −40
Original line number Diff line number Diff line
@@ -294,17 +294,17 @@ public class NotificationShelf extends ActivatableNotificationView implements
        int backgroundTop = 0;
        int clipTopAmount = 0;
        float firstElementRoundness = 0.0f;
        ExpandableNotificationRow previousRow = null;
        ActivatableNotificationView previousRow = null;

        for (int i = 0; i < mHostLayout.getChildCount(); i++) {
            ExpandableView child = (ExpandableView) mHostLayout.getChildAt(i);

            if (!(child instanceof ExpandableNotificationRow)
                    || child.getVisibility() == GONE) {
            if (!(child instanceof ActivatableNotificationView)
                    || child.getVisibility() == GONE || child == this) {
                continue;
            }

            ExpandableNotificationRow row = (ExpandableNotificationRow) child;
            ActivatableNotificationView row = (ActivatableNotificationView) child;
            float notificationClipEnd;
            boolean aboveShelf = ViewState.getFinalTranslationZ(row) > baseZHeight
                    || row.isPinned();
@@ -324,7 +324,14 @@ public class NotificationShelf extends ActivatableNotificationView implements
            }
            int clipTop = updateNotificationClipHeight(row, notificationClipEnd, notGoneIndex);
            clipTopAmount = Math.max(clipTop, clipTopAmount);
            float inShelfAmount = updateIconAppearance(row, expandAmount, scrolling, scrollingFast,

            // If the current row is an ExpandableNotificationRow, update its color, roundedness,
            // and icon state.
            if (row instanceof ExpandableNotificationRow) {
                ExpandableNotificationRow expandableRow = (ExpandableNotificationRow) row;

                float inShelfAmount = updateIconAppearance(expandableRow, expandAmount, scrolling,
                        scrollingFast,
                        expandingAnimated, isLastChild);
                numViewsInShelf += inShelfAmount;
                int ownColorUntinted = row.getBackgroundColorWithoutTint();
@@ -347,20 +354,25 @@ public class NotificationShelf extends ActivatableNotificationView implements
                    row.setOverrideTintColor(NO_COLOR, 0 /* overrideAmount */);
                }
                if (notGoneIndex != 0 || !aboveShelf) {
                row.setAboveShelf(false);
                    expandableRow.setAboveShelf(false);
                }
                if (notGoneIndex == 0) {
                StatusBarIconView icon = row.getEntry().expandedIcon;
                    StatusBarIconView icon = expandableRow.getEntry().expandedIcon;
                    NotificationIconContainer.IconState iconState = getIconState(icon);
                    // The icon state might be null in rare cases where the notification is actually
                // added to the layout, but not to the shelf. An example are replied messages, since
                // they don't show up on AOD
                    // added to the layout, but not to the shelf. An example are replied messages,
                    // since they don't show up on AOD
                    if (iconState != null && iconState.clampedAppearAmount == 1.0f) {
                        // only if the first icon is fully in the shelf we want to clip to it!
                        backgroundTop = (int) (row.getTranslationY() - getTranslationY());
                        firstElementRoundness = row.getCurrentTopRoundness();
                    }
                }

                previousColor = ownColorUntinted;
                notGoneIndex++;
            }

            if (row.isFirstInSection() && previousRow != null && previousRow.isLastInSection()) {
                // If the top of the shelf is between the view before a gap and the view after a gap
                // then we need to adjust the shelf's top roundness.
@@ -379,8 +391,6 @@ public class NotificationShelf extends ActivatableNotificationView implements
                    backgroundTop = (int) distanceToGapBottom;
                }
            }
            notGoneIndex++;
            previousColor = ownColorUntinted;
            previousRow = row;
        }
        clipTransientViews();
@@ -497,7 +507,7 @@ public class NotificationShelf extends ActivatableNotificationView implements
     * Update the clipping of this view.
     * @return the amount that our own top should be clipped
     */
    private int updateNotificationClipHeight(ExpandableNotificationRow row,
    private int updateNotificationClipHeight(ActivatableNotificationView row,
            float notificationClipEnd, int childIndex) {
        float viewEnd = row.getTranslationY() + row.getActualHeight();
        boolean isPinned = (row.isPinned() || row.isHeadsUpAnimatingAway())