From f6859c3da7813399240a3bd75a16c251e15735f8 Mon Sep 17 00:00:00 2001 From: Mindy Pereira Date: Fri, 8 Oct 2010 17:04:04 -0700 Subject: DO NOT MERGE Limit the height of the pull glow. Event when the user keeps pulling, should NEVER get bigger than the max height (~2list items tall). Fixes b/3074337 Overscroll glow can be stretched indefinitely Change-Id: Ifc30d4c907d432faf9ee10ddc20bcc8f50b21f81 --- core/java/android/widget/EdgeGlow.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/core/java/android/widget/EdgeGlow.java b/core/java/android/widget/EdgeGlow.java index 7a990ad..8d14462 100644 --- a/core/java/android/widget/EdgeGlow.java +++ b/core/java/android/widget/EdgeGlow.java @@ -145,10 +145,9 @@ public class EdgeGlow { mEdgeScaleY = mEdgeScaleYStart = Math.max( HELD_EDGE_SCALE_Y, Math.min(distance * PULL_DISTANCE_EDGE_FACTOR, 1.f)); - mGlowAlpha = mGlowAlphaStart = Math.min( + mGlowAlpha = mGlowAlphaStart = Math.min(MAX_ALPHA, mGlowAlpha + - (Math.abs(deltaDistance) * PULL_DISTANCE_ALPHA_GLOW_FACTOR), - MAX_ALPHA); + (Math.abs(deltaDistance) * PULL_DISTANCE_ALPHA_GLOW_FACTOR)); float glowChange = Math.abs(deltaDistance); if (deltaDistance > 0 && mPullDistance < 0) { @@ -157,8 +156,10 @@ public class EdgeGlow { if (mPullDistance == 0) { mGlowScaleY = 0; } - mGlowScaleY = mGlowScaleYStart = Math.max( - 0, mGlowScaleY + glowChange * PULL_DISTANCE_GLOW_FACTOR); + + // Do not allow glow to get larger than MAX_GLOW_HEIGHT. + mGlowScaleY = mGlowScaleYStart = Math.min(MAX_GLOW_HEIGHT, Math.max( + 0, mGlowScaleY + glowChange * PULL_DISTANCE_GLOW_FACTOR)); mEdgeAlphaFinish = mEdgeAlpha; mEdgeScaleYFinish = mEdgeScaleY; -- cgit v1.1