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

Commit 4034fc55 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Set conversation icon x at shelf start when fading into shelf" into sc-dev

parents 20e43f73 e38ca89f
Loading
Loading
Loading
Loading
+35 −56
Original line number Diff line number Diff line
@@ -713,36 +713,11 @@ public class NotificationShelf extends ActivatableNotificationView implements
            return;
        }
        ExpandableNotificationRow row = (ExpandableNotificationRow) view;

        StatusBarIconView icon = row.getShelfIcon();
        NotificationIconContainer.IconState iconState = getIconState(icon);
        View rowIcon = row.getShelfTransformationTarget();

        // Let's resolve the relative positions of the icons
        int iconStartPadding;
        if (rowIcon != null) {
            iconStartPadding = row.getRelativeStartPadding(rowIcon);
        } else {
            iconStartPadding = 0;
        if (iconState == null) {
            return;
        }
        boolean stayingInShelf = row.isInShelf() && !row.isTransformingIntoShelf();

        // Get the icon correctly positioned in X
        // Even in RTL it's the left, since we're inverting the location in post
        float shelfIconPositionX = icon.getLeft();
        shelfIconPositionX += (1.0f - icon.getIconScale()) * icon.getWidth() / 2.0f;
        float iconXTranslation = NotificationUtils.interpolate(
                iconStartPadding - shelfIconPositionX,
                mShelfIcons.getActualPaddingStart(),
                transitionAmount);

        // Let's handle the case that there's no Icon
        boolean noIcon = !row.isShowingIcon();
        if (noIcon) {
            // The view currently doesn't have an icon, lets transform it in!
            iconXTranslation = mShelfIcons.getActualPaddingStart();
        }
        if (iconState != null) {
        iconState.hidden = transitionAmount == 0.0f && !iconState.isAnimating(icon);
        boolean isAppearing = row.isDrawingAppearAnimation() && !row.isInShelf();
        if (isAppearing) {
@@ -750,7 +725,12 @@ public class NotificationShelf extends ActivatableNotificationView implements
            iconState.iconAppearAmount = 0.0f;
        }
        iconState.alpha = transitionAmount;
            iconState.xTranslation = iconXTranslation;

        // Fade in icons at shelf start
        // This is important for conversation icons, which are badged and need x reset
        iconState.xTranslation = mShelfIcons.getActualPaddingStart();

        boolean stayingInShelf = row.isInShelf() && !row.isTransformingIntoShelf();
        if (stayingInShelf) {
            iconState.iconAppearAmount = 1.0f;
            iconState.alpha = 1.0f;
@@ -766,14 +746,13 @@ public class NotificationShelf extends ActivatableNotificationView implements
        }
        int backgroundColor = getBackgroundColorWithoutTint();
        int shelfColor = icon.getContrastedStaticDrawableColor(backgroundColor);
            if (!noIcon && shelfColor != StatusBarIconView.NO_COLOR) {
        if (row.isShowingIcon() && shelfColor != StatusBarIconView.NO_COLOR) {
            int iconColor = row.getOriginalIconColor();
            shelfColor = NotificationUtils.interpolateColors(iconColor, shelfColor,
                    iconState.iconAppearAmount);
        }
        iconState.iconColor = shelfColor;
    }
    }

    private NotificationIconContainer.IconState getIconState(StatusBarIconView icon) {
        return mShelfIcons.getIconState(icon);