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

Commit 7a9551a3 authored by Adrian Roos's avatar Adrian Roos
Browse files

AoD: Adjust shelf, only show top notification

Bug: 30876804
Test: manual
Change-Id: I411f08ae37bd9bf60f323302af27aac5a9ed36c5
parent 7907ff24
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -128,6 +128,7 @@ public class NotificationShelf extends ActivatableNotificationView {
        } else {
            mViewInvertHelper.update(dark);
        }
        mShelfIcons.setCentered(dark);
    }

    @Override
+14 −0
Original line number Diff line number Diff line
@@ -98,6 +98,7 @@ public class NotificationIconContainer extends AlphaOptimizedFrameLayout {
    private int mActualLayoutWidth = NO_VALUE;
    private float mActualPaddingEnd = NO_VALUE;
    private float mActualPaddingStart = NO_VALUE;
    private boolean mCentered;
    private boolean mChangingViewPositions;
    private int mAddAnimationStartIndex = -1;
    private int mCannedAnimationStartIndex = -1;
@@ -310,6 +311,15 @@ public class NotificationIconContainer extends AlphaOptimizedFrameLayout {
                numDots++;
            }
        }
        if (mCentered && translationX < getLayoutEnd()) {
            float delta = (getLayoutEnd() - translationX) / 2;
            for (int i = 0; i < childCount; i++) {
                View view = getChildAt(i);
                IconState iconState = mIconStates.get(view);
                iconState.xTranslation += delta;
            }
        }

        if (isLayoutRtl()) {
            for (int i = 0; i < childCount; i++) {
                View view = getChildAt(i);
@@ -379,6 +389,10 @@ public class NotificationIconContainer extends AlphaOptimizedFrameLayout {
        mChangingViewPositions = changingViewPositions;
    }

    public void setCentered(boolean centered) {
        mCentered = centered;
    }

    public IconState getIconState(StatusBarIconView icon) {
        return mIconStates.get(icon);
    }
+10 −2
Original line number Diff line number Diff line
@@ -1879,12 +1879,16 @@ public class NotificationStackScrollLayout extends ViewGroup
        float previousIncreasedAmount = 0.0f;
        int numShownItems = 0;
        boolean finish = false;
        int maxDisplayedNotifications = mAmbientState.isDark()
                ? (mPulsing ? 1 : 0)
                : mMaxDisplayedNotifications;

        for (int i = 0; i < getChildCount(); i++) {
            ExpandableView expandableView = (ExpandableView) getChildAt(i);
            if (expandableView.getVisibility() != View.GONE
                    && !expandableView.hasNoContentHeight()) {
                if (mMaxDisplayedNotifications != -1
                        && numShownItems >= mMaxDisplayedNotifications) {
                if (maxDisplayedNotifications != -1
                        && numShownItems >= maxDisplayedNotifications) {
                    expandableView = mShelf;
                    finish = true;
                }
@@ -3477,6 +3481,8 @@ public class NotificationStackScrollLayout extends ViewGroup
            updateBackground();
            setWillNotDraw(false);
        }
        updateContentHeight();
        notifyHeightChangeListener(mShelf);
    }

    private void setBackgroundFadeAmount(float fadeAmount) {
@@ -3912,6 +3918,8 @@ public class NotificationStackScrollLayout extends ViewGroup
    public void setPulsing(boolean pulsing) {
        mPulsing = pulsing;
        updateNotificationAnimationStates();
        updateContentHeight();
        notifyHeightChangeListener(mShelf);
    }

    public void setFadingOut(boolean fadingOut) {