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

Commit b3dadccb authored by Selim Cinek's avatar Selim Cinek
Browse files

Improved the clipping of notification groups

Groups now correctly respect the clipBottomAmount and
animations work much better when swiping things away.

Also removed the group measuring logic when expanding,
Since we're now not shrinking the first notification anymore!

This also fixed a bug where a child could be invisible

Test: Add group, swipe children away
Bug: 32437839
Bug: 33203156
Change-Id: I255aa9695086e64eb10c7dccdc6122d8a8572bb5
parent 1f8c21c1
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -1685,6 +1685,9 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
        if (mGuts != null) {
            mGuts.setClipBottomAmount(clipBottomAmount);
        }
        if (mChildrenContainer != null) {
            mChildrenContainer.setClipBottomAmount(clipBottomAmount);
        }
    }

    public boolean isMaxExpandHeightInitialized() {
@@ -1863,9 +1866,6 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
            super.applyToView(view);
            if (view instanceof ExpandableNotificationRow) {
                ExpandableNotificationRow row = (ExpandableNotificationRow) view;
                if (this.isBottomClipped) {
                    row.setClipToActualHeight(true);
                }
                row.applyChildrenState(mOverallState);
            }
        }
+7 −1
Original line number Diff line number Diff line
@@ -41,7 +41,7 @@ public abstract class ExpandableOutlineView extends ExpandableView {
                outline.setRect(translation,
                        mClipTopAmount,
                        getWidth() + translation,
                        Math.max(getActualHeight(), mClipTopAmount));
                        Math.max(getActualHeight() - mClipBottomAmount, mClipTopAmount));
            } else {
                outline.setRect(mOutlineRect);
            }
@@ -66,6 +66,12 @@ public abstract class ExpandableOutlineView extends ExpandableView {
        invalidateOutline();
    }

    @Override
    public void setClipBottomAmount(int clipBottomAmount) {
        super.setClipBottomAmount(clipBottomAmount);
        invalidateOutline();
    }

    protected void setOutlineAlpha(float alpha) {
        if (alpha != mOutlineAlpha) {
            mOutlineAlpha = alpha;
+4 −7
Original line number Diff line number Diff line
@@ -38,7 +38,7 @@ public abstract class ExpandableView extends FrameLayout {
    protected OnHeightChangedListener mOnHeightChangedListener;
    private int mActualHeight;
    protected int mClipTopAmount;
    private float mClipBottomAmount;
    protected int mClipBottomAmount;
    private boolean mDark;
    private ArrayList<View> mMatchParentViews = new ArrayList<View>();
    private static Rect mClipRect = new Rect();
@@ -241,7 +241,7 @@ public abstract class ExpandableView extends FrameLayout {
        return mClipTopAmount;
    }

    public float getClipBottomAmount() {
    public int getClipBottomAmount() {
        return mClipBottomAmount;
    }

@@ -354,11 +354,8 @@ public abstract class ExpandableView extends FrameLayout {
    private void updateClipping() {
        if (mClipToActualHeight) {
            int top = getClipTopAmount();
            if (top >= getActualHeight()) {
                top = getActualHeight() - 1;
            }
            mClipRect.set(0, top, getWidth(), (int) (getActualHeight() + getExtraBottomPadding()
                                - mClipBottomAmount));
            mClipRect.set(0, top, getWidth(), Math.max(getActualHeight() + getExtraBottomPadding()
                                - mClipBottomAmount, top));
            setClipBounds(mClipRect);
        } else {
            setClipBounds(null);
+0 −1
Original line number Diff line number Diff line
@@ -156,7 +156,6 @@ public class NotificationShelf extends ActivatableNotificationView {
            mShelfState.alpha = 1.0f;
            mShelfState.belowSpeedBump = mAmbientState.getSpeedBumpIndex() == 0;
            mShelfState.shadowAlpha = 1.0f;
            mShelfState.isBottomClipped = false;
            mShelfState.hideSensitive = false;
            mShelfState.xTranslation = getTranslationX();
            if (mNotGoneIndex != -1) {
+0 −6
Original line number Diff line number Diff line
@@ -106,11 +106,6 @@ public class ExpandableViewState extends ViewState {
     */
    public int location;

    /**
     * Whether a child in a group is being clipped at the bottom.
     */
    public boolean isBottomClipped;

    @Override
    public void copyFrom(ViewState viewState) {
        super.copyFrom(viewState);
@@ -125,7 +120,6 @@ public class ExpandableViewState extends ViewState {
            clipTopAmount = svs.clipTopAmount;
            notGoneIndex = svs.notGoneIndex;
            location = svs.location;
            isBottomClipped = svs.isBottomClipped;
        }
    }

Loading