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

Commit c0e09ce7 authored by Lyn Han's avatar Lyn Han
Browse files

Round notif corners on swipe

Bug: 171817112
Test: manual (lockscreen & shade)
 - swipe (first/middle/last) notif in section, corners round
   - let go, corners restore
   - with half swipe menu, corners restore when menu shows and hides

Change-Id: I9897c0a9fbfd481e72e6ad0f724761d3ace7a99d
parent 6eba7325
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -54,7 +54,8 @@ public abstract class ExpandableOutlineView extends ExpandableView {
            R.id.bottom_roundess_animator_end_tag,
            R.id.bottom_roundess_animator_start_tag);
    private static final AnimationProperties ROUNDNESS_PROPERTIES =
            new AnimationProperties().setDuration(StackStateAnimator.ANIMATION_DURATION_STANDARD);
            new AnimationProperties().setDuration(
                    StackStateAnimator.ANIMATION_DURATION_CORNER_RADIUS);
    private static final Path EMPTY_PATH = new Path();

    private final Rect mOutlineRect = new Rect();
+9 −0
Original line number Diff line number Diff line
@@ -69,6 +69,7 @@ public abstract class ExpandableView extends FrameLayout implements Dumpable {
    private float mContentTranslation;
    protected boolean mLastInSection;
    protected boolean mFirstInSection;
    boolean mIsBeingSwiped;

    public ExpandableView(Context context, AttributeSet attrs) {
        super(context, attrs);
@@ -173,6 +174,14 @@ public abstract class ExpandableView extends FrameLayout implements Dumpable {
        return false;
    }

    public void setIsBeingSwiped(boolean swiped) {
        mIsBeingSwiped = swiped;
    }

    public boolean isBeingSwiped() {
        return mIsBeingSwiped;
    }

    public boolean isHeadsUpAnimatingAway() {
        return false;
    }
+4 −2
Original line number Diff line number Diff line
@@ -67,7 +67,7 @@ public class NotificationRoundnessManager {
        }
    }

    private boolean updateViewWithoutCallback(ExpandableView view,
    boolean updateViewWithoutCallback(ExpandableView view,
            boolean animate) {
        float topRoundness = getRoundness(view, true /* top */);
        float bottomRoundness = getRoundness(view, false /* top */);
@@ -107,7 +107,9 @@ public class NotificationRoundnessManager {
    }

    private float getRoundness(ExpandableView view, boolean top) {
        if ((view.isPinned() || view.isHeadsUpAnimatingAway()) && !mExpanded) {
        if ((view.isPinned()
                || view.isBeingSwiped()
                || (view.isHeadsUpAnimatingAway()) && !mExpanded)) {
            return 1.0f;
        }
        if (isFirstInSection(view, true /* include first section */) && top) {
+14 −2
Original line number Diff line number Diff line
@@ -5489,7 +5489,13 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
        mSwipedOutViews.add(v);
    }

    void onSwipeBegin() {
    void onSwipeBegin(View v) {
        if (v instanceof ExpandableView) {
            ExpandableView ev = (ExpandableView) v;
            ev.setIsBeingSwiped(true);
            mController.getNoticationRoundessManager()
                    .updateViewWithoutCallback(ev, true /* animate */);
        }
        requestDisallowInterceptTouchEvent(true);
        updateFirstAndLastBackgroundViews();
        updateContinuousShadowDrawing();
@@ -5497,7 +5503,13 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
        requestChildrenUpdate();
    }

    void onSwipeEnd() {
    void onSwipeEnd(View v) {
        if (v instanceof ExpandableView) {
            ExpandableView ev = (ExpandableView) v;
            ev.setIsBeingSwiped(false);
            mController.getNoticationRoundessManager()
                    .updateViewWithoutCallback(ev, true /* animate */);
        }
        updateFirstAndLastBackgroundViews();
    }

+3 −3
Original line number Diff line number Diff line
@@ -395,7 +395,7 @@ public class NotificationStackScrollLayoutController {
                    if (mView.getDismissAllInProgress()) {
                        return;
                    }
                    mView.onSwipeEnd();
                    mView.onSwipeEnd(view);
                    if (view instanceof ExpandableNotificationRow) {
                        ExpandableNotificationRow row = (ExpandableNotificationRow) view;
                        if (row.isHeadsUp()) {
@@ -450,12 +450,12 @@ public class NotificationStackScrollLayoutController {
                @Override
                public void onBeginDrag(View v) {
                    mFalsingCollector.onNotificationStartDismissing();
                    mView.onSwipeBegin();
                    mView.onSwipeBegin(v);
                }

                @Override
                public void onChildSnappedBack(View animView, float targetLeft) {
                    mView.onSwipeEnd();
                    mView.onSwipeEnd(animView);
                    if (animView instanceof ExpandableNotificationRow) {
                        ExpandableNotificationRow row = (ExpandableNotificationRow) animView;
                        if (row.isPinned() && !canChildBeDismissed(row)
Loading