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

Commit 5c7c8387 authored by Jordan Demeulenaere's avatar Jordan Demeulenaere Committed by Automerger Merge Worker
Browse files

Merge "Revert "Swipe notification to edge of screen"" into sc-dev am: 4f7a4210

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14017987

Change-Id: If81009fc68daafb5c7c825f0635f0130a7e829c7
parents deff1acc 4f7a4210
Loading
Loading
Loading
Loading
+6 −31
Original line number Original line Diff line number Diff line
@@ -25,7 +25,6 @@ import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.RectF;
import android.util.AttributeSet;
import android.util.AttributeSet;
import android.view.View;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewOutlineProvider;
import android.view.ViewOutlineProvider;


import com.android.systemui.R;
import com.android.systemui.R;
@@ -102,28 +101,6 @@ public abstract class ExpandableOutlineView extends ExpandableView {
        }
        }
    };
    };


    /**
     * Get the relative start padding of a view relative to this view. This recursively walks up the
     * hierarchy and does the corresponding measuring.
     *
     * @param view the view to get the padding for. The requested view has to be a child of this
     *             notification.
     * @return the start padding
     */
    public int getRelativeStartPadding(View view) {
        boolean isRtl = isLayoutRtl();
        int startPadding = 0;
        while (view.getParent() instanceof ViewGroup) {
            View parent = (View) view.getParent();
            startPadding += isRtl ? parent.getWidth() - view.getRight() : view.getLeft();
            view = parent;
            if (view == this) {
                return startPadding;
            }
        }
        return startPadding;
    }

    protected Path getClipPath(boolean ignoreTranslation) {
    protected Path getClipPath(boolean ignoreTranslation) {
        int left;
        int left;
        int top;
        int top;
@@ -132,17 +109,15 @@ public abstract class ExpandableOutlineView extends ExpandableView {
        int height;
        int height;
        float topRoundness = mAlwaysRoundBothCorners
        float topRoundness = mAlwaysRoundBothCorners
                ? mOutlineRadius : getCurrentBackgroundRadiusTop();
                ? mOutlineRadius : getCurrentBackgroundRadiusTop();

        if (!mCustomOutline) {
        if (!mCustomOutline) {
            // Extend left/right clip bounds beyond the notification by the
            int translation = mShouldTranslateContents && !ignoreTranslation
            // 1) space between the notification and edge of screen
                    ? (int) getTranslation() : 0;
            // 2) corner radius (so we do not see any rounding as the notification goes off screen)
            int halfExtraWidth = (int) (mExtraWidthForClipping / 2.0f);
            left = (int) (-getRelativeStartPadding(this) - mOutlineRadius);
            left = Math.max(translation, 0) - halfExtraWidth;
            right = (int) (((View) getParent()).getWidth() + mOutlineRadius);
            top = mClipTopAmount + mBackgroundTop;

            right = getWidth() + halfExtraWidth + Math.min(translation, 0);
            // If the top is rounded we want the bottom to be at most at the top roundness, in order
            // If the top is rounded we want the bottom to be at most at the top roundness, in order
            // to avoid the shadow changing when scrolling up.
            // to avoid the shadow changing when scrolling up.
            top = mClipTopAmount + mBackgroundTop;
            bottom = Math.max(mMinimumHeightForClipping,
            bottom = Math.max(mMinimumHeightForClipping,
                    Math.max(getActualHeight() - mClipBottomAmount, (int) (top + topRoundness)));
                    Math.max(getActualHeight() - mClipBottomAmount, (int) (top + topRoundness)));
        } else {
        } else {
+4 −14
Original line number Original line Diff line number Diff line
@@ -69,8 +69,6 @@ public abstract class ExpandableView extends FrameLayout implements Dumpable {
    private float mContentTranslation;
    private float mContentTranslation;
    protected boolean mLastInSection;
    protected boolean mLastInSection;
    protected boolean mFirstInSection;
    protected boolean mFirstInSection;
    private float mOutlineRadius;
    private float mParentWidth;


    public ExpandableView(Context context, AttributeSet attrs) {
    public ExpandableView(Context context, AttributeSet attrs) {
        super(context, attrs);
        super(context, attrs);
@@ -81,7 +79,6 @@ public abstract class ExpandableView extends FrameLayout implements Dumpable {
    private void initDimens() {
    private void initDimens() {
        mContentShift = getResources().getDimensionPixelSize(
        mContentShift = getResources().getDimensionPixelSize(
                R.dimen.shelf_transform_content_shift);
                R.dimen.shelf_transform_content_shift);
        mOutlineRadius = getResources().getDimensionPixelSize(R.dimen.notification_corner_radius);
    }
    }


    @Override
    @Override
@@ -153,9 +150,6 @@ public abstract class ExpandableView extends FrameLayout implements Dumpable {
    @Override
    @Override
    protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
    protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
        super.onLayout(changed, left, top, right, bottom);
        super.onLayout(changed, left, top, right, bottom);
        if (getParent() != null) {
            mParentWidth = ((View) getParent()).getWidth();
        }
        updateClipping();
        updateClipping();
    }
    }


@@ -442,15 +436,11 @@ public abstract class ExpandableView extends FrameLayout implements Dumpable {


    protected void updateClipping() {
    protected void updateClipping() {
        if (mClipToActualHeight && shouldClipToActualHeight()) {
        if (mClipToActualHeight && shouldClipToActualHeight()) {
            final int top = getClipTopAmount();
            int top = getClipTopAmount();
            final int bottom = Math.max(Math.max(getActualHeight() + getExtraBottomPadding()
            int bottom = Math.max(Math.max(getActualHeight() + getExtraBottomPadding()
                    - mClipBottomAmount, top), mMinimumHeightForClipping);
                    - mClipBottomAmount, top), mMinimumHeightForClipping);
            // Extend left/right clip bounds beyond the notification by the
            int halfExtraWidth = (int) (mExtraWidthForClipping / 2.0f);
            // 1) space between the notification and edge of screen
            mClipRect.set(-halfExtraWidth, top, getWidth() + halfExtraWidth, bottom);
            // 2) corner radius (so we do not see any rounding as the notification goes off screen)
            final int left = (int) (-getRelativeStartPadding(this) - mOutlineRadius);
            final int right = (int) (mParentWidth + mOutlineRadius);
            mClipRect.set(left, top, right, bottom);
            setClipBounds(mClipRect);
            setClipBounds(mClipRect);
        } else {
        } else {
            setClipBounds(null);
            setClipBounds(null);