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

Commit 4b06dcba authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Applies friction to non-dismiss drag only after the snap point."

parents 0e9b2f0c c4e68d46
Loading
Loading
Loading
Loading
+16 −2
Original line number Diff line number Diff line
@@ -604,8 +604,14 @@ public class SwipeHelper implements Gefingerpoken {
                        if (absDelta >= size) {
                            delta = delta > 0 ? maxScrollDistance : -maxScrollDistance;
                        } else {
                            delta = maxScrollDistance * (float) Math.sin(
                                    (delta / size) * (Math.PI / 2));
                            int startPosition = mCallback.getConstrainSwipeStartPosition();
                            if (absDelta > startPosition) {
                                int signedStartPosition =
                                        (int) (startPosition * Math.signum(delta));
                                delta = signedStartPosition
                                        + maxScrollDistance * (float) Math.sin(
                                        ((delta - signedStartPosition) / size) * (Math.PI / 2));
                            }
                        }
                    }

@@ -741,6 +747,14 @@ public class SwipeHelper implements Gefingerpoken {
         */
        float getFalsingThresholdFactor();

        /**
         * @return The position, in pixels, at which a constrained swipe should start being
         * constrained.
         */
        default int getConstrainSwipeStartPosition() {
            return 0;
        }

        /**
         * @return If true, the given view is draggable.
         */
+9 −0
Original line number Diff line number Diff line
@@ -5817,6 +5817,15 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
            return mStatusBar.isWakeUpComingFromTouch() ? 1.5f : 1.0f;
        }

        @Override
        public int getConstrainSwipeStartPosition() {
            NotificationMenuRowPlugin menuRow = mSwipeHelper.getCurrentMenuRow();
            if (menuRow != null) {
                return Math.abs(menuRow.getMenuSnapTarget());
            }
            return 0;
        }

                @Override
        public boolean canChildBeDismissed(View v) {
            return NotificationStackScrollLayout.this.canChildBeDismissed(v);