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

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

Merge "Add safety net if StackView duration would be negative."

parents 9310f59c 400ef79b
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -1051,6 +1051,11 @@ public class StackView extends AdapterViewAnimator {

                float d = (float) Math.hypot(viewLp.horizontalOffset, viewLp.verticalOffset);
                float maxd = (float) Math.hypot(mSlideAmount, 0.4f * mSlideAmount);
                if (d > maxd) {
                    // Because mSlideAmount is updated in onLayout(), it is possible that d > maxd
                    // if we get onLayout() right before this method is called.
                    d = maxd;
                }

                if (velocity == 0) {
                    return (invert ? (1 - d / maxd) : d / maxd) * DEFAULT_ANIMATION_DURATION;