From fc14e37a8b5689792084c39ec0d7b02b757c3ca1 Mon Sep 17 00:00:00 2001 From: George Mount Date: Fri, 2 Apr 2021 23:07:37 +0000 Subject: [PATCH] Fix consumption multiplier Bug: 184392385 The pull consumption should be related to the width, not the height. Test: Ran ApiDemos and result is vastly improved Change-Id: I19e1262c42b4b85920e5038a789e2e934569cac3 --- core/java/android/widget/HorizontalScrollView.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/java/android/widget/HorizontalScrollView.java b/core/java/android/widget/HorizontalScrollView.java index 23915e06335aa..105c714930a2d 100644 --- a/core/java/android/widget/HorizontalScrollView.java +++ b/core/java/android/widget/HorizontalScrollView.java @@ -762,11 +762,11 @@ public class HorizontalScrollView extends FrameLayout { if (canOverscroll) { int consumed = 0; if (deltaX < 0 && mEdgeGlowRight.getDistance() != 0f) { - consumed = Math.round(getHeight() + consumed = Math.round(getWidth() * mEdgeGlowRight.onPullDistance((float) deltaX / getWidth(), displacement)); } else if (deltaX > 0 && mEdgeGlowLeft.getDistance() != 0f) { - consumed = Math.round(-getHeight() + consumed = Math.round(-getWidth() * mEdgeGlowLeft.onPullDistance((float) -deltaX / getWidth(), 1 - displacement)); }