Bug:
32699754
Change-Id: I00d4b2398fa7f4ab4cdad290a346b0f09c2af242
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;