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

Commit 5332849c authored by Selim Cinek's avatar Selim Cinek
Browse files

Fixed another issue where the group was wrongly clipped

For groups which were not clipped rounded or in other ways,
the children would briefly appear when clicking on the group,
leading to a visible flash. We're not applying the clipping
to groups which have launching children.

Change-Id: I53990ff51ba8dd16bd66eb079fcfa455690fe81d
Fixes: 110093221
Test: add group in second slot, observe launch animations
parent c42db8df
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2083,7 +2083,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView

    @Override
    protected boolean shouldClipToActualHeight() {
        return super.shouldClipToActualHeight() && !mExpandAnimationRunning && !mChildIsExpanding;
        return super.shouldClipToActualHeight() && !mExpandAnimationRunning;
    }

    @Override
+4 −4
Original line number Diff line number Diff line
@@ -77,8 +77,6 @@ public abstract class ExpandableOutlineView extends ExpandableView {
    protected boolean mShouldTranslateContents;
    private boolean mTopAmountRounded;
    private float mDistanceToTopRoundness = -1;
    private float mExtraWidthForClipping;
    private int mMinimumHeightForClipping = 0;

    private final ViewOutlineProvider mProvider = new ViewOutlineProvider() {
        @Override
@@ -219,13 +217,15 @@ public abstract class ExpandableOutlineView extends ExpandableView {
        return result;
    }

    @Override
    public void setExtraWidthForClipping(float extraWidthForClipping) {
        mExtraWidthForClipping = extraWidthForClipping;
        super.setExtraWidthForClipping(extraWidthForClipping);
        invalidate();
    }

    @Override
    public void setMinimumHeightForClipping(int minimumHeightForClipping) {
        mMinimumHeightForClipping = minimumHeightForClipping;
        super.setMinimumHeightForClipping(minimumHeightForClipping);
        invalidate();
    }

+16 −2
Original line number Diff line number Diff line
@@ -48,6 +48,8 @@ public abstract class ExpandableView extends FrameLayout implements Dumpable {
    private int mActualHeight;
    protected int mClipTopAmount;
    protected int mClipBottomAmount;
    protected int mMinimumHeightForClipping = 0;
    protected float mExtraWidthForClipping = 0;
    private boolean mDark;
    private ArrayList<View> mMatchParentViews = new ArrayList<View>();
    private static Rect mClipRect = new Rect();
@@ -398,14 +400,26 @@ public abstract class ExpandableView extends FrameLayout implements Dumpable {
    protected void updateClipping() {
        if (mClipToActualHeight && shouldClipToActualHeight()) {
            int top = getClipTopAmount();
            mClipRect.set(0, top, getWidth(), Math.max(getActualHeight() + getExtraBottomPadding()
                    - mClipBottomAmount, top));
            int bottom = Math.max(Math.max(getActualHeight() + getExtraBottomPadding()
                    - mClipBottomAmount, top), mMinimumHeightForClipping);
            int halfExtraWidth = (int) (mExtraWidthForClipping / 2.0f);
            mClipRect.set(-halfExtraWidth, top, getWidth() + halfExtraWidth, bottom);
            setClipBounds(mClipRect);
        } else {
            setClipBounds(null);
        }
    }

    public void setMinimumHeightForClipping(int minimumHeightForClipping) {
        mMinimumHeightForClipping = minimumHeightForClipping;
        updateClipping();
    }

    public void setExtraWidthForClipping(float extraWidthForClipping) {
        mExtraWidthForClipping = extraWidthForClipping;
        updateClipping();
    }

    public float getHeaderVisibleAmount() {
        return 1.0f;
    }